Timothy J. Baek 7 月之前
父节点
当前提交
6747478f67

+ 1 - 1
backend/open_webui/apps/retrieval/main.py

@@ -649,7 +649,7 @@ def save_docs_to_vector_db(
         )
         if existing_docs:
             log.info(f"Document with hash {metadata['hash']} already exists")
-            return True
+            raise ValueError(ERROR_MESSAGES.DUPLICATE_CONTENT)
 
     if split:
         text_splitter = RecursiveCharacterTextSplitter(

+ 2 - 0
backend/open_webui/constants.py

@@ -94,6 +94,8 @@ class ERROR_MESSAGES(str, Enum):
         lambda size="": f"Oops! The file you're trying to upload is too large. Please upload a file that is less than {size}."
     )
 
+    DUPLICATE_CONTENT = "The content provided is a duplicate. Please ensure that the content is unique before proceeding."
+
 
 class TASKS(str, Enum):
     def __str__(self) -> str:

+ 20 - 0
src/lib/components/workspace/Knowledge/Collection/Files.svelte

@@ -0,0 +1,20 @@
+<script lang="ts">
+	import FileItem from '$lib/components/common/FileItem.svelte';
+
+	export let files = [];
+</script>
+
+<div class=" max-h-full flex flex-col w-full">
+	{#each files as file (file.id)}
+		<div class="mt-2 px-2">
+			<FileItem
+				className="w-full"
+				colorClassName="bg-transparent hover:bg-gray-50 dark:hover:bg-gray-850 transition"
+				{file}
+				name={file.meta.name}
+				type="file"
+				dismissible
+			/>
+		</div>
+	{/each}
+</div>

+ 0 - 7
src/lib/components/workspace/Knowledge/Files.svelte

@@ -1,7 +0,0 @@
-<script lang="ts">
-	export let files = [];
-</script>
-
-<div>
-	{JSON.stringify(files)}
-</div>