diff --git a/src/assets/locale/en/settings.json b/src/assets/locale/en/settings.json index a959a56..7a6fe6f 100644 --- a/src/assets/locale/en/settings.json +++ b/src/assets/locale/en/settings.json @@ -17,11 +17,6 @@ "light": "Light", "dark": "Dark" } - }, - "deleteChatHistory": { - "label": "Delete Chat History", - "button": "Delete", - "confirm": "Are you sure you want to delete your chat history? This action cannot be undone." } }, "webSearch": { @@ -37,6 +32,25 @@ "label": "Total Search Results", "placeholder": "Enter Total Search Results" } + }, + "system": { + "heading": "System Settings", + "deleteChatHistory": { + "label": "Delete Chat History", + "button": "Delete", + "confirm": "Are you sure you want to delete your chat history? This action cannot be undone." + }, + "export": { + "label": "Export Chat History, Settings, and Prompts", + "button": "Export Data", + "success": "Export Success" + }, + "import": { + "label": "Import Chat History, Settings, and Prompts", + "button": "Import Data", + "success": "Import Success", + "error": "Import Error" + } } }, "manageModels": { diff --git a/src/assets/locale/ja-JP/settings.json b/src/assets/locale/ja-JP/settings.json index da82fe3..15a0ad4 100644 --- a/src/assets/locale/ja-JP/settings.json +++ b/src/assets/locale/ja-JP/settings.json @@ -20,27 +20,41 @@ }, "searchMode": { "label": "簡易インターネット検索を実行" - }, - "deleteChatHistory": { - "label": "チャット履歴を削除", - "button": "削除", - "confirm": "チャット履歴を削除してもよろしいですか?この操作は元に戻せません。" } }, "webSearch": { "heading": "ウェブ検索を管理する", "searchMode": { - "label": "簡単なインターネット検索を実行する" + "label": "簡単なインターネット検索を実行する" }, "provider": { - "label": "検索エンジン", - "placeholder": "検索エンジンを選択する" + "label": "検索エンジン", + "placeholder": "検索エンジンを選択する" }, "totalSearchResults": { - "label": "合計検索結果", - "placeholder": "合計検索結果を入力する" + "label": "合計検索結果", + "placeholder": "合計検索結果を入力する" } - } + }, + "system": { + "heading": "システム設定", + "deleteChatHistory": { + "label": "チャット履歴を削除する", + "button": "削除", + "confirm": "チャット履歴を削除してもよろしいですか?この操作は元に戻せません。" + }, + "export": { + "label": "チャット履歴、設定、プロンプトをエクスポートする", + "button": "データをエクスポート", + "success": "エクスポート成功" + }, + "import": { + "label": "チャット履歴、設定、プロンプトをインポートする", + "button": "データをインポート", + "success": "インポート成功", + "error": "インポートエラー" + } + } }, "manageModels": { "title": "モデルを管理", diff --git a/src/assets/locale/ml/settings.json b/src/assets/locale/ml/settings.json index a0d7122..940b0c2 100644 --- a/src/assets/locale/ml/settings.json +++ b/src/assets/locale/ml/settings.json @@ -20,11 +20,6 @@ }, "searchMode": { "label": "സാധാരണ ഇന്റർനെറ്റ് അന്വേഷണം നടത്തുക" - }, - "deleteChatHistory": { - "label": "ചാറ്റ് ചരിത്രം ഇല്ലാതാക്കുക", - "button": "ഇല്ലാതാക്കുക", - "confirm": "നിങ്ങളുടെ ചാറ്റ് ചരിത്രം ഇല്ലാതാക്കണമെന്ന് തീർച്ചയാണോ? ഈ പ്രവർത്തനം പിന്നീട് പിൻവലിക്കാനാകില്ല." } }, "webSearch": { @@ -40,6 +35,25 @@ "label": "ആകെ തിരച്ചിൽ ഫലങ്ങൾ", "placeholder": "ആകെ തിരച്ചിൽ ഫലങ്ങളുടെ എണ്ണം നൽകുക" } + }, + "system": { + "heading": "സിസ്റ്റം ക്രമീകരണങ്ങൾ", + "deleteChatHistory": { + "label": "ചാറ്റ് ചരിത്രം ഇല്ലാതാക്കുക", + "button": "ഇല്ലാതാക്കുക", + "confirm": "നിങ്ങളുടെ ചാറ്റ് ചരിത്രം ഇല്ലാതാക്കണമെന്ന് ഉറപ്പാണോ? ഈ പ്രവർത്തനം പിന്നീട് പിന്വലിക്കാനാവില്ല." + }, + "export": { + "label": "ചാറ്റ് ചരിത്രം, ക്രമീകരണങ്ങൾ, പ്രോംപ്റ്റുകൾ എക്സ്പോർട്ട് ചെയ്യുക", + "button": "ഡാറ്റ എക്സ്പോർട്ട് ചെയ്യുക", + "success": "എക്സ്പോർട്ട് വിജയകരമായി" + }, + "import": { + "label": "ചാറ്റ് ചരിത്രം, ക്രമീകരണങ്ങൾ, പ്രോംപ്റ്റുകൾ ഇമ്പോർട്ട് ചെയ്യുക", + "button": "ഡാറ്റ ഇമ്പോർട്ട് ചെയ്യുക", + "success": "ഇമ്പോർട്ട് വിജയകരമായി", + "error": "ഇമ്പോർട്ട് പരാജയപ്പെട്ടു" + } } }, "manageModels": { diff --git a/src/assets/locale/zh/settings.json b/src/assets/locale/zh/settings.json index edf3c83..ea7af68 100644 --- a/src/assets/locale/zh/settings.json +++ b/src/assets/locale/zh/settings.json @@ -20,27 +20,41 @@ }, "searchMode": { "label": "使用简化的互联网搜索" - }, - "deleteChatHistory": { - "label": "删除聊天历史记录", - "button": "删除", - "confirm": "您确定要删除聊天历史记录吗?这个操作不能撤销。" } }, "webSearch": { "heading": "管理网络搜索", "searchMode": { - "label": "执行简单的网际网路搜索" + "label": "执行简单的网际网路搜索" }, "provider": { - "label": "搜索引擎", - "placeholder": "选择一个搜索引擎" + "label": "搜索引擎", + "placeholder": "选择一个搜索引擎" }, "totalSearchResults": { - "label": "总搜索结果", - "placeholder": "输入总搜索结果" + "label": "总搜索结果", + "placeholder": "输入总搜索结果" } - } + }, + "system": { + "heading": "系统设置", + "deleteChatHistory": { + "label": "删除聊天记录", + "button": "删除", + "confirm": "您确定要删除聊天记录吗?此操作无法撤销。" + }, + "export": { + "label": "导出聊天记录、设置和提示", + "button": "导出数据", + "success": "导出成功" + }, + "import": { + "label": "导入聊天记录、设置和提示", + "button": "导入数据", + "success": "导入成功", + "error": "导入错误" + } + } }, "manageModels": { "title": "管理模型", diff --git a/src/components/Option/Settings/other.tsx b/src/components/Option/Settings/other.tsx index 3ca3154..a608f98 100644 --- a/src/components/Option/Settings/other.tsx +++ b/src/components/Option/Settings/other.tsx @@ -89,29 +89,37 @@ export const SettingOther = () => { -
- - {t("generalSettings.settings.deleteChatHistory.label")} - +
+
+

+ {t("generalSettings.system.heading")} +

+
+
+
+ + {t("generalSettings.system.deleteChatHistory.label")} + - + if (confirm) { + const db = new PageAssitDatabase() + await db.deleteChatHistory() + queryClient.invalidateQueries({ + queryKey: ["fetchChatHistory"] + }) + clearChat() + } + }} + className="bg-red-500 dark:bg-red-600 text-white dark:text-gray-200 px-4 py-2 rounded-md"> + {t("generalSettings.system.deleteChatHistory.button")} + +
) diff --git a/src/entries/background.ts b/src/entries/background.ts index af5c1e3..d4f075b 100644 --- a/src/entries/background.ts +++ b/src/entries/background.ts @@ -81,7 +81,8 @@ export default defineBackground({ chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => { const tab = tabs[0] chrome.sidePanel.open({ - tabId: tab.id! + // tabId: tab.id!, + windowId: tab.windowId!, }) }) } else if (message.type === "pull_model") { @@ -113,7 +114,7 @@ export default defineBackground({ chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => { const tab = tabs[0] chrome.sidePanel.open({ - tabId: tab.id! + windowId: tab.windowId! }) }) break @@ -133,7 +134,7 @@ export default defineBackground({ chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => { const tab = tabs[0] await chrome.sidePanel.open({ - tabId: tab.id! + windowId: tab.windowId!, }) }) }