diff --git a/src/renderer/src/config/prompts.ts b/src/renderer/src/config/prompts.ts index 281ef01f..05856be2 100644 --- a/src/renderer/src/config/prompts.ts +++ b/src/renderer/src/config/prompts.ts @@ -48,4 +48,4 @@ export const SUMMARIZE_PROMPT = '你是一名擅长会话的助理,你需要将用户的会话总结为 10 个字以内的标题,不要使用标点符号和其他特殊符号。' export const TRANSLATE_PROMPT = - 'Translate from input language to {{target_language}}, provide the translation result directly without any explanation, keep original format. If the target language is the same as the source language, do not translate. The text to be translated is as follows:\n\n{{text}}' + 'You are a translation expert. Translate from input language to {{target_language}}, provide the translation result directly without any explanation and keep original format. Do not translate if the target language is the same as the source language.' diff --git a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx index 44db8982..1cdc3929 100644 --- a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx +++ b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx @@ -130,7 +130,8 @@ const Inputbar: FC = ({ assistant, setActiveTopic }) => { try { setIsTranslating(true) - setText(await translateText(text, 'english')) + const translatedText = await translateText(text, 'english') + translatedText && setText(translatedText) setTimeout(() => resizeTextArea(), 0) } catch (error) { console.error('Translation failed:', error) diff --git a/src/renderer/src/pages/settings/ModalSettings/ModelSettings.tsx b/src/renderer/src/pages/settings/ModalSettings/ModelSettings.tsx index 88268870..e197f9e3 100644 --- a/src/renderer/src/pages/settings/ModalSettings/ModelSettings.tsx +++ b/src/renderer/src/pages/settings/ModalSettings/ModelSettings.tsx @@ -90,6 +90,7 @@ const ModelSettings: FC = () => { style={{ width: 360 }} onChange={(value) => setDefaultModel(find(allModels, JSON.parse(value)) as Model)} options={selectOptions} + showSearch placeholder={t('settings.models.empty')} />