|
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 |
|
|
|
|
|
st.set_page_config( |
|
page_title="AutoExec AI", |
|
page_icon="π", |
|
layout="wide", |
|
initial_sidebar_state="expanded", |
|
) |
|
|
|
|
|
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" |
|
) |
|
|
|
|
|
page = next(k for k, v in PAGES.items() if v == selection) |
|
st.session_state.page = page |
|
|
|
|
|
if page == "Home": |
|
|
|
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) |
|
|
|
|
|
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, |
|
) |
|
|