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 webui_pages.utils import *
|
||||||
from streamlit_option_menu import option_menu
|
from streamlit_option_menu import option_menu
|
||||||
from webui_pages import *
|
from webui_pages import *
|
||||||
|
import os
|
||||||
|
|
||||||
api = ApiRequest(base_url="http://127.0.0.1:7861", no_remote_api=False)
|
api = ApiRequest(base_url="http://127.0.0.1:7861", no_remote_api=False)
|
||||||
|
|
||||||
|
|
@ -32,15 +33,23 @@ if __name__ == "__main__":
|
||||||
}
|
}
|
||||||
|
|
||||||
with st.sidebar:
|
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)
|
options = list(pages)
|
||||||
icons = [x["icon"] for x in pages.values()]
|
icons = [x["icon"] for x in pages.values()]
|
||||||
|
|
||||||
default_index = 0
|
default_index = 0
|
||||||
selected_page = option_menu(
|
selected_page = option_menu(
|
||||||
"langchain-chatglm",
|
"",
|
||||||
options=options,
|
options=options,
|
||||||
icons=icons,
|
icons=icons,
|
||||||
menu_icon="chat-quote",
|
# menu_icon="chat-quote",
|
||||||
default_index=default_index,
|
default_index=default_index,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,15 @@ from streamlit_chatbox import *
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from server.chat.search_engine_chat import SEARCH_ENGINES
|
from server.chat.search_engine_chat import SEARCH_ENGINES
|
||||||
from typing import List, Dict
|
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]:
|
def get_messages_history(history_len: int) -> List[Dict]:
|
||||||
|
|
@ -54,6 +61,7 @@ def dialogue_page(api: ApiRequest):
|
||||||
key="dialogue_mode",
|
key="dialogue_mode",
|
||||||
)
|
)
|
||||||
history_len = st.number_input("历史对话轮数:", 0, 10, 3)
|
history_len = st.number_input("历史对话轮数:", 0, 10, 3)
|
||||||
|
|
||||||
# todo: support history len
|
# todo: support history len
|
||||||
|
|
||||||
def on_kb_change():
|
def on_kb_change():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue