feat: Update system reset functionality in settings

This commit is contained in:
n4ze3m 2024-12-13 18:32:50 +05:30
parent caf1dfcbe8
commit 44e2057ff4
17 changed files with 82 additions and 81 deletions

View File

@ -75,9 +75,9 @@
"system": { "system": {
"heading": "Systemindstillinger", "heading": "Systemindstillinger",
"deleteChatHistory": { "deleteChatHistory": {
"label": "Slet Chathistorik", "label": "System Nulstilling",
"button": "Slet", "button": "Nulstil Alt",
"confirm": "Er du sikker på, at du vil slette din chathistorik? Denne handling kan ikke fortrydes." "confirm": "Er du sikker på, at du vil udføre en systemnulstilling? Dette vil slette alle data og kan ikke fortrydes."
}, },
"export": { "export": {
"label": "Eksporter chathistorik, vidensbase og prompts", "label": "Eksporter chathistorik, vidensbase og prompts",

View File

@ -75,11 +75,10 @@
"system": { "system": {
"heading": "Systemeinstellungen", "heading": "Systemeinstellungen",
"deleteChatHistory": { "deleteChatHistory": {
"label": "Chatverlauf löschen", "label": "System zurücksetzen",
"button": "Löschen", "button": "Alles zurücksetzen",
"confirm": "Sind Sie sicher, dass Sie Ihren Chatverlauf löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden." "confirm": "Sind Sie sicher, dass Sie einen Systemreset durchführen möchten? Dies löscht alle Daten und kann nicht rückgängig gemacht werden."
}, }, "export": {
"export": {
"label": "Chatverlauf, Wissensbasis und Prompts exportieren", "label": "Chatverlauf, Wissensbasis und Prompts exportieren",
"button": "Daten exportieren", "button": "Daten exportieren",
"success": "Export erfolgreich" "success": "Export erfolgreich"

View File

@ -75,9 +75,9 @@
"system": { "system": {
"heading": "System Settings", "heading": "System Settings",
"deleteChatHistory": { "deleteChatHistory": {
"label": "Delete Chat History", "label": "System Reset",
"button": "Delete", "button": "Reset All",
"confirm": "Are you sure you want to delete your chat history? This action cannot be undone." "confirm": "Are you sure you want to perform a system reset? This will clear all data and cannot be undone."
}, },
"export": { "export": {
"label": "Export Chat History, Knowledge Base, and Prompts", "label": "Export Chat History, Knowledge Base, and Prompts",

View File

@ -75,9 +75,9 @@
"system": { "system": {
"heading": "Configuraciones del Sistema", "heading": "Configuraciones del Sistema",
"deleteChatHistory": { "deleteChatHistory": {
"label": "Borrar Histórico del Chat", "label": "Reinicio del Sistema",
"button": "Borrar", "button": "Reiniciar Todo",
"confirm": "¿Esta seguro que desea borrar su histórico del chat? Esta acción no podra ser desecha." "confirm": "¿Está seguro de que desea realizar un reinicio del sistema? Esto borrará todos los datos y no se puede deshacer."
}, },
"export": { "export": {
"label": "Exportar Histórico del Chat, Base de Conocimiento y Prompts", "label": "Exportar Histórico del Chat, Base de Conocimiento y Prompts",

View File

@ -72,9 +72,9 @@
"system": { "system": {
"heading": "تنظیمات سیستم", "heading": "تنظیمات سیستم",
"deleteChatHistory": { "deleteChatHistory": {
"label": "حذف تاریخچه گفتگو", "label": "بازنشانی سیستم",
"button": "حذف", "button": "بازنشانی همه",
"confirm": "آیا مطمئن هستید که می خواهید تاریخچه گفتگوهای خود را حذف کنید؟ این عمل قابل برگشت نیست." "confirm": "آیا مطمئن هستید که می‌خواهید بازنشانی سیستم را انجام دهید؟ این کار تمام داده‌ها را پاک می‌کند و غیرقابل برگشت است."
}, },
"export": { "export": {
"label": "تاریخچه گپ، پایگاه دانش و پرامپت‌ها را اکسپورت کنید", "label": "تاریخچه گپ، پایگاه دانش و پرامپت‌ها را اکسپورت کنید",

View File

@ -75,9 +75,9 @@
"system": { "system": {
"heading": "Les paramètres du système", "heading": "Les paramètres du système",
"deleteChatHistory": { "deleteChatHistory": {
"label": "Supprimer l'historique du chat", "label": "Réinitialisation du système",
"button": "Supprimer", "button": "Tout réinitialiser",
"confirm": "Êtes-vous sûr de vouloir supprimer l'historique de votre chat? Cette action ne peut pas être annulée." "confirm": "Êtes-vous sûr de vouloir effectuer une réinitialisation du système ? Cela effacera toutes les données et ne pourra pas être annulé."
}, },
"export": { "export": {
"label": "Exporter l'historique du chat, la base de connaissances et les invites", "label": "Exporter l'historique du chat, la base de connaissances et les invites",

View File

@ -75,9 +75,9 @@
"system": { "system": {
"heading": "Impostazioni di Sistema", "heading": "Impostazioni di Sistema",
"deleteChatHistory": { "deleteChatHistory": {
"label": "Elimina cronologia Chat", "label": "Reset del Sistema",
"button": "Elimina", "button": "Reset Totale",
"confirm": "Sei sicuro che vuoi eliminare la tua cronologia delle chat? Questa azione non può essere annullata." "confirm": "Sei sicuro di voler eseguire un reset del sistema? Questa operazione cancellerà tutti i dati e non può essere annullata."
}, },
"export": { "export": {
"label": "Esporta la cronologia Chat, Base di Conoscenza, e Prompts", "label": "Esporta la cronologia Chat, Base di Conoscenza, e Prompts",

View File

@ -78,9 +78,9 @@
"system": { "system": {
"heading": "システム設定", "heading": "システム設定",
"deleteChatHistory": { "deleteChatHistory": {
"label": "チャット履歴を削除する", "label": "システムリセット",
"button": "削除", "button": "すべてリセット",
"confirm": "チャット履歴を削除してもよろしいですか?この操作は元に戻せません。" "confirm": "システムリセットを実行してもよろしいですか?すべてのデータが消去され、元に戻すことはできません。"
}, },
"export": { "export": {
"label": "チャット履歴、知識ベース、プロンプトをエクスポート", "label": "チャット履歴、知識ベース、プロンプトをエクスポート",

View File

@ -78,9 +78,9 @@
"system": { "system": {
"heading": "시스템 설정", "heading": "시스템 설정",
"deleteChatHistory": { "deleteChatHistory": {
"label": "채팅 기록 삭제", "label": "시스템 초기화",
"button": "삭제", "button": "전체 초기화",
"confirm": "채팅 기록을 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다." "confirm": "시스템을 초기화하시겠습니까? 모든 데이터가 삭제되며 되돌릴 수 없습니다."
}, },
"export": { "export": {
"label": "채팅 기록, 지식 베이스, 프롬프트 내보내기", "label": "채팅 기록, 지식 베이스, 프롬프트 내보내기",

View File

@ -78,9 +78,9 @@
"system": { "system": {
"heading": "സിസ്റ്റം ക്രമീകരണങ്ങൾ", "heading": "സിസ്റ്റം ക്രമീകരണങ്ങൾ",
"deleteChatHistory": { "deleteChatHistory": {
"label": "ചാറ്റ് ചരിത്രം ഇല്ലാതാക്കുക", "label": "സിസ്റ്റം റീസെറ്റ്",
"button": "ഇല്ലാതാക്കുക", "button": "എല്ലാം റീസെറ്റ് ചെയ്യുക",
"confirm": "നിങ്ങളുടെ ചാറ്റ് ചരിത്രം ഇല്ലാതാക്കണമെന്ന് ഉറപ്പാണോ? ഈ പ്രവർത്തനം പിന്നീട് പിന്വലിക്കാനാവില്ല." "confirm": "നിങ്ങൾക്ക് സിസ്റ്റം റീസെറ്റ് നടത്താൻ തീർച്ചയാണോ? ഇത് എല്ലാ ഡാറ്റയും മായ്ക്കും, പിന്നീട് പുനഃസ്ഥാപിക്കാൻ കഴിയില്ല."
}, },
"export": { "export": {
"label": "ചാറ്റ് ചരിത്രം, അറിവ് അടിസ്ഥാനം, പ്രോംപ്റ്റുകൾ എക്സ്പോർട്ട് ചെയ്യുക", "label": "ചാറ്റ് ചരിത്രം, അറിവ് അടിസ്ഥാനം, പ്രോംപ്റ്റുകൾ എക്സ്പോർട്ട് ചെയ്യുക",

View File

@ -75,9 +75,9 @@
"system": { "system": {
"heading": "Systeminnstillinger", "heading": "Systeminnstillinger",
"deleteChatHistory": { "deleteChatHistory": {
"label": "Slett Chathistorikk", "label": "System Tilbakestilling",
"button": "Slett", "button": "Tilbakestill Alt",
"confirm": "Er du sikker på at du vil slette chathistorikken din? Denne handlingen kan ikke angres." "confirm": "Er du sikker på at du vil utføre en system tilbakestilling? Dette vil slette alle data og kan ikke angres."
}, },
"export": { "export": {
"label": "Eksporter chathistorikk, kunnskapsbase og prompts", "label": "Eksporter chathistorikk, kunnskapsbase og prompts",

View File

@ -75,9 +75,9 @@
"system": { "system": {
"heading": "Configurações do Sistema", "heading": "Configurações do Sistema",
"deleteChatHistory": { "deleteChatHistory": {
"label": "Excluir Histórico de Chat", "label": "Reiniciar Sistema",
"button": "Excluir", "button": "Reiniciar Tudo",
"confirm": "Tem certeza de que deseja excluir seu histórico de chat? Esta ação não pode ser desfeita." "confirm": "Tem certeza que deseja realizar um reinício do sistema? Isso irá apagar todos os dados e não poderá ser desfeito."
}, },
"export": { "export": {
"label": "Exportar Histórico de Chat, Base de Conhecimento e Prompts", "label": "Exportar Histórico de Chat, Base de Conhecimento e Prompts",

View File

@ -76,9 +76,9 @@
"system": { "system": {
"heading": "Настройки системы", "heading": "Настройки системы",
"deleteChatHistory": { "deleteChatHistory": {
"label": "Удалить историю чата", "label": "Сброс системы",
"button": "Удалить", "button": "Сбросить все",
"confirm": "Вы уверены, что хотите удалить историю чата? Это действие нельзя отменить." "confirm": "Вы уверены, что хотите выполнить сброс системы? Это удалит все данные без возможности восстановления."
}, },
"export": { "export": {
"label": "Экспорт истории чата, базы знаний и подсказок", "label": "Экспорт истории чата, базы знаний и подсказок",

View File

@ -75,9 +75,9 @@
"system": { "system": {
"heading": "Systeminställningar", "heading": "Systeminställningar",
"deleteChatHistory": { "deleteChatHistory": {
"label": "Radera Chatt Historik", "label": "Systemåterställning",
"button": "Radera", "button": "Återställ Allt",
"confirm": "Är du säker på att du vill radera din chatthistorik? Denna åtgärd kan inte ångras." "confirm": "Är du säker på att du vill utföra en systemåterställning? Detta kommer att radera all data och kan inte ångras."
}, },
"export": { "export": {
"label": "Exportera chatthistorik, kunskapsbas och instruktioner", "label": "Exportera chatthistorik, kunskapsbas och instruktioner",

View File

@ -75,9 +75,9 @@
"system": { "system": {
"heading": "Системні налаштування", "heading": "Системні налаштування",
"deleteChatHistory": { "deleteChatHistory": {
"label": "Видалити історію чату", "label": "Скидання системи",
"button": "Видалити", "button": "Скинути все",
"confirm": "Ви впевнені, що хочете видалити історію чату? Ця дія не може бути відвернута." "confirm": "Ви впевнені, що хочете виконати скидання системи? Це призведе до видалення всіх даних, і цю дію неможливо буде скасувати."
}, },
"export": { "export": {
"label": "Експорт історії чату, бази знань та запитів", "label": "Експорт історії чату, бази знань та запитів",

View File

@ -78,9 +78,9 @@
"system": { "system": {
"heading": "系统设置", "heading": "系统设置",
"deleteChatHistory": { "deleteChatHistory": {
"label": "删除聊天记录", "label": "系统重置",
"button": "删除", "button": "全部重置",
"confirm": "您确定要删除聊天记录吗?此操作无法撤销。" "confirm": "您确定要执行系统重置吗?这将清除所有数据且无法撤消。"
}, },
"export": { "export": {
"label": "导出聊天记录、知识库和提示", "label": "导出聊天记录、知识库和提示",

View File

@ -220,37 +220,7 @@ export const GeneralSettings = () => {
</h2> </h2>
<div className="border border-b border-gray-200 dark:border-gray-600 mt-3"></div> <div className="border border-b border-gray-200 dark:border-gray-600 mt-3"></div>
</div> </div>
<div className="flex flex-row mb-3 justify-between">
<span className="text-gray-700 dark:text-neutral-50 ">
{t("generalSettings.system.deleteChatHistory.label")}
</span>
<button
onClick={async () => {
const confirm = window.confirm(
t("generalSettings.system.deleteChatHistory.confirm")
)
if (confirm) {
const db = new PageAssitDatabase()
await db.deleteAllChatHistory()
queryClient.invalidateQueries({
queryKey: ["fetchChatHistory"]
})
clearChat()
}
try {
await browser.storage.sync.clear()
await browser.storage.local.clear()
await browser.storage.session.clear()
} catch (e) {
console.log("Error clearing storage:", e)
}
}}
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")}
</button>
</div>
<div className="flex flex-row mb-3 justify-between"> <div className="flex flex-row mb-3 justify-between">
<span className="text-gray-700 dark:text-neutral-50 "> <span className="text-gray-700 dark:text-neutral-50 ">
{t("generalSettings.system.export.label")} {t("generalSettings.system.export.label")}
@ -282,6 +252,38 @@ export const GeneralSettings = () => {
}} }}
/> />
</div> </div>
<div className="flex flex-row mb-3 justify-between">
<span className="text-gray-700 dark:text-neutral-50 ">
{t("generalSettings.system.deleteChatHistory.label")}
</span>
<button
onClick={async () => {
const confirm = window.confirm(
t("generalSettings.system.deleteChatHistory.confirm")
)
if (confirm) {
const db = new PageAssitDatabase()
await db.deleteAllChatHistory()
queryClient.invalidateQueries({
queryKey: ["fetchChatHistory"]
})
clearChat()
}
try {
await browser.storage.sync.clear()
await browser.storage.local.clear()
await browser.storage.session.clear()
} catch (e) {
console.log("Error clearing storage:", e)
}
}}
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")}
</button>
</div>
</div> </div>
</dl> </dl>
) )