mgbam commited on
Commit
26ca950
Β·
verified Β·
1 Parent(s): 8bc254d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -29
app.py CHANGED
@@ -1,33 +1,30 @@
1
- # app.py
2
-
3
  import streamlit as st
4
  import os
5
  from landing import show_landing
6
- from dashboard.logs import show_logs
7
  from agent_manager import AgentManager
 
8
  from stripe_checkout import create_stripe_session
9
 
10
- st.set_page_config(page_title="AutoExec AI", layout="wide")
11
-
12
- # Read any query params (e.g., ?mode=landing) using the new API
13
- mode = st.query_params.get("mode", ["app"])[0]
14
 
15
  # Sidebar navigation
16
- st.sidebar.header("AutoExec AI")
17
- selection = st.sidebar.radio(
18
  "Go to",
19
- ["🏠 Home", "πŸš€ Launch", "πŸ“Š Logs", "βš™οΈ Settings"],
20
- index=0 if mode in ("app", "landing") else None
 
21
  )
22
 
23
- # Route: Landing or Home
24
- if mode == "landing" or selection == "🏠 Home":
25
  show_landing()
26
 
27
- # Route: Launch
28
- elif selection == "πŸš€ Launch":
29
  st.header("πŸš€ Launch a New AI Business")
30
- niche = st.text_input("Niche (e.g. fitness)")
31
  business_type = st.selectbox("Business Type", ["Dropshipping", "Print-on-Demand", "Newsletter", "Course"])
32
  if st.button("Generate & Deploy"):
33
  manager = AgentManager(niche, business_type)
@@ -35,22 +32,12 @@ elif selection == "πŸš€ Launch":
35
  st.success("βœ… Business Launched!")
36
  st.json(result)
37
 
38
- # Route: Logs
39
- elif selection == "πŸ“Š Logs":
40
  show_logs()
41
 
42
- # Route: Settings & Billing
43
- elif selection == "βš™οΈ Settings":
44
  st.header("βš™οΈ Settings & Billing")
45
  if st.button("Create Stripe Checkout Session"):
46
  url = create_stripe_session()
47
  st.markdown(f"[Pay & Activate]({url})")
48
- st.markdown(
49
- """
50
- **Secrets in use**:
51
- - `OPENAI_API_KEY`
52
- - `GEMINI_API_KEY`
53
- - `STRIPE_API_KEY`
54
- - `API_KEY` (for protected API routes)
55
- """
56
- )
 
 
 
1
  import streamlit as st
2
  import os
3
  from landing import show_landing
 
4
  from agent_manager import AgentManager
5
+ from dashboard.logs import show_logs
6
  from stripe_checkout import create_stripe_session
7
 
8
+ # Initialize session state for page navigation
9
+ if "page" not in st.session_state:
10
+ st.session_state.page = "Home"
 
11
 
12
  # Sidebar navigation
13
+ st.sidebar.title("AutoExec AI")
14
+ st.session_state.page = st.sidebar.radio(
15
  "Go to",
16
+ ["Home", "Launch", "Logs", "Settings"],
17
+ index=["Home", "Launch", "Logs", "Settings"].index(st.session_state.page),
18
+ key="page",
19
  )
20
 
21
+ # Route to the correct page
22
+ if st.session_state.page == "Home":
23
  show_landing()
24
 
25
+ elif st.session_state.page == "Launch":
 
26
  st.header("πŸš€ Launch a New AI Business")
27
+ niche = st.text_input("Niche (e.g., fitness)")
28
  business_type = st.selectbox("Business Type", ["Dropshipping", "Print-on-Demand", "Newsletter", "Course"])
29
  if st.button("Generate & Deploy"):
30
  manager = AgentManager(niche, business_type)
 
32
  st.success("βœ… Business Launched!")
33
  st.json(result)
34
 
35
+ elif st.session_state.page == "Logs":
 
36
  show_logs()
37
 
38
+ elif st.session_state.page == "Settings":
 
39
  st.header("βš™οΈ Settings & Billing")
40
  if st.button("Create Stripe Checkout Session"):
41
  url = create_stripe_session()
42
  st.markdown(f"[Pay & Activate]({url})")
43
+ st.markdown("Manage API keys and subscriptions here.")