update webui design

This commit is contained in:
imClumsyPanda 2023-08-13 22:25:01 +08:00
parent 77364c046e
commit b543f49278
4 changed files with 27 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -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,
)

View File

@ -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]:
@ -54,6 +61,7 @@ def dialogue_page(api: ApiRequest):
key="dialogue_mode",
)
history_len = st.number_input("历史对话轮数:", 0, 10, 3)
# todo: support history len
def on_kb_change():