File size: 3,791 Bytes
80901e6
b7b397e
 
26ca950
b7b397e
e19b30e
85ebef7
 
 
 
 
 
 
 
 
26ca950
 
e19b30e
85ebef7
 
 
 
 
 
7c66e2d
26ca950
85ebef7
 
 
 
 
8bc254d
e19b30e
85ebef7
 
 
7c66e2d
85ebef7
7c66e2d
85ebef7
 
 
 
 
 
 
 
 
 
 
 
 
b7b397e
 
7c66e2d
85ebef7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b7b397e
7c66e2d
85ebef7
e19b30e
b7b397e
7c66e2d
85ebef7
 
 
 
 
 
 
 
 
 
 
 
b7b397e
85ebef7
 
 
 
 
 
 
 
 
 
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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

# ─── Page Configuration ───────────────────────────────────────────────────────
st.set_page_config(
    page_title="AutoExec AI",
    page_icon="πŸš€",
    layout="wide",
    initial_sidebar_state="expanded",
)

# ─── Sidebar Navigation ───────────────────────────────────────────────────────
if "page" not in st.session_state:
    st.session_state.page = "Home"

PAGES = {
    "Home": "🏠 Home",
    "Launch": "πŸš€ Launch",
    "Logs": "πŸ“Š Logs",
    "Settings": "βš™οΈ Settings"
}

st.sidebar.title("AutoExec AI")
selection = st.sidebar.radio(
    "Navigate to",
    list(PAGES.values()),
    index=list(PAGES.values()).index(PAGES[st.session_state.page]),
    key="page_choice"
)

# Map back to internal page names
page = next(k for k, v in PAGES.items() if v == selection)
st.session_state.page = page

# ─── Main Content ─────────────────────────────────────────────────────────────
if page == "Home":
    # Full-bleed hero section
    st.markdown(
        """
        <div style="text-align:center; margin: 2rem 0;">
            <h1 style="font-size:3rem;">πŸš€ AutoExec AI</h1>
            <p style="font-size:1.25rem; color: #666;">
                Your Autonomous AI Business Builder<br>
                Launch, manage, and optimize digital businesses in one click.
            </p>
        </div>
        """,
        unsafe_allow_html=True,
    )
    show_landing()

elif page == "Launch":
    st.subheader("πŸš€ Launch a New AI Business")
    with st.form("launch_form", clear_on_submit=False):
        niche = st.text_input("🎯 Niche", placeholder="e.g., fitness")
        business_type = st.selectbox(
            "πŸ“¦ Business Type",
            ["Dropshipping", "Print-on-Demand", "Newsletter", "Course"],
        )
        launched = st.form_submit_button("Generate & Deploy")
    if launched:
        if not niche.strip():
            st.error("Please enter a valid niche.")
        else:
            with st.spinner("πŸ€– Running agents... this takes a few seconds"):
                manager = AgentManager(niche.strip(), business_type)
                result = manager.run_all()
            st.success("βœ… Business Launched!")
            st.json(result)

elif page == "Logs":
    st.subheader("πŸ“Š Agent Memory Log Dashboard")
    show_logs()

elif page == "Settings":
    st.subheader("βš™οΈ Settings & Billing")
    st.markdown(
        """
        Manage your API keys, subscriptions, and integrations.
        Ensure you’ve set the following in **Settings β†’ Secrets**:
        - `API_KEY`
        - `OPENAI_API_KEY`
        - `GEMINI_API_KEY`
        - `STRIPE_API_KEY`
        """
    )
    if st.button("πŸ’³ Create Stripe Checkout Session"):
        url = create_stripe_session()
        st.markdown(f"[Proceed to Payment]({url})", unsafe_allow_html=True)

# ─── Footer ───────────────────────────────────────────────────────────────────
st.markdown("---")
st.markdown(
    "<p style='text-align:center; color:#888; font-size:0.9rem;'>"
    "Powered by Streamlit β€’ FastAPI β€’ Celery β€’ Redis β€’ Hugging Face Spaces"
    "</p>",
    unsafe_allow_html=True,
)