support auto-detect tone

This commit is contained in:
Julian Freeman
2026-03-25 12:45:54 -04:00
parent c5890bd5f2
commit e0dd17bfff

View File

@@ -33,6 +33,7 @@ export const SPEAKER_IDENTITY_OPTIONS = [
];
export const TONE_REGISTER_OPTIONS = [
{ label: '自动识别', value: 'Auto-detect', description: '分析并保持原文的语气、情绪和礼貌程度' },
{ label: '正式专业', value: 'Formal & Professional', description: '商务邮件、法律合同、官方报告' },
{ label: '礼貌客气', value: 'Polite & Respectful', description: '与长辈、客户或初次见面的人交流' },
{ label: '礼貌随和', value: 'Polite & Conversational', description: '得体但不刻板的日常对话' },
@@ -47,7 +48,7 @@ export const DEFAULT_TEMPLATE = `You are a professional {SOURCE_LANG} ({SOURCE_C
[Constraints]
1. Speaker Identity: {SPEAKER_IDENTITY}. Ensure all grammatical agreements and self-referential terms in {TARGET_LANG} reflect this.
2. Tone & Register: {TONE_REGISTER}.
2. Tone & Register: {TONE_REGISTER}. (If set to 'Auto-detect', analyze the tone, formality, and emotional nuance of the source text and faithfully replicate it. Do not neutralize strong emotions or unique styles.)
3. Produce ONLY the {TARGET_LANG} translation, without any additional explanations, notes, or commentary.
4. If [Context] is provided, use it strictly to disambiguate polysemous words. DO NOT add any factual information or descriptive details from the [Context] that are not present in the [Text to Translate].`;
@@ -141,7 +142,7 @@ export const useSettingsStore = defineStore('settings', () => {
});
const toneRegister = computed({
get: () => toneRegisterMap.value[sourceLang.value.code] || TONE_REGISTER_OPTIONS[2].value,
get: () => toneRegisterMap.value[sourceLang.value.code] || TONE_REGISTER_OPTIONS[0].value,
set: (val) => { toneRegisterMap.value[sourceLang.value.code] = val; }
});