-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb_ui.py
58 lines (54 loc) · 1.71 KB
/
web_ui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import streamlit as st
from streamlit_option_menu import option_menu
from web_pages.chat_page import chat_page
from web_pages.url_page import url_page
from web_pages.pdf_page import pdf_page
from web_pages.online_chat_page import online_chat_page
from web_pages.about_page import about_page
from web_pages.finews_page import finews_page
st.set_page_config(
page_title="AIBot",
page_icon="🤖",
layout="wide",
# initial_sidebar_state="expanded",
menu_items={
'Get Help': 'https://github.com/Boomm-shakalaka/AIBot-LLM',
'Report a bug': "https://github.com/Boomm-shakalaka/AIBot-LLM/issues",
'About': f"""欢迎使用!"""
}
)
pages = {
"聊天机器人": {
"icon": "chat", #基于streamlit-component-template-vue 构建,使用 Bootstrap 进行样式设置并使用 bootstrap-icons 中的图标。
"func": chat_page,
},
"在线聊天": {
"icon": "globe2",
"func": online_chat_page,
},
"URL检索":{
"icon": "bi-link-45deg",
"func": url_page,
},
"PDF解析": {
"icon": "bi-filetype-pdf",
"func": pdf_page,
},
"金融资讯Bot":{
"icon": "bi-newspaper",
"func": finews_page,
},
"关于About": {
"icon": "bi-file-person",
"func": about_page,
},
}
with st.sidebar:
st.image("ui_images/main.png", width=100)
selected_page = option_menu(menu_title='功能选择',
options= list(pages),
icons=[pages[x]["icon"] for x in pages],
default_index=0,
orientation="vertical")
if selected_page in pages.keys():
pages[selected_page]["func"]()