一些bug

This commit is contained in:
glide-the 2024-05-07 19:32:54 +08:00
parent b659a1badc
commit 53380d76c2
2 changed files with 26 additions and 18 deletions

View File

@ -32,6 +32,7 @@ ollama:
model_type: 'llm'
model_credentials:
base_url: 'http://172.21.80.1:11434'
mode: 'completion'

View File

@ -11,13 +11,13 @@ import streamlit_antd_components as sac
from streamlit_chatbox import *
from streamlit_extras.bottom_container import bottom
from chatchat.configs import (LLM_MODEL_CONFIG, TEMPERATURE, MODEL_PLATFORMS, DEFAULT_LLM_MODEL, DEFAULT_EMBEDDING_MODEL)
from chatchat.configs import (LLM_MODEL_CONFIG, TEMPERATURE, MODEL_PLATFORMS, DEFAULT_LLM_MODEL,
DEFAULT_EMBEDDING_MODEL)
from chatchat.server.callback_handler.agent_callback_handler import AgentStatus
from chatchat.server.utils import MsgType, get_config_models
from chatchat.webui_pages.utils import *
from chatchat.webui_pages.dialogue.utils import process_files
chat_box = ChatBox(
assistant_avatar=get_img_url("chatchat_icon_blue_square_v2.png")
)
@ -158,10 +158,13 @@ def dialogue_page(
tool_names = ["None"] + list(tools)
if use_agent:
# selected_tools = sac.checkbox(list(tools), format_func=lambda x: tools[x]["title"], label="选择工具", check_all=True, key="selected_tools")
selected_tools = st.multiselect("选择工具", list(tools), format_func=lambda x: tools[x]["title"], key="selected_tools")
selected_tools = st.multiselect("选择工具", list(tools), format_func=lambda x: tools[x]["title"],
key="selected_tools")
else:
# selected_tool = sac.buttons(list(tools), format_func=lambda x: tools[x]["title"], label="选择工具", key="selected_tool")
selected_tool = st.selectbox("选择工具", tool_names, format_func=lambda x: tools.get(x,{"title": "None"})["title"], key="selected_tool")
selected_tool = st.selectbox("选择工具", tool_names,
format_func=lambda x: tools.get(x, {"title": "None"})["title"],
key="selected_tool")
selected_tools = [selected_tool]
selected_tool_configs = {name: tool["config"] for name, tool in tools.items() if name in selected_tools}
@ -337,7 +340,8 @@ def dialogue_page(
chat_box.update_msg(text.replace("\n", "\n\n"))
elif d.status == None: # not agent chat
if getattr(d, "is_ref", False):
chat_box.insert_msg(Markdown(d.choices[0].delta.content or "", in_expander=True, state="complete", title="参考资料"))
chat_box.insert_msg(Markdown(d.choices[0].delta.content or "", in_expander=True, state="complete",
title="参考资料"))
chat_box.insert_msg("")
else:
text += d.choices[0].delta.content or ""
@ -400,3 +404,6 @@ def dialogue_page(
)
# st.write(chat_box.history)
save_session()