浏览代码

enh: sync confirm

Timothy J. Baek 7 月之前
父节点
当前提交
1f488a0072
共有 1 个文件被更改,包括 15 次插入3 次删除
  1. 15 3
      src/lib/components/workspace/Knowledge/Collection.svelte

+ 15 - 3
src/lib/components/workspace/Knowledge/Collection.svelte

@@ -31,8 +31,8 @@
 	import { processFile } from '$lib/apis/retrieval';
 	import AddContentMenu from './Collection/AddContentMenu.svelte';
 	import AddTextContentModal from './Collection/AddTextContentModal.svelte';
-	import Check from '$lib/components/icons/Check.svelte';
-	import FloppyDisk from '$lib/components/icons/FloppyDisk.svelte';
+
+	import SyncConfirmDialog from '../../common/ConfirmDialog.svelte';
 
 	let largeScreen = true;
 
@@ -51,6 +51,8 @@
 	let query = '';
 
 	let showAddTextContentModal = false;
+	let showSyncConfirmModal = false;
+
 	let inputFiles = null;
 
 	let filteredItems = [];
@@ -475,6 +477,16 @@
 	</div>
 {/if}
 
+<SyncConfirmDialog
+	bind:show={showSyncConfirmModal}
+	message={$i18n.t(
+		'This will reset the knowledge base and sync all files. Do you wish to continue?'
+	)}
+	on:confirm={() => {
+		syncDirectoryHandler();
+	}}
+/>
+
 <AddTextContentModal
 	bind:show={showAddTextContentModal}
 	on:submit={(e) => {
@@ -609,7 +621,7 @@
 												}
 											}}
 											on:sync={(e) => {
-												syncDirectoryHandler();
+												showSyncConfirmModal = true;
 											}}
 										/>
 									</div>