From 91cec1150050811b718cc16020bf8d3a4e9b7fcc Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 15 Jun 2024 04:02:20 -0600 Subject: [PATCH] refac --- .../admin/Settings/Documents.svelte | 267 +++++------------- 1 file changed, 77 insertions(+), 190 deletions(-) diff --git a/src/lib/components/admin/Settings/Documents.svelte b/src/lib/components/admin/Settings/Documents.svelte index ab8996d92..af2dfcdc3 100644 --- a/src/lib/components/admin/Settings/Documents.svelte +++ b/src/lib/components/admin/Settings/Documents.svelte @@ -13,6 +13,8 @@ getRAGConfig, updateRAGConfig } from '$lib/apis/rag'; + import ResetUploadDirConfirmDialog from '$lib/components/common/ConfirmDialog.svelte'; + import ResetVectorDBConfirmDialog from '$lib/components/common/ConfirmDialog.svelte'; import { documents, models } from '$lib/stores'; import { onMount, getContext } from 'svelte'; @@ -213,6 +215,34 @@ }); + { + const res = resetUploadDir(localStorage.token).catch((error) => { + toast.error(error); + return null; + }); + + if (res) { + toast.success($i18n.t('Success')); + } + }} +/> + + { + const res = resetVectorDB(localStorage.token).catch((error) => { + toast.error(error); + return null; + }); + + if (res) { + toast.success($i18n.t('Success')); + } + }} +/> +
{ @@ -640,199 +670,56 @@
- {#if showResetUploadDirConfirm} -
-
- - - - - {$i18n.t('Are you sure?')} -
- -
- - -
+ - {/if} +
{$i18n.t('Reset Upload Directory')}
+ - {#if showResetConfirm} -
-
- - - - {$i18n.t('Are you sure?')} -
- -
- - -
+ - {/if} +
{$i18n.t('Reset Vector Storage')}
+