提交 f54effb3 作者: imClumsyPanda

update webui.py

上级 48ab7c4f
...@@ -33,7 +33,7 @@ flag_csv_logger = gr.CSVLogger() ...@@ -33,7 +33,7 @@ flag_csv_logger = gr.CSVLogger()
def get_answer(query, vs_path, history, mode, score_threshold=VECTOR_SEARCH_SCORE_THRESHOLD, def get_answer(query, vs_path, history, mode, score_threshold=VECTOR_SEARCH_SCORE_THRESHOLD,
vector_search_top_k=VECTOR_SEARCH_TOP_K, chunk_conent: bool = True, vector_search_top_k=VECTOR_SEARCH_TOP_K, chunk_conent: bool = True,
chunk_size=CHUNK_SIZE, streaming: bool = STREAMING): chunk_size=CHUNK_SIZE, streaming: bool = STREAMING):
if mode == "知识库问答" and os.path.exists(vs_path): if mode == "知识库问答" and vs_path is not None and os.path.exists(vs_path):
for resp, history in local_doc_qa.get_knowledge_based_answer( for resp, history in local_doc_qa.get_knowledge_based_answer(
query=query, vs_path=vs_path, chat_history=history, streaming=streaming): query=query, vs_path=vs_path, chat_history=history, streaming=streaming):
source = "\n\n" source = "\n\n"
...@@ -128,7 +128,7 @@ def get_vector_store(vs_id, files, sentence_size, history, one_conent, one_conte ...@@ -128,7 +128,7 @@ def get_vector_store(vs_id, files, sentence_size, history, one_conent, one_conte
vs_path, loaded_files = local_doc_qa.one_knowledge_add(vs_path, files, one_conent, one_content_segmentation, vs_path, loaded_files = local_doc_qa.one_knowledge_add(vs_path, files, one_conent, one_content_segmentation,
sentence_size) sentence_size)
if len(loaded_files): if len(loaded_files):
file_status = f"已添加 {'、'.join([os.path.split(i)[-1] for i in loaded_files])} 内容至知识库,并已加载知识库,请开始提问" file_status = f"已添加 {'、'.join([os.path.split(i)[-1] for i in loaded_files if i])} 内容至知识库,并已加载知识库,请开始提问"
else: else:
file_status = "文件未成功加载,请重新上传文件" file_status = "文件未成功加载,请重新上传文件"
else: else:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论