提交 59375244 作者: imClumsyPanda

修复 webui.py 中 llm_history_len 和 vector_search_top_k 显示值与启动设置默认值不一致的问题

上级 e679136b
...@@ -11,14 +11,11 @@ import datetime ...@@ -11,14 +11,11 @@ import datetime
from typing import List from typing import List
# return top-k text chunk from vector store # return top-k text chunk from vector store
VECTOR_SEARCH_TOP_K = 10 VECTOR_SEARCH_TOP_K = 6
# LLM input history length # LLM input history length
LLM_HISTORY_LEN = 3 LLM_HISTORY_LEN = 3
# Show reply with source text from input document
REPLY_WITH_SOURCE = True
class LocalDocQA: class LocalDocQA:
llm: object = None llm: object = None
......
...@@ -4,6 +4,11 @@ import shutil ...@@ -4,6 +4,11 @@ import shutil
from chains.local_doc_qa import LocalDocQA from chains.local_doc_qa import LocalDocQA
from configs.model_config import * from configs.model_config import *
# return top-k text chunk from vector store
VECTOR_SEARCH_TOP_K = 6
# LLM input history length
LLM_HISTORY_LEN = 3
def get_file_list(): def get_file_list():
if not os.path.exists("content"): if not os.path.exists("content"):
...@@ -124,7 +129,7 @@ with gr.Blocks(css=block_css) as demo: ...@@ -124,7 +129,7 @@ with gr.Blocks(css=block_css) as demo:
interactive=True) interactive=True)
llm_history_len = gr.Slider(0, llm_history_len = gr.Slider(0,
10, 10,
value=3, value=LLM_HISTORY_LEN,
step=1, step=1,
label="LLM history len", label="LLM history len",
interactive=True) interactive=True)
...@@ -137,7 +142,7 @@ with gr.Blocks(css=block_css) as demo: ...@@ -137,7 +142,7 @@ with gr.Blocks(css=block_css) as demo:
interactive=True) interactive=True)
top_k = gr.Slider(1, top_k = gr.Slider(1,
20, 20,
value=6, value=VECTOR_SEARCH_TOP_K,
step=1, step=1,
label="向量匹配 top k", label="向量匹配 top k",
interactive=True) interactive=True)
...@@ -173,5 +178,9 @@ with gr.Blocks(css=block_css) as demo: ...@@ -173,5 +178,9 @@ with gr.Blocks(css=block_css) as demo:
[chatbot, query], [chatbot, query],
) )
demo.queue(concurrency_count=3).launch( demo.queue(concurrency_count=3
server_name='0.0.0.0', share=False, inbrowser=False) ).launch(server_name='0.0.0.0',
server_port=7860,
show_api=False,
share=False,
inbrowser=False)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论