update@todo

This commit is contained in:
yanqiangmiffy 2023-04-20 02:54:56 +08:00
parent e81ef864e9
commit 7a63b2c114
2 changed files with 4 additions and 9 deletions

7
app.py
View File

@ -1,7 +1,6 @@
import os import os
import shutil import shutil
from app_modules.overwrites import postprocess
from app_modules.presets import * from app_modules.presets import *
from clc.langchain_application import LangChainApplication from clc.langchain_application import LangChainApplication
@ -50,6 +49,7 @@ def set_knowledge(kg_name, history):
application.source_service.load_vector_store(config.kg_vector_stores[kg_name]) application.source_service.load_vector_store(config.kg_vector_stores[kg_name])
msg_status = f'{kg_name}知识库已成功加载' msg_status = f'{kg_name}知识库已成功加载'
except Exception as e: except Exception as e:
print(e)
msg_status = f'{kg_name}知识库未成功加载' msg_status = f'{kg_name}知识库未成功加载'
return history + [[None, msg_status]] return history + [[None, msg_status]]
@ -145,10 +145,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
value='模型问答', value='模型问答',
interactive=True) interactive=True)
kg_name = gr.Radio(['中文维基百科', kg_name = gr.Radio(list(config.kg_vector_stores.keys()),
'大规模金融研报知识图谱',
'初始化知识库'
],
label="知识库", label="知识库",
value=None, value=None,
info="使用知识库问答,请加载知识库", info="使用知识库问答,请加载知识库",

View File

@ -50,6 +50,7 @@ def set_knowledge(kg_name, history):
application.source_service.load_vector_store(config.kg_vector_stores[kg_name]) application.source_service.load_vector_store(config.kg_vector_stores[kg_name])
msg_status = f'{kg_name}知识库已成功加载' msg_status = f'{kg_name}知识库已成功加载'
except Exception as e: except Exception as e:
print(e)
msg_status = f'{kg_name}知识库未成功加载' msg_status = f'{kg_name}知识库未成功加载'
return history + [[None, msg_status]] return history + [[None, msg_status]]
@ -145,10 +146,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
value='模型问答', value='模型问答',
interactive=True) interactive=True)
kg_name = gr.Radio(['中文维基百科', kg_name = gr.Radio(list(config.kg_vector_stores.keys()),
'大规模金融研报知识图谱',
'初始化知识库'
],
label="知识库", label="知识库",
value=None, value=None,
info="使用知识库问答,请加载知识库", info="使用知识库问答,请加载知识库",