fix part of #1206: add/delete/update_doc() get unexpected keyword argument 'not_refresh_vs_cache`

This commit is contained in:
liunux4odoo 2023-08-23 15:26:52 +08:00
parent 44edce6bcf
commit 351b62f7a7
2 changed files with 6 additions and 6 deletions

View File

@ -50,7 +50,7 @@ class MilvusKBService(KBService):
self._load_milvus(embeddings=embeddings) self._load_milvus(embeddings=embeddings)
return self.milvus.similarity_search_with_score(query, top_k) return self.milvus.similarity_search_with_score(query, top_k)
def add_doc(self, kb_file: KnowledgeFile): def add_doc(self, kb_file: KnowledgeFile, **kwargs):
""" """
向知识库添加文件 向知识库添加文件
""" """
@ -60,10 +60,10 @@ class MilvusKBService(KBService):
status = add_doc_to_db(kb_file) status = add_doc_to_db(kb_file)
return status return status
def do_add_doc(self, docs: List[Document], embeddings: Embeddings): def do_add_doc(self, docs: List[Document], embeddings: Embeddings, **kwargs):
pass pass
def do_delete_doc(self, kb_file: KnowledgeFile): def do_delete_doc(self, kb_file: KnowledgeFile, **kwargs):
filepath = kb_file.filepath.replace('\\', '\\\\') filepath = kb_file.filepath.replace('\\', '\\\\')
delete_list = [item.get("pk") for item in delete_list = [item.get("pk") for item in
self.milvus.col.query(expr=f'source == "{filepath}"', output_fields=["pk"])] self.milvus.col.query(expr=f'source == "{filepath}"', output_fields=["pk"])]

View File

@ -48,7 +48,7 @@ class PGKBService(KBService):
self._load_pg_vector(embeddings=embeddings) self._load_pg_vector(embeddings=embeddings)
return self.pg_vector.similarity_search_with_score(query, top_k) return self.pg_vector.similarity_search_with_score(query, top_k)
def add_doc(self, kb_file: KnowledgeFile): def add_doc(self, kb_file: KnowledgeFile, **kwargs):
""" """
向知识库添加文件 向知识库添加文件
""" """
@ -58,10 +58,10 @@ class PGKBService(KBService):
status = add_doc_to_db(kb_file) status = add_doc_to_db(kb_file)
return status return status
def do_add_doc(self, docs: List[Document], embeddings: Embeddings): def do_add_doc(self, docs: List[Document], embeddings: Embeddings, **kwargs):
pass pass
def do_delete_doc(self, kb_file: KnowledgeFile): def do_delete_doc(self, kb_file: KnowledgeFile, **kwargs):
with self.pg_vector.connect() as connect: with self.pg_vector.connect() as connect:
filepath = kb_file.filepath.replace('\\', '\\\\') filepath = kb_file.filepath.replace('\\', '\\\\')
connect.execute( connect.execute(