[全量] 初始化项目代码、配置、文档及Agent协同harness
This commit is contained in:
64
langchain-chat/webui.py
Normal file
64
langchain-chat/webui.py
Normal file
@@ -0,0 +1,64 @@
|
||||
import streamlit as st
|
||||
from webui_pages.utils import *
|
||||
from streamlit_option_menu import option_menu
|
||||
from webui_pages.dialogue.dialogue import dialogue_page, chat_box
|
||||
from webui_pages.knowledge_base.knowledge_base import knowledge_base_page
|
||||
import os
|
||||
import sys
|
||||
from configs import VERSION
|
||||
from server.utils import api_address
|
||||
|
||||
|
||||
api = ApiRequest(base_url=api_address())
|
||||
|
||||
if __name__ == "__main__":
|
||||
is_lite = "lite" in sys.argv
|
||||
|
||||
st.set_page_config(
|
||||
"知冶大模型",
|
||||
os.path.join("img", "chatchat_icon_blue_square_v2.png"),
|
||||
initial_sidebar_state="expanded",
|
||||
menu_items={
|
||||
'Get Help': 'https://github.com/chatchat-space/Langchain-Chatchat',
|
||||
'Report a bug': "https://github.com/chatchat-space/Langchain-Chatchat/issues",
|
||||
'About': f"""欢迎使用 知冶大模型 WebUI {VERSION}!"""
|
||||
}
|
||||
)
|
||||
|
||||
pages = {
|
||||
"对话": {
|
||||
"icon": "chat",
|
||||
"func": dialogue_page,
|
||||
},
|
||||
"知识库管理": {
|
||||
"icon": "hdd-stack",
|
||||
"func": knowledge_base_page,
|
||||
},
|
||||
}
|
||||
|
||||
with st.sidebar:
|
||||
st.image(
|
||||
os.path.join(
|
||||
"img",
|
||||
"logo-zhiling-llms.png"
|
||||
),
|
||||
use_column_width=True
|
||||
)
|
||||
st.caption(
|
||||
f"""<p align="right">当前版本:{VERSION}</p>""",
|
||||
unsafe_allow_html=True,
|
||||
)
|
||||
options = list(pages)
|
||||
icons = [x["icon"] for x in pages.values()]
|
||||
|
||||
default_index = 0
|
||||
selected_page = option_menu(
|
||||
"",
|
||||
options=options,
|
||||
icons=icons,
|
||||
# menu_icon="chat-quote",
|
||||
default_index=default_index,
|
||||
)
|
||||
|
||||
if selected_page in pages:
|
||||
pages[selected_page]["func"](api=api, is_lite=is_lite)
|
||||
Reference in New Issue
Block a user