suna/agentpress/ui/main.py

44 lines
1.4 KiB
Python
Raw Normal View History

2024-10-06 01:04:15 +08:00
import streamlit as st
2024-10-10 22:21:39 +08:00
from agentpress.ui.thread_management import display_thread_management
from agentpress.ui.message_display import display_messages_and_runner
from agentpress.ui.thread_runner import fetch_thread_runs, display_runs
from agentpress.ui.tool_display import display_tools
from agentpress.ui.utils import initialize_session_state, fetch_data, API_BASE_URL
2024-10-06 01:04:15 +08:00
def main():
initialize_session_state()
fetch_data()
2024-10-08 03:13:11 +08:00
st.set_page_config(page_title="AI Assistant Management System", layout="wide")
2024-10-06 01:04:15 +08:00
st.sidebar.title("Navigation")
2024-10-08 03:13:11 +08:00
mode = st.sidebar.radio("Select Mode", ["Thread Management", "Tools"])
2024-10-06 01:04:15 +08:00
st.title("AI Assistant Management System")
2024-10-08 03:13:11 +08:00
if mode == "Tools":
2024-10-06 01:04:15 +08:00
display_tools()
else: # Thread Management
display_thread_management_content()
def display_thread_management_content():
2024-10-08 03:13:11 +08:00
col1, col2 = st.columns([1, 3])
with col1:
display_thread_management()
if st.session_state.selected_thread:
display_thread_runner(st.session_state.selected_thread)
with col2:
if st.session_state.selected_thread:
display_messages_and_runner(st.session_state.selected_thread)
2024-10-06 01:04:15 +08:00
2024-10-08 03:13:11 +08:00
def display_thread_runner(thread_id):
limit = st.number_input("Number of runs to retrieve", min_value=1, max_value=100, value=20)
if st.button("Fetch Runs"):
runs = fetch_thread_runs(thread_id, limit)
2024-10-10 22:21:39 +08:00
# display_runs(runs)
2024-10-06 01:04:15 +08:00
if __name__ == "__main__":
main()