24f3001764/llm_code_deployment-1
0
LLM Code Deployment API
Automated web application generation and deployment system for TDS 2025 Term 3 Project 1.
๐ฏ Overview
This API receives task requests, generates web applications using LLM, deploys them to GitHub Pages, and notifies evaluation endpoints.
๐ก API Endpoints
Health Check
GET /Returns API status and version.
Submit Task
POST /requestRequest Body:
{
"email": "student@example.com",
"secret": "your-secret-key",
"task": "task-id",
"round": 1,
"nonce": "unique-nonce",
"brief": "Task description",
"checks": ["requirement1", "requirement2"],
"evaluation_url": "https://evaluation-endpoint.com",
"attachments": []
}Response:
{
"status": "accepted",
"message": "Task accepted for processing",
"task": "task-id",
"round": 1
}Check Status
GET /status/{task_id}Returns processing status for a task.
๐ง Configuration
Required environment variables (set in Space Settings โ Repository Secrets):
STUDENT_SECRET- Your unique authentication secretOPENAI_API_KEY- OpenAI API key for LLM generationGITHUB_TOKEN- GitHub Personal Access Token (repo + workflow scopes)GITHUB_USERNAME- Your GitHub username
๐ How It Works
- Receive Request - API receives task via POST /request
- Immediate Response - Returns 200 OK immediately
- Background Processing:
- Decode attachments
- Generate app using LLM
- Create GitHub repository
- Deploy to GitHub Pages
- Notify - Send completion notification to evaluation URL
๐ฆ Features
- โ Async background task processing
- โ Automatic GitHub repo creation
- โ GitHub Pages deployment
- โ Retry logic with exponential backoff
- โ Comprehensive logging
- โ Error handling
- โ Automated security scanning for secrets
- โ Multi-round support (Round 1, 2, N)
- โ Real-time status tracking
- โ Interactive test client
- โ One-command startup with validation
๐ Security
- โ Secret-based authentication
- โ Environment variable configuration
- โ No hardcoded credentials
- โ Automated secret scanning (15+ patterns)
- โ Pattern detection for API keys, tokens, passwords
- โ Masked logging for sensitive data
- โ Pre-deployment security checks
๐ Documentation
For detailed setup and usage instructions, see the documentation files in the root directory:
- `PROJECT_SUMMARY.md` - Complete project overview and status
- `QUICKSTART.md` - Quick start guide (5 minutes)
- `SETUP.md` - Detailed local setup instructions
- `USAGE_GUIDE.md` - API usage and troubleshooting
- `ARCHITECTURE.md` - System design and components
- `DEPLOYMENT_CHECKLIST.md` - Deployment guide
๐ Quick Start
# 1. Install dependencies
pip install -r requirements.txt
# 2. Configure environment
cp .env.example .env
# Edit .env with your credentials
# 3. Validate setup
python validate_setup.py
# 4. Start server
python start.py
# Or on Windows: start.bat
# 5. Test API
python test/test_client.py
# Or on Windows: run_tests.bat๐ Troubleshooting
API not responding?
- Check Space logs in Hugging Face
- Verify all environment variables are set
- Ensure GitHub token has correct permissions
GitHub deployment failing?
- Verify GitHub token is valid
- Check GitHub username is correct
- Ensure repo doesn't already exist
LLM generation failing?
- Verify OpenAI API key is valid
- Check API credits/quota
- Review logs for specific errors
๐ Support
Version: 1.0.0 Last Updated: 2025-10-11
