feature@add searcht vs search+llm
This commit is contained in:
parent
46670ec7de
commit
6af4300637
|
@ -15,8 +15,8 @@
|
||||||
## 🔨 TODO
|
## 🔨 TODO
|
||||||
* [x] 支持上下文
|
* [x] 支持上下文
|
||||||
* [x] 支持知识增量更新
|
* [x] 支持知识增量更新
|
||||||
* [ ] 支持检索结果与LLM生成结果对比
|
* [x] 支持检索结果与LLM生成结果对比
|
||||||
|
* [ ] 支持检索生成结果与原始LLM生成结果对比
|
||||||
## ❤️引用
|
## ❤️引用
|
||||||
|
|
||||||
- webui参考:https://github.com/thomas-yanxin/LangChain-ChatGLM-Webui
|
- webui参考:https://github.com/thomas-yanxin/LangChain-ChatGLM-Webui
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
马保国(1952年- ) [1] ,英国混元太极拳协会创始人,自称“浑元形意太极拳掌门人”。 [2-4]
|
马保国(1952年- ) ,英国混元太极拳协会创始人,自称“浑元形意太极拳掌门人”。
|
||||||
2020年11月15日,马保国首度回应“屡遭恶搞剪辑”:“远离武林,已回归平静生活” [5] ;11月16日,马保国宣布将参演电影《少年功夫王》。 [6] 11月28日,人民日报客户端刊发评论《马保国闹剧,该立刻收场了》。 [7] 11月29日,新浪微博社区管理官方发布公告称,已解散马保国相关的粉丝群。 [8]
|
2020年11月15日,马保国首度回应“屡遭恶搞剪辑”:“远离武林,已回归平静生活” ;11月16日,马保国宣布将参演电影《少年功夫王》。 11月28日,人民日报客户端刊发评论《马保国闹剧,该立刻收场了》。 11月29日,新浪微博社区管理官方发布公告称,已解散马保国相关的粉丝群。
|
26
main.py
26
main.py
|
@ -70,7 +70,11 @@ def predict(input,
|
||||||
)
|
)
|
||||||
print(resp)
|
print(resp)
|
||||||
history.append((input, resp['result']))
|
history.append((input, resp['result']))
|
||||||
return '', history, history
|
|
||||||
|
search_text = ''
|
||||||
|
for idx, source in enumerate(resp['source_documents'][:2]):
|
||||||
|
search_text += f'【搜索结果{idx}:】{source.page_content}\n\n'
|
||||||
|
return '', history, history, search_text
|
||||||
|
|
||||||
|
|
||||||
block = gr.Blocks()
|
block = gr.Blocks()
|
||||||
|
@ -108,20 +112,23 @@ with block as demo:
|
||||||
inputs=file,
|
inputs=file,
|
||||||
outputs=selectFile)
|
outputs=selectFile)
|
||||||
with gr.Column(scale=4):
|
with gr.Column(scale=4):
|
||||||
chatbot = gr.Chatbot(label='Chinese-LangChain').style(height=400)
|
|
||||||
message = gr.Textbox(label='请输入问题')
|
|
||||||
state = gr.State()
|
state = gr.State()
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
clear_history = gr.Button("🧹 清除历史对话")
|
with gr.Column(scale=4):
|
||||||
send = gr.Button("🚀 发送")
|
chatbot = gr.Chatbot(label='Chinese-LangChain').style(height=400)
|
||||||
|
message = gr.Textbox(label='请输入问题')
|
||||||
|
with gr.Row():
|
||||||
|
clear_history = gr.Button("🧹 清除历史对话")
|
||||||
|
send = gr.Button("🚀 发送")
|
||||||
|
with gr.Column(scale=2):
|
||||||
|
search = gr.Textbox(label='搜索结果')
|
||||||
# 发送按钮 提交
|
# 发送按钮 提交
|
||||||
send.click(predict,
|
send.click(predict,
|
||||||
inputs=[
|
inputs=[
|
||||||
message, large_language_model,
|
message, large_language_model,
|
||||||
embedding_model, state
|
embedding_model, state
|
||||||
],
|
],
|
||||||
outputs=[message, chatbot, state])
|
outputs=[message, chatbot, state, search])
|
||||||
|
|
||||||
# 清空历史对话按钮 提交
|
# 清空历史对话按钮 提交
|
||||||
clear_history.click(fn=clear_session,
|
clear_history.click(fn=clear_session,
|
||||||
|
@ -135,7 +142,6 @@ with block as demo:
|
||||||
message, large_language_model,
|
message, large_language_model,
|
||||||
embedding_model, state
|
embedding_model, state
|
||||||
],
|
],
|
||||||
outputs=[message, chatbot, state])
|
outputs=[message, chatbot, state, search])
|
||||||
with gr.Column(scale=2):
|
|
||||||
message = gr.Textbox(label='搜索结果')
|
|
||||||
demo.queue().launch(server_name='0.0.0.0', server_port=8008, share=False)
|
demo.queue().launch(server_name='0.0.0.0', server_port=8008, share=False)
|
||||||
|
|
Loading…
Reference in New Issue