import streamlit as st from landing import show_landing from agent_manager import AgentManager from dashboard.logs import show_logs from stripe_checkout import create_stripe_session # Initialize default page if not already set if "page" not in st.session_state: st.session_state.page = "Home" # Define the list of pages PAGES = ["Home", "Launch", "Logs", "Settings"] # Create a radio widget in the sidebar, keyed to 'page' # This widget *updates* st.session_state.page automatically st.sidebar.title("AutoExec AI") st.sidebar.radio( "Go to", PAGES, index=PAGES.index(st.session_state.page), key="page", ) # Read the current page (streamlit will have set session_state.page for us) page = st.session_state.page # Route to the correct content if page == "Home": show_landing() elif page == "Launch": st.header("🚀 Launch a New AI Business") niche = st.text_input("Niche (e.g., fitness)") business_type = st.selectbox( "Business Type", ["Dropshipping", "Print-on-Demand", "Newsletter", "Course"] ) if st.button("Generate & Deploy"): manager = AgentManager(niche, business_type) result = manager.run_all() st.success("✅ Business Launched!") st.json(result) elif page == "Logs": show_logs() elif page == "Settings": st.header("⚙️ Settings & Billing") if st.button("Create Stripe Checkout Session"): url = create_stripe_session() st.markdown(f"[Pay & Activate]({url})") st.markdown("Manage your API keys and subscriptions here.")