Update background.ts and settings.json

This commit is contained in:
n4ze3m 2024-03-31 16:36:27 +05:30
parent 9ced6469ce
commit e29cea82f5
6 changed files with 121 additions and 56 deletions

View File

@ -17,11 +17,6 @@
"light": "Light", "light": "Light",
"dark": "Dark" "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": { "webSearch": {
@ -37,6 +32,25 @@
"label": "Total Search Results", "label": "Total Search Results",
"placeholder": "Enter 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": { "manageModels": {

View File

@ -20,27 +20,41 @@
}, },
"searchMode": { "searchMode": {
"label": "簡易インターネット検索を実行" "label": "簡易インターネット検索を実行"
},
"deleteChatHistory": {
"label": "チャット履歴を削除",
"button": "削除",
"confirm": "チャット履歴を削除してもよろしいですか?この操作は元に戻せません。"
} }
}, },
"webSearch": { "webSearch": {
"heading": "ウェブ検索を管理する", "heading": "ウェブ検索を管理する",
"searchMode": { "searchMode": {
"label": "簡単なインターネット検索を実行する" "label": "簡単なインターネット検索を実行する"
}, },
"provider": { "provider": {
"label": "検索エンジン", "label": "検索エンジン",
"placeholder": "検索エンジンを選択する" "placeholder": "検索エンジンを選択する"
}, },
"totalSearchResults": { "totalSearchResults": {
"label": "合計検索結果", "label": "合計検索結果",
"placeholder": "合計検索結果を入力する" "placeholder": "合計検索結果を入力する"
} }
} },
"system": {
"heading": "システム設定",
"deleteChatHistory": {
"label": "チャット履歴を削除する",
"button": "削除",
"confirm": "チャット履歴を削除してもよろしいですか?この操作は元に戻せません。"
},
"export": {
"label": "チャット履歴、設定、プロンプトをエクスポートする",
"button": "データをエクスポート",
"success": "エクスポート成功"
},
"import": {
"label": "チャット履歴、設定、プロンプトをインポートする",
"button": "データをインポート",
"success": "インポート成功",
"error": "インポートエラー"
}
}
}, },
"manageModels": { "manageModels": {
"title": "モデルを管理", "title": "モデルを管理",

View File

@ -20,11 +20,6 @@
}, },
"searchMode": { "searchMode": {
"label": "സാധാരണ ഇന്റർനെറ്റ് അന്വേഷണം നടത്തുക" "label": "സാധാരണ ഇന്റർനെറ്റ് അന്വേഷണം നടത്തുക"
},
"deleteChatHistory": {
"label": "ചാറ്റ് ചരിത്രം ഇല്ലാതാക്കുക",
"button": "ഇല്ലാതാക്കുക",
"confirm": "നിങ്ങളുടെ ചാറ്റ് ചരിത്രം ഇല്ലാതാക്കണമെന്ന് തീർച്ചയാണോ? ഈ പ്രവർത്തനം പിന്നീട് പിൻവലിക്കാനാകില്ല."
} }
}, },
"webSearch": { "webSearch": {
@ -40,6 +35,25 @@
"label": "ആകെ തിരച്ചിൽ ഫലങ്ങൾ", "label": "ആകെ തിരച്ചിൽ ഫലങ്ങൾ",
"placeholder": "ആകെ തിരച്ചിൽ ഫലങ്ങളുടെ എണ്ണം നൽകുക" "placeholder": "ആകെ തിരച്ചിൽ ഫലങ്ങളുടെ എണ്ണം നൽകുക"
} }
},
"system": {
"heading": "സിസ്റ്റം ക്രമീകരണങ്ങൾ",
"deleteChatHistory": {
"label": "ചാറ്റ് ചരിത്രം ഇല്ലാതാക്കുക",
"button": "ഇല്ലാതാക്കുക",
"confirm": "നിങ്ങളുടെ ചാറ്റ് ചരിത്രം ഇല്ലാതാക്കണമെന്ന് ഉറപ്പാണോ? ഈ പ്രവർത്തനം പിന്നീട് പിന്വലിക്കാനാവില്ല."
},
"export": {
"label": "ചാറ്റ് ചരിത്രം, ക്രമീകരണങ്ങൾ, പ്രോംപ്റ്റുകൾ എക്സ്പോർട്ട് ചെയ്യുക",
"button": "ഡാറ്റ എക്സ്പോർട്ട് ചെയ്യുക",
"success": "എക്സ്പോർട്ട് വിജയകരമായി"
},
"import": {
"label": "ചാറ്റ് ചരിത്രം, ക്രമീകരണങ്ങൾ, പ്രോംപ്റ്റുകൾ ഇമ്പോർട്ട് ചെയ്യുക",
"button": "ഡാറ്റ ഇമ്പോർട്ട് ചെയ്യുക",
"success": "ഇമ്പോർട്ട് വിജയകരമായി",
"error": "ഇമ്പോർട്ട് പരാജയപ്പെട്ടു"
}
} }
}, },
"manageModels": { "manageModels": {

View File

@ -20,27 +20,41 @@
}, },
"searchMode": { "searchMode": {
"label": "使用简化的互联网搜索" "label": "使用简化的互联网搜索"
},
"deleteChatHistory": {
"label": "删除聊天历史记录",
"button": "删除",
"confirm": "您确定要删除聊天历史记录吗?这个操作不能撤销。"
} }
}, },
"webSearch": { "webSearch": {
"heading": "管理网络搜索", "heading": "管理网络搜索",
"searchMode": { "searchMode": {
"label": "执行简单的网际网路搜索" "label": "执行简单的网际网路搜索"
}, },
"provider": { "provider": {
"label": "搜索引擎", "label": "搜索引擎",
"placeholder": "选择一个搜索引擎" "placeholder": "选择一个搜索引擎"
}, },
"totalSearchResults": { "totalSearchResults": {
"label": "总搜索结果", "label": "总搜索结果",
"placeholder": "输入总搜索结果" "placeholder": "输入总搜索结果"
} }
} },
"system": {
"heading": "系统设置",
"deleteChatHistory": {
"label": "删除聊天记录",
"button": "删除",
"confirm": "您确定要删除聊天记录吗?此操作无法撤销。"
},
"export": {
"label": "导出聊天记录、设置和提示",
"button": "导出数据",
"success": "导出成功"
},
"import": {
"label": "导入聊天记录、设置和提示",
"button": "导入数据",
"success": "导入成功",
"error": "导入错误"
}
}
}, },
"manageModels": { "manageModels": {
"title": "管理模型", "title": "管理模型",

View File

@ -89,29 +89,37 @@ export const SettingOther = () => {
</button> </button>
</div> </div>
<SearchModeSettings /> <SearchModeSettings />
<div className="flex flex-row justify-between"> <div>
<span className="text-gray-500 dark:text-neutral-50 "> <div className="mb-5">
{t("generalSettings.settings.deleteChatHistory.label")} <h2 className="text-base font-semibold leading-7 text-gray-900 dark:text-white">
</span> {t("generalSettings.system.heading")}
</h2>
<div className="border border-b border-gray-200 dark:border-gray-600 mt-3"></div>
</div>
<div className="flex flex-row justify-between">
<span className="text-gray-500 dark:text-neutral-50 ">
{t("generalSettings.system.deleteChatHistory.label")}
</span>
<button <button
onClick={async () => { onClick={async () => {
const confirm = window.confirm( const confirm = window.confirm(
t("generalSettings.settings.deleteChatHistory.confirm") t("generalSettings.system.deleteChatHistory.confirm")
) )
if (confirm) { if (confirm) {
const db = new PageAssitDatabase() const db = new PageAssitDatabase()
await db.deleteChatHistory() await db.deleteChatHistory()
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: ["fetchChatHistory"] queryKey: ["fetchChatHistory"]
}) })
clearChat() clearChat()
} }
}} }}
className="bg-red-500 dark:bg-red-600 text-white dark:text-gray-200 px-4 py-2 rounded-md"> className="bg-red-500 dark:bg-red-600 text-white dark:text-gray-200 px-4 py-2 rounded-md">
{t("generalSettings.settings.deleteChatHistory.button")} {t("generalSettings.system.deleteChatHistory.button")}
</button> </button>
</div>
</div> </div>
</dl> </dl>
) )

View File

@ -81,7 +81,8 @@ export default defineBackground({
chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => { chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => {
const tab = tabs[0] const tab = tabs[0]
chrome.sidePanel.open({ chrome.sidePanel.open({
tabId: tab.id! // tabId: tab.id!,
windowId: tab.windowId!,
}) })
}) })
} else if (message.type === "pull_model") { } else if (message.type === "pull_model") {
@ -113,7 +114,7 @@ export default defineBackground({
chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => { chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => {
const tab = tabs[0] const tab = tabs[0]
chrome.sidePanel.open({ chrome.sidePanel.open({
tabId: tab.id! windowId: tab.windowId!
}) })
}) })
break break
@ -133,7 +134,7 @@ export default defineBackground({
chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => { chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => {
const tab = tabs[0] const tab = tabs[0]
await chrome.sidePanel.open({ await chrome.sidePanel.open({
tabId: tab.id! windowId: tab.windowId!,
}) })
}) })
} }