add log
This commit is contained in:
parent
7b7a180323
commit
df348e96a5
|
|
@ -77,3 +77,4 @@ streamlit-chatbox==1.1.11
|
||||||
streamlit-modal>=0.1.0
|
streamlit-modal>=0.1.0
|
||||||
streamlit-aggrid>=0.3.4.post3
|
streamlit-aggrid>=0.3.4.post3
|
||||||
watchdog>=3.0.0
|
watchdog>=3.0.0
|
||||||
|
docx2txt
|
||||||
|
|
|
||||||
|
|
@ -67,3 +67,4 @@ arxiv>=2.0.0
|
||||||
youtube-search>=2.1.2
|
youtube-search>=2.1.2
|
||||||
duckduckgo-search>=3.9.9
|
duckduckgo-search>=3.9.9
|
||||||
metaphor-python>=0.1.23
|
metaphor-python>=0.1.23
|
||||||
|
docx2txt
|
||||||
|
|
@ -7,3 +7,4 @@ streamlit-modal>=0.1.0
|
||||||
streamlit-aggrid>=0.3.4.post3
|
streamlit-aggrid>=0.3.4.post3
|
||||||
httpx[brotli,http2,socks]>=0.25.2
|
httpx[brotli,http2,socks]>=0.25.2
|
||||||
watchdog>=3.0.0
|
watchdog>=3.0.0
|
||||||
|
docx2txt
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,9 @@ def search_docs(
|
||||||
data = []
|
data = []
|
||||||
if kb is not None:
|
if kb is not None:
|
||||||
if query:
|
if query:
|
||||||
|
print(f"search_docs, query:{query}")
|
||||||
docs = kb.search_docs(query, top_k, score_threshold)
|
docs = kb.search_docs(query, top_k, score_threshold)
|
||||||
|
print(f"search_docs, docs:{docs}")
|
||||||
data = [DocumentWithVSId(**x[0].dict(), score=x[1], id=x[0].metadata.get("id")) for x in docs]
|
data = [DocumentWithVSId(**x[0].dict(), score=x[1], id=x[0].metadata.get("id")) for x in docs]
|
||||||
elif file_name or metadata:
|
elif file_name or metadata:
|
||||||
data = kb.list_docs(file_name=file_name, metadata=metadata)
|
data = kb.list_docs(file_name=file_name, metadata=metadata)
|
||||||
|
|
@ -155,6 +157,8 @@ def upload_docs(
|
||||||
failed_files = {}
|
failed_files = {}
|
||||||
file_names = list(docs.keys())
|
file_names = list(docs.keys())
|
||||||
|
|
||||||
|
print(f"upload_docs, file_names:{file_names}")
|
||||||
|
|
||||||
# 先将上传的文件保存到磁盘
|
# 先将上传的文件保存到磁盘
|
||||||
for result in _save_files_in_thread(files, knowledge_base_name=knowledge_base_name, override=override):
|
for result in _save_files_in_thread(files, knowledge_base_name=knowledge_base_name, override=override):
|
||||||
filename = result["data"]["file_name"]
|
filename = result["data"]["file_name"]
|
||||||
|
|
@ -164,7 +168,9 @@ def upload_docs(
|
||||||
if filename not in file_names:
|
if filename not in file_names:
|
||||||
file_names.append(filename)
|
file_names.append(filename)
|
||||||
|
|
||||||
|
|
||||||
# 对保存的文件进行向量化
|
# 对保存的文件进行向量化
|
||||||
|
print(f"upload_docs, to_vector_store:{to_vector_store}")
|
||||||
if to_vector_store:
|
if to_vector_store:
|
||||||
result = update_docs(
|
result = update_docs(
|
||||||
knowledge_base_name=knowledge_base_name,
|
knowledge_base_name=knowledge_base_name,
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@ class ESKBService(KBService):
|
||||||
|
|
||||||
def do_search(self, query:str, top_k: int, score_threshold: float):
|
def do_search(self, query:str, top_k: int, score_threshold: float):
|
||||||
# 文本相似性检索
|
# 文本相似性检索
|
||||||
|
print(f"do_search,top_k:{top_k},score_threshold:{score_threshold}")
|
||||||
docs = self.db_init.similarity_search_with_score(query=query,
|
docs = self.db_init.similarity_search_with_score(query=query,
|
||||||
k=top_k)
|
k=top_k)
|
||||||
return docs
|
return docs
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ class FaissKBService(KBService):
|
||||||
top_k: int,
|
top_k: int,
|
||||||
score_threshold: float = SCORE_THRESHOLD,
|
score_threshold: float = SCORE_THRESHOLD,
|
||||||
) -> List[Document]:
|
) -> List[Document]:
|
||||||
|
print(f"do_search,top_k:{top_k},score_threshold:{score_threshold}")
|
||||||
embed_func = EmbeddingsFunAdapter(self.embed_model)
|
embed_func = EmbeddingsFunAdapter(self.embed_model)
|
||||||
embeddings = embed_func.embed_query(query)
|
embeddings = embed_func.embed_query(query)
|
||||||
with self.load_vector_store().acquire() as vs:
|
with self.load_vector_store().acquire() as vs:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue