update webui design
This commit is contained in:
parent
77364c046e
commit
b543f49278
Binary file not shown.
|
After Width: | Height: | Size: 7.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
13
webui.py
13
webui.py
|
|
@ -8,6 +8,7 @@ import streamlit as st
|
|||
from webui_pages.utils import *
|
||||
from streamlit_option_menu import option_menu
|
||||
from webui_pages import *
|
||||
import os
|
||||
|
||||
api = ApiRequest(base_url="http://127.0.0.1:7861", no_remote_api=False)
|
||||
|
||||
|
|
@ -32,15 +33,23 @@ if __name__ == "__main__":
|
|||
}
|
||||
|
||||
with st.sidebar:
|
||||
st.image(
|
||||
os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
"img",
|
||||
"logo-long-chatchat-trans-v2.png"
|
||||
),
|
||||
use_column_width=True
|
||||
)
|
||||
options = list(pages)
|
||||
icons = [x["icon"] for x in pages.values()]
|
||||
|
||||
default_index = 0
|
||||
selected_page = option_menu(
|
||||
"langchain-chatglm",
|
||||
"",
|
||||
options=options,
|
||||
icons=icons,
|
||||
menu_icon="chat-quote",
|
||||
# menu_icon="chat-quote",
|
||||
default_index=default_index,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,15 @@ from streamlit_chatbox import *
|
|||
from datetime import datetime
|
||||
from server.chat.search_engine_chat import SEARCH_ENGINES
|
||||
from typing import List, Dict
|
||||
import os
|
||||
|
||||
chat_box = ChatBox()
|
||||
chat_box = ChatBox(
|
||||
assistant_avatar=os.path.join(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
|
||||
"img",
|
||||
"chatchat_icon_blue_square_v2.png"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def get_messages_history(history_len: int) -> List[Dict]:
|
||||
|
|
@ -46,14 +53,15 @@ def dialogue_page(api: ApiRequest):
|
|||
# sac.alert(text, description="descp", type="success", closable=True, banner=True)
|
||||
|
||||
dialogue_mode = st.selectbox("请选择对话模式",
|
||||
["LLM 对话",
|
||||
"知识库问答",
|
||||
"搜索引擎问答",
|
||||
],
|
||||
on_change=on_mode_change,
|
||||
key="dialogue_mode",
|
||||
)
|
||||
["LLM 对话",
|
||||
"知识库问答",
|
||||
"搜索引擎问答",
|
||||
],
|
||||
on_change=on_mode_change,
|
||||
key="dialogue_mode",
|
||||
)
|
||||
history_len = st.number_input("历史对话轮数:", 0, 10, 3)
|
||||
|
||||
# todo: support history len
|
||||
|
||||
def on_kb_change():
|
||||
|
|
|
|||
Loading…
Reference in New Issue