From b4f602e00dce00f044044b0565794e8d21073797 Mon Sep 17 00:00:00 2001 From: 1600822305 <1600822305@qq.com> Date: Fri, 11 Apr 2025 17:06:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=20TTS=20=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=9C=8D=E5=8A=A1=E5=B9=B6=E6=9B=B4=E6=96=B0=E4=BA=86?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/DraggableVoiceCallWindow.tsx | 2 +- src/renderer/src/i18n/locales/ja-jp.json | 16 +++++++++++++++- src/renderer/src/i18n/locales/ru-ru.json | 16 +++++++++++++++- src/renderer/src/i18n/locales/zh-tw.json | 16 +++++++++++++++- .../src/pages/home/Inputbar/Inputbar.tsx | 16 ++++++++++++---- 5 files changed, 58 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/components/DraggableVoiceCallWindow.tsx b/src/renderer/src/components/DraggableVoiceCallWindow.tsx index 8e030a1920..bc46743a53 100644 --- a/src/renderer/src/components/DraggableVoiceCallWindow.tsx +++ b/src/renderer/src/components/DraggableVoiceCallWindow.tsx @@ -59,7 +59,7 @@ const DraggableVoiceCallWindow: React.FC = ({ // 启动语音通话 await VoiceCallService.startCall({ onTranscript: (text) => setTranscript(text), - onResponse: (text) => { + onResponse: (_) => { // 这里不设置response,因为响应会显示在聊天界面中 }, onListeningStateChange: setIsListening, diff --git a/src/renderer/src/i18n/locales/ja-jp.json b/src/renderer/src/i18n/locales/ja-jp.json index 89d64d0cf3..ce73ef4698 100644 --- a/src/renderer/src/i18n/locales/ja-jp.json +++ b/src/renderer/src/i18n/locales/ja-jp.json @@ -1475,6 +1475,18 @@ "title": "[to be translated]:语音功能", "help": "[to be translated]:语音功能包括文本转语音(TTS)和语音识别(ASR)。", "learn_more": "[to be translated]:了解更多" + }, + "voice_call": { + "tab_title": "[to be translated]:通话功能", + "enable": "[to be translated]:启用语音通话", + "enable.help": "[to be translated]:启用后可以使用语音通话功能与AI进行对话", + "model": "[to be translated]:通话模型", + "model.select": "[to be translated]:选择模型", + "model.current": "[to be translated]:当前模型: {{model}}", + "model.info": "[to be translated]:选择用于语音通话的AI模型,不同模型可能有不同的语音交互体验", + "asr_tts_info": "[to be translated]:语音通话使用上面的语音识别(ASR)和语音合成(TTS)设置", + "test": "[to be translated]:测试通话", + "test_info": "[to be translated]:请使用输入框右侧的语音通话按钮进行测试" } }, "translate": { @@ -1529,7 +1541,9 @@ "press_to_talk": "[to be translated]:长按说话", "release_to_send": "[to be translated]:松开发送", "initialization_failed": "[to be translated]:初始化语音通话失败", - "error": "[to be translated]:语音通话出错" + "error": "[to be translated]:语音通话出错", + "initializing": "[to be translated]:正在初始化语音通话...", + "ready": "[to be translated]:语音通话已就绪" } } } \ No newline at end of file diff --git a/src/renderer/src/i18n/locales/ru-ru.json b/src/renderer/src/i18n/locales/ru-ru.json index 9ee281a6cb..88ceb0562f 100644 --- a/src/renderer/src/i18n/locales/ru-ru.json +++ b/src/renderer/src/i18n/locales/ru-ru.json @@ -1475,6 +1475,18 @@ "start_failed": "[to be translated]:开始录音失败", "transcribe_failed": "[to be translated]:语音识别失败" } + }, + "voice_call": { + "tab_title": "[to be translated]:通话功能", + "enable": "[to be translated]:启用语音通话", + "enable.help": "[to be translated]:启用后可以使用语音通话功能与AI进行对话", + "model": "[to be translated]:通话模型", + "model.select": "[to be translated]:选择模型", + "model.current": "[to be translated]:当前模型: {{model}}", + "model.info": "[to be translated]:选择用于语音通话的AI模型,不同模型可能有不同的语音交互体验", + "asr_tts_info": "[to be translated]:语音通话使用上面的语音识别(ASR)和语音合成(TTS)设置", + "test": "[to be translated]:测试通话", + "test_info": "[to be translated]:请使用输入框右侧的语音通话按钮进行测试" } }, "translate": { @@ -1529,7 +1541,9 @@ "press_to_talk": "[to be translated]:长按说话", "release_to_send": "[to be translated]:松开发送", "initialization_failed": "[to be translated]:初始化语音通话失败", - "error": "[to be translated]:语音通话出错" + "error": "[to be translated]:语音通话出错", + "initializing": "[to be translated]:正在初始化语音通话...", + "ready": "[to be translated]:语音通话已就绪" } } } \ No newline at end of file diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index c75a655fa4..0fc2d1597a 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -1475,6 +1475,18 @@ "start_failed": "[to be translated]:开始录音失败", "transcribe_failed": "[to be translated]:语音识别失败" } + }, + "voice_call": { + "tab_title": "[to be translated]:通话功能", + "enable": "[to be translated]:启用语音通话", + "enable.help": "[to be translated]:启用后可以使用语音通话功能与AI进行对话", + "model": "[to be translated]:通话模型", + "model.select": "[to be translated]:选择模型", + "model.current": "[to be translated]:当前模型: {{model}}", + "model.info": "[to be translated]:选择用于语音通话的AI模型,不同模型可能有不同的语音交互体验", + "asr_tts_info": "[to be translated]:语音通话使用上面的语音识别(ASR)和语音合成(TTS)设置", + "test": "[to be translated]:测试通话", + "test_info": "[to be translated]:请使用输入框右侧的语音通话按钮进行测试" } }, "translate": { @@ -1529,7 +1541,9 @@ "press_to_talk": "[to be translated]:长按说话", "release_to_send": "[to be translated]:松开发送", "initialization_failed": "[to be translated]:初始化语音通话失败", - "error": "[to be translated]:语音通话出错" + "error": "[to be translated]:语音通话出错", + "initializing": "[to be translated]:正在初始化语音通话...", + "ready": "[to be translated]:语音通话已就绪" } } } \ No newline at end of file diff --git a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx index 1971245e08..fc025e2b46 100644 --- a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx +++ b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx @@ -721,8 +721,12 @@ const Inputbar: FC = ({ assistant: _assistant, setActiveTopic, topic }) = setText(data.text); // 如果有指定模型,切换到该模型 - if (data.model && data.model !== model) { - setModel(data.model); + if (data.model) { + // 查找对应的模型对象 + const modelObj = assistant.model?.id === data.model ? assistant.model : undefined; + if (modelObj) { + setModel(modelObj); + } } // 使用延时确保文本已经设置到输入框 @@ -740,8 +744,12 @@ const Inputbar: FC = ({ assistant: _assistant, setActiveTopic, topic }) = }); // 如果有指定模型,设置模型 - if (data.model && data.model !== model) { - userMessage.model = { id: data.model }; + if (data.model) { + // 查找对应的模型对象 + const modelObj = assistant.model?.id === data.model ? assistant.model : undefined; + if (modelObj) { + userMessage.model = modelObj; + } } // 分发发送消息的action