瀏覽代碼

fix: disable all documents by default

Timothy J. Baek 1 年之前
父節點
當前提交
f814b08bcc
共有 1 個文件被更改,包括 10 次插入6 次删除
  1. 10 6
      src/lib/components/chat/MessageInput/Documents.svelte

+ 10 - 6
src/lib/components/chat/MessageInput/Documents.svelte

@@ -17,12 +17,16 @@
 	let collections = [];
 	let collections = [];
 
 
 	$: collections = [
 	$: collections = [
-		{
-			name: 'All Documents',
-			type: 'collection',
-			title: 'All Documents',
-			collection_names: $documents.map((doc) => doc.collection_name)
-		},
+		...($documents.length > 0
+			? [
+					{
+						name: 'All Documents',
+						type: 'collection',
+						title: 'All Documents',
+						collection_names: $documents.map((doc) => doc.collection_name)
+					}
+			  ]
+			: []),
 		...$documents
 		...$documents
 			.reduce((a, e, i, arr) => {
 			.reduce((a, e, i, arr) => {
 				return [...new Set([...a, ...(e?.content?.tags ?? []).map((tag) => tag.name)])];
 				return [...new Set([...a, ...(e?.content?.tags ?? []).map((tag) => tag.name)])];