소스 검색

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 = [];
 
 	$: 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
 			.reduce((a, e, i, arr) => {
 				return [...new Set([...a, ...(e?.content?.tags ?? []).map((tag) => tag.name)])];