mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-28 01:33:17 +08:00
loom模型服务update_store更新逻辑
This commit is contained in:
parent
307b973f26
commit
802cfe8805
17
webui.py
17
webui.py
@ -1,5 +1,6 @@
|
||||
import streamlit as st
|
||||
|
||||
from webui_pages.loom_view_client import update_store
|
||||
from webui_pages.openai_plugins import openai_plugins_page
|
||||
from webui_pages.utils import *
|
||||
from streamlit_option_menu import option_menu
|
||||
@ -11,6 +12,11 @@ from configs import VERSION
|
||||
from server.utils import api_address
|
||||
|
||||
|
||||
def on_change(key):
|
||||
if key:
|
||||
update_store()
|
||||
|
||||
|
||||
api = ApiRequest(base_url=api_address())
|
||||
|
||||
if __name__ == "__main__":
|
||||
@ -58,6 +64,13 @@ if __name__ == "__main__":
|
||||
"func": openai_plugins_page,
|
||||
},
|
||||
}
|
||||
# 更新状态
|
||||
if "status" not in st.session_state \
|
||||
or "run_plugins_list" not in st.session_state \
|
||||
or "launch_subscribe_info" not in st.session_state \
|
||||
or "list_running_models" not in st.session_state \
|
||||
or "model_config" not in st.session_state:
|
||||
update_store()
|
||||
|
||||
with st.sidebar:
|
||||
st.image(
|
||||
@ -76,11 +89,13 @@ if __name__ == "__main__":
|
||||
|
||||
default_index = 0
|
||||
selected_page = option_menu(
|
||||
"",
|
||||
menu_title="",
|
||||
key="selected_page",
|
||||
options=options,
|
||||
icons=icons,
|
||||
# menu_icon="chat-quote",
|
||||
default_index=default_index,
|
||||
on_change=on_change,
|
||||
)
|
||||
|
||||
if selected_page in pages:
|
||||
|
||||
@ -11,12 +11,7 @@ from webui_pages.loom_view_client import (
|
||||
|
||||
|
||||
def openai_plugins_page(api: ApiRequest, is_lite: bool = None):
|
||||
if "status" not in st.session_state \
|
||||
or "run_plugins_list" not in st.session_state \
|
||||
or "launch_subscribe_info" not in st.session_state \
|
||||
or "list_running_models" not in st.session_state \
|
||||
or "model_config" not in st.session_state:
|
||||
update_store()
|
||||
|
||||
|
||||
with (st.container()):
|
||||
|
||||
@ -69,4 +64,4 @@ def openai_plugins_page(api: ApiRequest, is_lite: bool = None):
|
||||
st.button("启动" + st.session_state.worker_id, key="start_worker",
|
||||
on_click=start_worker)
|
||||
st.button("停止" + st.session_state.worker_id, key="stop_worker",
|
||||
on_click=stop_worker)
|
||||
on_click=stop_worker)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user