update knowledge_base and dialogue page of webui
This commit is contained in:
parent
eb49a91190
commit
a87a2815da
|
|
@ -361,11 +361,11 @@ CUDA_VISIBLE_DEVICES=0,1 python startup.py -a
|
|||
|
||||
- Web UI 对话界面:
|
||||
|
||||

|
||||

|
||||
|
||||
- Web UI 知识库管理页面:
|
||||
|
||||

|
||||

|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -300,10 +300,13 @@ The API, chat interface of WebUI, and knowledge management interface of WebUI ar
|
|||
|
||||
2. Chat Interface of WebUI
|
||||
|
||||

|
||||
- Dialogue interface of WebUI
|
||||
|
||||

|
||||
|
||||
- Knowledge management interface of WebUI
|
||||

|
||||
|
||||

|
||||
|
||||
### 6 Luanching API Service or WebUI step-by-step
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from .model_config import *
|
||||
from .server_config import *
|
||||
|
||||
VERSION = "v0.2.4-preview"
|
||||
VERSION = "v0.2.4"
|
||||
|
|
|
|||
|
|
@ -203,13 +203,13 @@ DEFAULT_VS_TYPE = "faiss"
|
|||
CACHED_VS_NUM = 1
|
||||
|
||||
# 知识库匹配向量数量
|
||||
VECTOR_SEARCH_TOP_K = 5
|
||||
VECTOR_SEARCH_TOP_K = 3
|
||||
|
||||
# 知识库匹配相关度阈值,取值范围在0-1之间,SCORE越小,相关度越高,取到1相当于不筛选,建议设置在0.5左右
|
||||
SCORE_THRESHOLD = 1
|
||||
|
||||
# 搜索引擎匹配结题数量
|
||||
SEARCH_ENGINE_TOP_K = 5
|
||||
SEARCH_ENGINE_TOP_K = 3
|
||||
|
||||
# nltk 模型存储路径
|
||||
NLTK_DATA_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "nltk_data")
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 326 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 153 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 249 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 137 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 237 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 170 KiB |
Binary file not shown.
Binary file not shown.
|
|
@ -60,6 +60,7 @@ def dialogue_page(api: ApiRequest):
|
|||
"知识库问答",
|
||||
"搜索引擎问答",
|
||||
],
|
||||
index=1,
|
||||
on_change=on_mode_change,
|
||||
key="dialogue_mode",
|
||||
)
|
||||
|
|
@ -95,7 +96,7 @@ def dialogue_page(api: ApiRequest):
|
|||
r = api.change_llm_model(st.session_state.get("prev_llm_model"), llm_model)
|
||||
st.session_state["cur_llm_model"] = llm_model
|
||||
|
||||
temperature = st.number_input("Temperature:", 0.0, 1.0, TEMPERATURE, 0.05)
|
||||
temperature = st.slider("Temperature:", 0.0, 1.0, TEMPERATURE, 0.05)
|
||||
history_len = st.number_input("历史对话轮数:", 0, 10, HISTORY_LEN)
|
||||
|
||||
def on_kb_change():
|
||||
|
|
@ -111,7 +112,7 @@ def dialogue_page(api: ApiRequest):
|
|||
key="selected_kb",
|
||||
)
|
||||
kb_top_k = st.number_input("匹配知识条数:", 1, 20, VECTOR_SEARCH_TOP_K)
|
||||
score_threshold = st.number_input("知识匹配分数阈值:", 0.0, 1.0, float(SCORE_THRESHOLD), 0.01)
|
||||
score_threshold = st.slider("知识匹配分数阈值:", 0.0, 1.0, float(SCORE_THRESHOLD), 0.01)
|
||||
# chunk_content = st.checkbox("关联上下文", False, disabled=True)
|
||||
# chunk_size = st.slider("关联长度:", 0, 500, 250, disabled=True)
|
||||
elif dialogue_mode == "搜索引擎问答":
|
||||
|
|
@ -158,7 +159,7 @@ def dialogue_page(api: ApiRequest):
|
|||
history=history,
|
||||
model=llm_model,
|
||||
temperature=temperature):
|
||||
if error_msg := check_error_msg(d): # check whether error occured
|
||||
if error_msg := check_error_msg(d): # check whether error occured
|
||||
st.error(error_msg)
|
||||
elif chunk := d.get("answer"):
|
||||
text += chunk
|
||||
|
|
@ -176,7 +177,7 @@ def dialogue_page(api: ApiRequest):
|
|||
top_k=se_top_k,
|
||||
model=llm_model,
|
||||
temperature=temperature):
|
||||
if error_msg := check_error_msg(d): # check whether error occured
|
||||
if error_msg := check_error_msg(d): # check whether error occured
|
||||
st.error(error_msg)
|
||||
elif chunk := d.get("answer"):
|
||||
text += chunk
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ def knowledge_base_page(api: ApiRequest):
|
|||
):
|
||||
cols = st.columns(3)
|
||||
chunk_size = cols[0].number_input("单段文本最大长度:", 1, 1000, CHUNK_SIZE)
|
||||
chunk_overlap = cols[1].number_input("相邻文本重合长度:", 0, 500, OVERLAP_SIZE)
|
||||
chunk_overlap = cols[1].number_input("相邻文本重合长度:", 0, chunk_size, OVERLAP_SIZE)
|
||||
cols[2].write("")
|
||||
cols[2].write("")
|
||||
zh_title_enhance = cols[2].checkbox("开启中文标题加强", ZH_TITLE_ENHANCE)
|
||||
|
|
|
|||
Loading…
Reference in New Issue