fix: incorrect variable usage in update_doc_by_ids method (#4048)

Co-authored-by: saf <saf@zjuici.com>
This commit is contained in:
af su 2024-05-20 14:44:02 +08:00 committed by GitHub
parent 8ca9e8ff28
commit b9827529aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -194,14 +194,14 @@ class KBService(ABC):
如果对应 doc_id 的值为 None或其 page_content 为空则删除该文档 如果对应 doc_id 的值为 None或其 page_content 为空则删除该文档
''' '''
self.del_doc_by_ids(list(docs.keys())) self.del_doc_by_ids(list(docs.keys()))
docs = [] pending_docs = []
ids = [] ids = []
for k, v in docs.items(): for _id, doc in docs.items():
if not v or not v.page_content.strip(): if not doc or not doc.page_content.strip():
continue continue
ids.append(k) ids.append(_id)
docs.append(v) pending_docs.append(doc)
self.do_add_doc(docs=docs, ids=ids) self.do_add_doc(docs=pending_docs, ids=ids)
return True return True
def list_docs(self, file_name: str = None, metadata: Dict = {}) -> List[DocumentWithVSId]: def list_docs(self, file_name: str = None, metadata: Dict = {}) -> List[DocumentWithVSId]: