combine gender and tone with srclang
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { ref } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { useLocalStorage } from '@vueuse/core';
|
import { useLocalStorage } from '@vueuse/core';
|
||||||
|
|
||||||
@@ -131,8 +131,19 @@ export const useSettingsStore = defineStore('settings', () => {
|
|||||||
const sourceLang = useLocalStorage<Language>('source-lang-v2', LANGUAGES[0]);
|
const sourceLang = useLocalStorage<Language>('source-lang-v2', LANGUAGES[0]);
|
||||||
const targetLang = useLocalStorage<Language>('target-lang-v2', LANGUAGES[4]);
|
const targetLang = useLocalStorage<Language>('target-lang-v2', LANGUAGES[4]);
|
||||||
|
|
||||||
const speakerIdentity = useLocalStorage('speaker-identity', SPEAKER_IDENTITY_OPTIONS[0].value);
|
// 按源语言分别存储身份和语气,实现基于语言自动切换
|
||||||
const toneRegister = useLocalStorage('tone-register', TONE_REGISTER_OPTIONS[2].value);
|
const speakerIdentityMap = useLocalStorage<Record<string, string>>('speaker-identity-map', {});
|
||||||
|
const toneRegisterMap = useLocalStorage<Record<string, string>>('tone-register-map', {});
|
||||||
|
|
||||||
|
const speakerIdentity = computed({
|
||||||
|
get: () => speakerIdentityMap.value[sourceLang.value.code] || SPEAKER_IDENTITY_OPTIONS[0].value,
|
||||||
|
set: (val) => { speakerIdentityMap.value[sourceLang.value.code] = val; }
|
||||||
|
});
|
||||||
|
|
||||||
|
const toneRegister = computed({
|
||||||
|
get: () => toneRegisterMap.value[sourceLang.value.code] || TONE_REGISTER_OPTIONS[2].value,
|
||||||
|
set: (val) => { toneRegisterMap.value[sourceLang.value.code] = val; }
|
||||||
|
});
|
||||||
|
|
||||||
const logs = ref<{ timestamp: string; type: 'request' | 'response' | 'error'; content: any }[]>([]);
|
const logs = ref<{ timestamp: string; type: 'request' | 'response' | 'error'; content: any }[]>([]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user