From 1c33c90884271c5812ee50ad467808c9fddd0e35 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Thu, 13 Feb 2025 16:41:48 +0800 Subject: [PATCH] feat: Add file type not supported error message in multiple languages --- src/renderer/src/i18n/locales/en-us.json | 1 + src/renderer/src/i18n/locales/ja-jp.json | 1 + src/renderer/src/i18n/locales/ru-ru.json | 1 + src/renderer/src/i18n/locales/zh-cn.json | 1 + src/renderer/src/i18n/locales/zh-tw.json | 1 + src/renderer/src/pages/home/Inputbar/Inputbar.tsx | 7 ++++++- 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index c9a2aafd..6380a0e0 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -97,6 +97,7 @@ "input.upload": "Upload image or document file", "input.upload.document": "Upload document file (model does not support images)", "input.web_search": "Enable web search", + "input.file_not_supported": "Model does not support this file type", "message.new.branch": "New Branch", "message.new.branch.created": "New Branch Created", "message.new.context": "New Context", diff --git a/src/renderer/src/i18n/locales/ja-jp.json b/src/renderer/src/i18n/locales/ja-jp.json index 3823d2b4..25648cd1 100644 --- a/src/renderer/src/i18n/locales/ja-jp.json +++ b/src/renderer/src/i18n/locales/ja-jp.json @@ -97,6 +97,7 @@ "input.upload": "画像またはドキュメントをアップロード", "input.upload.document": "ドキュメントをアップロード(モデルは画像をサポートしません)", "input.web_search": "ウェブ検索を有効にする", + "input.file_not_supported": "モデルはこのファイルタイプをサポートしません", "message.new.branch": "新しいブランチ", "message.new.branch.created": "新しいブランチが作成されました", "message.new.context": "新しいコンテキスト", diff --git a/src/renderer/src/i18n/locales/ru-ru.json b/src/renderer/src/i18n/locales/ru-ru.json index 4534cf5d..295206eb 100644 --- a/src/renderer/src/i18n/locales/ru-ru.json +++ b/src/renderer/src/i18n/locales/ru-ru.json @@ -97,6 +97,7 @@ "input.upload": "Загрузить изображение или документ", "input.upload.document": "Загрузить документ (модель не поддерживает изображения)", "input.web_search": "Включить веб-поиск", + "input.file_not_supported": "Модель не поддерживает этот тип файла", "message.new.branch": "Новая ветка", "message.new.branch.created": "Новая ветка создана", "message.new.context": "Новый контекст", diff --git a/src/renderer/src/i18n/locales/zh-cn.json b/src/renderer/src/i18n/locales/zh-cn.json index 54589db1..0415f874 100644 --- a/src/renderer/src/i18n/locales/zh-cn.json +++ b/src/renderer/src/i18n/locales/zh-cn.json @@ -97,6 +97,7 @@ "input.upload": "上传图片或文档", "input.upload.document": "上传文档(模型不支持图片)", "input.web_search": "开启网络搜索", + "input.file_not_supported": "模型不支持此文件类型", "message.new.branch": "分支", "message.new.branch.created": "新分支已创建", "message.new.context": "清除上下文", diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index 4e547c91..af19184d 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -97,6 +97,7 @@ "input.upload": "上傳圖片或文檔", "input.upload.document": "上傳文檔(模型不支持圖片)", "input.web_search": "開啟網路搜索", + "input.file_not_supported": "模型不支持此文件類型", "message.new.branch": "分支", "message.new.branch.created": "新分支已建立", "message.new.context": "新上下文", diff --git a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx index 283b698c..0ed347b5 100644 --- a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx +++ b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx @@ -349,6 +349,11 @@ const Inputbar: FC = ({ assistant: _assistant, setActiveTopic }) => { if (supportExts.includes(getFileExtension(file.path))) { const selectedFile = await window.api.file.get(file.path) selectedFile && setFiles((prevFiles) => [...prevFiles, selectedFile]) + } else { + window.message.info({ + key: 'file_not_supported', + content: t('chat.input.file_not_supported') + }) } } } @@ -370,7 +375,7 @@ const Inputbar: FC = ({ assistant: _assistant, setActiveTopic }) => { } } }, - [pasteLongTextAsFile, pasteLongTextThreshold, supportExts, text] + [pasteLongTextAsFile, pasteLongTextThreshold, supportExts, t, text] ) const handleDragOver = (e: React.DragEvent) => {