From e0dd17bfff431e59d9dab9d7c5a29b46ad6376fb Mon Sep 17 00:00:00 2001 From: Julian Freeman Date: Wed, 25 Mar 2026 12:45:54 -0400 Subject: [PATCH] support auto-detect tone --- src/stores/settings.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/stores/settings.ts b/src/stores/settings.ts index 5d09a22..7ac814a 100644 --- a/src/stores/settings.ts +++ b/src/stores/settings.ts @@ -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; } });