import streamlit as st
# Set page config - must be the first Streamlit command
st.set_page_config(
page_title="SlideGator.AI",
page_icon="🐊",
layout="wide",
initial_sidebar_state="expanded"
)
import uuid
import os
import json
from updated_components import (
render_ideation_stage,
render_storyboard_stage,
render_template_stage,
render_slides_stage,
render_export_stage,
render_ai_settings
)
from multi_llm_provider import get_ai_manager
# Check and display API key status
api_key = os.getenv("ANTHROPIC_API_KEY")
openai_key = os.getenv("OPENAI_API_KEY")
deepseek_key = os.getenv("DEEPSEEK_API_KEY")
perplexity_key = os.getenv("PERPLEXITY_API_KEY")
pexels_key = os.getenv("PEXELS_API_KEY")
# Add custom CSS
st.markdown("""
""", unsafe_allow_html=True)
# Initialize session state variables if they don't exist
if "session_id" not in st.session_state:
st.session_state.session_id = str(uuid.uuid4())
if "current_stage" not in st.session_state:
st.session_state.current_stage = "ideation"
if "presentation_title" not in st.session_state:
st.session_state.presentation_title = ""
if "presentation_purpose" not in st.session_state:
st.session_state.presentation_purpose = ""
if "target_audience" not in st.session_state:
st.session_state.target_audience = ""
if "storyboard" not in st.session_state:
st.session_state.storyboard = []
if "selected_template" not in st.session_state:
st.session_state.selected_template = "professional"
if "slides_content" not in st.session_state:
st.session_state.slides_content = []
if "default_model" not in st.session_state:
st.session_state.default_model = "claude-3-sonnet-20250219"
if "ai_temperature" not in st.session_state:
st.session_state.ai_temperature = 0.7
if "enable_web_search" not in st.session_state:
st.session_state.enable_web_search = False
# Initialize AI provider manager
ai_manager = get_ai_manager()
# Sidebar
with st.sidebar:
# Custom SlideGator logo and title
st.markdown("""
🐊
SlideGator.AI
Snapping up presentation perfection
""", unsafe_allow_html=True)
# Display API information
api_status = []
if api_key:
api_status.append("🟢 Claude AI")
else:
api_status.append("🔴 Claude AI (not connected)")
if openai_key:
api_status.append("🟢 OpenAI")
else:
api_status.append("⚪ OpenAI (optional)")
if deepseek_key:
api_status.append("🟢 DeepSeek")
else:
api_status.append("⚪ DeepSeek (optional)")
if perplexity_key:
api_status.append("🟢 Perplexity")
else:
api_status.append("⚪ Web Search (optional)")
if pexels_key:
api_status.append("🟢 Stock Images")
else:
api_status.append("⚪ Stock Images (optional)")
st.info("\n".join(api_status))
if not api_key:
st.error("⚠️ ANTHROPIC_API_KEY environment variable not found. The app will use fallback content generation.")
# Display current progress
st.write("## Your Journey")
stages = [
{"name": "Ideation", "icon": "💡"},
{"name": "Storyboard", "icon": "📋"},
{"name": "Template", "icon": "🎨"},
{"name": "Slides", "icon": "🖼️"},
{"name": "Export", "icon": "📤"}
]
current_stage_idx = stages.index(next((s for s in stages if s["name"].lower() == st.session_state.current_stage), stages[0]))
progress_value = (current_stage_idx) / (len(stages) - 1)
st.progress(progress_value)
# Display all stages and highlight current
for i, stage in enumerate(stages):
if i == current_stage_idx:
st.markdown(f"### {stage['icon']} {stage['name']} ◀")
else:
st.markdown(f"### {stage['icon']} {stage['name']}")
st.write("---")
# Settings accordion
with st.expander("⚙️ Settings", expanded=False):
# Show presentation info
if st.session_state.presentation_title:
st.write(f"**Title:** {st.session_state.presentation_title}")
if st.session_state.selected_template:
st.write(f"**Template:** {st.session_state.selected_template.title()}")
# Show slide count
if st.session_state.slides_content:
st.write(f"**Slides:** {len(st.session_state.slides_content)}")
elif st.session_state.storyboard:
st.write(f"**Planned Slides:** {len(st.session_state.storyboard)}")
# Debugging options
show_debug = st.checkbox("Show Debug Info", value=False)
if show_debug:
st.code(json.dumps({k: v for k, v in st.session_state.items() if k not in ["custom_template", "ai_manager", "slides_content", "storyboard"]}, default=str, indent=2))
st.markdown("""
Made with 💚 by SlideGator.AI
Powered by Claude AI
""", unsafe_allow_html=True)
# Jump to stage buttons (for development/testing)
if st.checkbox("Development Mode", value=False):
st.write("Jump to stage:")
col1, col2 = st.columns(2)
for i, stage in enumerate(stages):
with col1 if i % 2 == 0 else col2:
if st.button(f"{stage['icon']} {stage['name']}", key=f"jump_{stage['name']}"):
st.session_state.current_stage = stage['name'].lower()
st.rerun()
# Main content
st.markdown("""
🐊
SlideGator.AI
Create professional presentations with AI-powered storyboarding and content generation
""", unsafe_allow_html=True)
# Display different UI based on current stage
if st.session_state.current_stage == "ideation":
render_ideation_stage()
elif st.session_state.current_stage == "storyboard":
render_storyboard_stage()
elif st.session_state.current_stage == "template":
render_template_stage()
elif st.session_state.current_stage == "slides":
render_slides_stage()
elif st.session_state.current_stage == "export":
render_export_stage()