This document outlines all the improvements and bug fixes made to SlideCraft.
- ✅ Dark/Light Mode Toggle - Added to both Streamlit and React interfaces
- ✅ Two-Column Slide Type - Implemented missing slide layout
- ✅ Security Improvements - Fixed API configuration issues
- ✅ Better Error Handling - Comprehensive validation and error messages
- ✅ Flexible Output Paths - Works locally and in cloud environments
Location: app.py (Streamlit), slidecraft-web-v5.jsx (React)
Both interfaces now support dark and light mode with a toggle button:
- Toggle Location: Sidebar at the top
- Button: 🌙 (moon) for dark mode, ☀️ (sun) for light mode
- Features:
- Dynamic CSS that changes background, text, and UI element colors
- Persistent across page interactions using session state
- Smooth transitions between modes
- Toggle Location: Header, top-right corner
- Features:
- Moon/Sun icon toggle button
- Dark gradients and color schemes
- All UI elements (cards, inputs, buttons) adapt to the theme
- Accessible with ARIA labels
Usage:
# Streamlit: Click the moon/sun button in the sidebar
# React: Click the moon/sun icon in the headerLocation: slidecraft_v5.py lines 423-515
Problem: Templates referenced a two_column slide type that wasn't implemented.
Solution: Created TwoColumnSlide class with:
- Left and right column backgrounds
- Optional headers for each column
- Independent content lists
- Professional spacing and formatting
Usage:
{
'type': 'two_column',
'title': 'Comparison',
'left_header': 'Before',
'left_items': ['Point 1', 'Point 2'],
'right_header': 'After',
'right_items': ['Result 1', 'Result 2']
}Templates Using This:
- Church Board Meeting (attendance comparison)
- Church Staff Meeting (this week vs next week)
- Quarterly Business Review (wins vs challenges)
Location: slidecraft_v5.py lines 609-625
Problem: Hardcoded /mnt/user-data/outputs path wouldn't work locally.
Solution:
- Try configured
output_dirfirst - Fall back to cloud path if it exists
- Create local
./outputs/directory if needed - Configurable via
config['output_dir']
Before:
path = f"/mnt/user-data/outputs/presentation_v4pro_{ts}.pptx"After:
output_dir = self.config.get('output_dir', None)
if not output_dir:
if os.path.exists('/mnt/user-data/outputs'):
output_dir = '/mnt/user-data/outputs'
else:
output_dir = os.path.join(os.getcwd(), 'outputs')
os.makedirs(output_dir, exist_ok=True)Location: app.py lines 204-288, 383-478
Improvements:
- ✅ Validate topic is not empty
- ✅ Validate slide count (3-30)
- ✅ Validate topic length (max 200 chars)
- ✅ Check file exists before download
- ✅ Specific error types (ValueError, IOError)
- ✅ User-friendly error messages with emojis
- ✅ Check for missing required fields
- ✅ Validate field lengths (max 500 chars)
- ✅ Check file exists before download
- ✅ Specific error types
- ✅ Show which fields are missing
Example Error Messages:
⚠️ Please enter a presentation topic
⚠️ Number of slides must be between 3 and 30
⚠️ File error: Permission denied. Check that you have write permissions.
❌ Error creating presentation: Invalid theme
Location: slidecraft-web-v5.jsx lines 66-169
Problem: Direct API call to Anthropic without API key (wouldn't work).
Solution:
- Remove hardcoded API endpoint
- Add environment variable support:
REACT_APP_API_ENDPOINT - Default to local backend:
/api/generate - Clear documentation comments
- Better error messages explaining the issue
Before:
const response = await fetch("https://api.anthropic.com/v1/messages", {
method: "POST",
headers: {
"Content-Type": "application/json",
// Missing API key!
},
// ...
});After:
// NOTE: This component is designed to work with a backend API or Streamlit app
// For production use, replace this with your backend endpoint
// The Streamlit app (app.py) is the recommended way to use this tool
const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || '/api/generate';
const response = await fetch(apiEndpoint, {
method: "POST",
// Sends to backend instead of direct API call
});Location: Multiple files
Added Validations:
- Topic length validation
- Slide count range (3-30)
- Field length limits (500 chars)
- File existence checks
- Required field checking
- Template selection validation
- Input sanitization
- Better error messages
-
Missing Two-Column Slide Type
- Templates referenced it but it didn't exist
- Caused errors when generating certain presentations
- Fixed: Implemented complete TwoColumnSlide class
-
Hardcoded Paths
- Wouldn't work on local development
- Fixed: Auto-detect environment and create directories
-
API Security Issue
- React component had non-functional API call
- Fixed: Use backend endpoint with environment config
-
Poor Error Messages
- Generic "Error" messages weren't helpful
- Fixed: Specific, actionable error messages with context
-
No Dark Mode
- User request - interface only had light mode
- Fixed: Full dark/light mode toggle in both interfaces
-
Dark/Light Mode
streamlit run app.py # Click moon/sun toggle in sidebar # Verify all elements change color
-
Two-Column Slides
# In app.py, select "Church Board Meeting" template # Fill in all fields # Generate and verify two-column layout
-
Error Handling
# Try generating without topic # Try with 50 slides (should error) # Try with empty template fields
-
Output Paths
# Run locally - should create ./outputs/ # Check presentations are saved correctly
Add these tests to a test suite:
# Test two-column slide
def test_two_column_slide():
config = {
'theme': 'software_professional',
'slides_content': [{
'type': 'two_column',
'title': 'Test',
'left_header': 'Left',
'left_items': ['A', 'B'],
'right_header': 'Right',
'right_items': ['C', 'D']
}]
}
result = create_presentation(config)
assert os.path.exists(result['filepath'])
# Test output directory creation
def test_output_directory():
config = {'slides_content': [{'type': 'title', 'title': 'Test'}]}
result = create_presentation(config)
assert os.path.exists(result['filepath'])No breaking changes! All existing functionality works the same.
New Options:
- Dark mode toggle (optional, defaults to light)
- Two-column slides in templates (automatically works)
- Custom output directory via config
New Optional Config Parameters:
config = {
'theme': 'software_professional',
'slides_content': [...],
'output_dir': '/custom/path' # NEW: Optional custom output directory
}React Environment Variables:
# .env file
REACT_APP_API_ENDPOINT=http://localhost:8000/api/generatePotential enhancements for future versions:
- Custom Theme Creator - Let users create their own color schemes
- Image Support - Add images to slides
- Chart Generation - Auto-generate charts from data
- Export to PDF - Convert presentations to PDF
- Collaboration - Multi-user editing
- Version History - Track presentation changes
- AI Integration - Auto-generate content from prompts
- Custom Fonts - Upload and use custom fonts
Issues?
- Check error messages (now much more detailed!)
- Verify file permissions in output directory
- Ensure all required fields are filled
- Check Python version (3.8+)
Questions?
- Review this document
- Check existing templates in
slidecraft_v5.py - See README.md for basic usage
Improvements by: Claude (Anthropic AI) Original SlideCraft: v5.0 Enhanced Version: v5.1
Built with:
- python-pptx
- Streamlit
- React
- Lucide Icons