This commit is contained in:
pa
2026-02-02 20:31:26 +09:00
parent c9e7dd24a4
commit a0da1bb3d5
3 changed files with 38 additions and 17 deletions

View File

@@ -819,7 +819,7 @@
const modalStore = useModalStore();
const { translateText } = useAdvancedSettingsStore();
const { bioLanguage, translationApi, translationApiType } = storeToRefs(useAdvancedSettingsStore());
const { bioLanguage, translationApi } = storeToRefs(useAdvancedSettingsStore());
const NewInstanceDialog = defineAsyncComponent(() => import('../NewInstanceDialog.vue'));
const ChangeWorldImageDialog = defineAsyncComponent(() => import('./ChangeWorldImageDialog.vue'));
@@ -1384,7 +1384,7 @@
}
watch(
() => worldDialog.value.id,
() => [worldDialog.value.id, worldDialog.value.ref?.description],
() => {
translatedDescription.value = '';
}

View File

@@ -401,20 +401,40 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
return [];
}
const normalizedBaseURL = baseURL.endsWith('/')
? baseURL.slice(0, -1)
: baseURL;
let modelsURL = '';
try {
const url = new URL(baseURL);
const basePath = url.pathname.replace(/\/+$/, '');
let modelsURL;
if (normalizedBaseURL.includes('/chat/completions')) {
modelsURL = normalizedBaseURL.replace(
/\/chat\/completions$/,
'/models'
);
} else if (normalizedBaseURL.endsWith('/models')) {
modelsURL = normalizedBaseURL;
} else {
modelsURL = `${normalizedBaseURL}/models`;
if (basePath.endsWith('/chat/completions')) {
url.pathname = basePath.replace(
/\/chat\/completions$/,
'/models'
);
} else if (basePath.endsWith('/models')) {
url.pathname = basePath;
} else {
url.pathname = `${basePath}/models`;
}
url.search = '';
url.hash = '';
modelsURL = url.toString();
} catch {
const normalizedBaseURL = baseURL.endsWith('/')
? baseURL.slice(0, -1)
: baseURL;
if (normalizedBaseURL.includes('/chat/completions')) {
modelsURL = normalizedBaseURL.replace(
/\/chat\/completions$/,
'/models'
);
} else if (normalizedBaseURL.endsWith('/models')) {
modelsURL = normalizedBaseURL;
} else {
modelsURL = `${normalizedBaseURL}/models`;
}
}
const headers = {};
@@ -462,6 +482,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
return [];
}
}
function setBioLanguage(language) {
bioLanguage.value = language;
configRepository.setString('VRCX_bioLanguage', language);
@@ -794,7 +815,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
const translated = data?.choices?.[0]?.message?.content;
return typeof translated === 'string' ? translated.trim() : null;
} catch (err) {
toast.error(`Translation failed: ${err.message}`);
toast.error(`Translation failed`);
return null;
}
}

View File

@@ -164,8 +164,8 @@
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import { Field, FieldContent, FieldGroup, FieldLabel } from '@/components/ui/field';
import { InputGroupField, InputGroupTextareaField } from '@/components/ui/input-group';
import { reactive, ref, watch } from 'vue';
import { InputGroupField, InputGroupTextareaField } from '@/components/ui/input-group';
import { Button } from '@/components/ui/button';
import { storeToRefs } from 'pinia';
import { toast } from 'vue-sonner';