mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
fix: file delete from knowledge not working with bypass embedding
This commit is contained in:
parent
a28436237c
commit
87a06a1976
1 changed files with 17 additions and 7 deletions
|
|
@ -437,14 +437,24 @@ def remove_file_from_knowledge_by_id(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Remove content from the vector database
|
# Remove content from the vector database
|
||||||
|
try:
|
||||||
VECTOR_DB_CLIENT.delete(
|
VECTOR_DB_CLIENT.delete(
|
||||||
collection_name=knowledge.id, filter={"file_id": form_data.file_id}
|
collection_name=knowledge.id, filter={"file_id": form_data.file_id}
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
log.debug("This was most likely caused by bypassing embedding processing")
|
||||||
|
log.debug(e)
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
# Remove the file's collection from vector database
|
# Remove the file's collection from vector database
|
||||||
file_collection = f"file-{form_data.file_id}"
|
file_collection = f"file-{form_data.file_id}"
|
||||||
if VECTOR_DB_CLIENT.has_collection(collection_name=file_collection):
|
if VECTOR_DB_CLIENT.has_collection(collection_name=file_collection):
|
||||||
VECTOR_DB_CLIENT.delete_collection(collection_name=file_collection)
|
VECTOR_DB_CLIENT.delete_collection(collection_name=file_collection)
|
||||||
|
except Exception as e:
|
||||||
|
log.debug("This was most likely caused by bypassing embedding processing")
|
||||||
|
log.debug(e)
|
||||||
|
pass
|
||||||
|
|
||||||
# Delete file from database
|
# Delete file from database
|
||||||
Files.delete_file_by_id(form_data.file_id)
|
Files.delete_file_by_id(form_data.file_id)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue