mirror of
https://github.com/open-webui/open-webui
synced 2025-06-09 07:56:42 +00:00
fix: rag duplicate collection issue
This commit is contained in:
parent
aed8e2156f
commit
ee6b1376c3
@ -1099,6 +1099,10 @@ def store_docs_in_vector_db(
|
|||||||
log.info(f"deleting existing collection {collection_name}")
|
log.info(f"deleting existing collection {collection_name}")
|
||||||
VECTOR_DB_CLIENT.delete_collection(collection_name=collection_name)
|
VECTOR_DB_CLIENT.delete_collection(collection_name=collection_name)
|
||||||
|
|
||||||
|
if VECTOR_DB_CLIENT.has_collection(collection_name=collection_name):
|
||||||
|
log.info(f"collection {collection_name} already exists")
|
||||||
|
return True
|
||||||
|
else:
|
||||||
embedding_function = get_embedding_function(
|
embedding_function = get_embedding_function(
|
||||||
app.state.config.RAG_EMBEDDING_ENGINE,
|
app.state.config.RAG_EMBEDDING_ENGINE,
|
||||||
app.state.config.RAG_EMBEDDING_MODEL,
|
app.state.config.RAG_EMBEDDING_MODEL,
|
||||||
@ -1123,11 +1127,7 @@ def store_docs_in_vector_db(
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if e.__class__.__name__ == "UniqueConstraintError":
|
|
||||||
return True
|
|
||||||
|
|
||||||
log.exception(e)
|
log.exception(e)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user