File size: 1,564 Bytes
80901e6
b7b397e
 
26ca950
b7b397e
e19b30e
7c66e2d
26ca950
 
e19b30e
7c66e2d
 
 
 
 
26ca950
7c66e2d
8bc254d
7c66e2d
 
26ca950
8bc254d
e19b30e
7c66e2d
 
 
 
 
b7b397e
 
7c66e2d
b7b397e
26ca950
7c66e2d
 
 
 
b7b397e
 
 
 
8bc254d
b7b397e
7c66e2d
e19b30e
b7b397e
7c66e2d
b7b397e
 
 
 
7c66e2d
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
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.")