|
|
import streamlit as st |
|
|
import asyncio |
|
|
import os |
|
|
import nest_asyncio |
|
|
import atexit |
|
|
from services.chat_service import init_session |
|
|
from services.logging_service import get_logger |
|
|
from services.task_monitor import get_task_monitor |
|
|
from utils.async_helpers import on_shutdown |
|
|
from apps import mcp_playground |
|
|
|
|
|
|
|
|
nest_asyncio.apply() |
|
|
|
|
|
page_icon_path = os.path.join('.', 'icons', 'playground.png') |
|
|
|
|
|
st.set_page_config( |
|
|
page_title="MCP Playground", |
|
|
page_icon=(page_icon_path), |
|
|
layout='wide', |
|
|
initial_sidebar_state="expanded" |
|
|
) |
|
|
|
|
|
|
|
|
with open(os.path.join('.', '.streamlit', 'style.css')) as f: |
|
|
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True) |
|
|
|
|
|
|
|
|
def main(): |
|
|
|
|
|
if "loop" not in st.session_state: |
|
|
st.session_state.loop = asyncio.new_event_loop() |
|
|
asyncio.set_event_loop(st.session_state.loop) |
|
|
|
|
|
|
|
|
logger = get_logger() |
|
|
logger.log_system_status("Application started") |
|
|
|
|
|
|
|
|
task_monitor = get_task_monitor() |
|
|
|
|
|
|
|
|
atexit.register(on_shutdown) |
|
|
|
|
|
|
|
|
init_session() |
|
|
mcp_playground.main() |
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |