mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-08 22:21:38 +00:00
fix: prevent save_docs_to_vector_db crash on empty result.ids (#20275)
Add check that result.ids exists and has length > 0 before accessing result.ids[0]. Prevents IndexError when query returns empty results.
This commit is contained in:
parent
6d087202ad
commit
46f867cda6
1 changed files with 1 additions and 1 deletions
|
|
@ -1308,7 +1308,7 @@ def save_docs_to_vector_db(
|
|||
filter={"hash": metadata["hash"]},
|
||||
)
|
||||
|
||||
if result is not None:
|
||||
if result is not None and result.ids and len(result.ids) > 0:
|
||||
existing_doc_ids = result.ids[0]
|
||||
if existing_doc_ids:
|
||||
log.info(f"Document with hash {metadata['hash']} already exists")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue