CoolFace
Apppublic

24f3001764/llm_code_deployment-1

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
App README

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

bash
GET /

Returns API status and version.

Submit Task

bash
POST /request

Request Body:

json
{
  "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:

json
{
  "status": "accepted",
  "message": "Task accepted for processing",
  "task": "task-id",
  "round": 1
}

Check Status

bash
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 secret
  • โ€”OPENAI_API_KEY - OpenAI API key for LLM generation
  • โ€”GITHUB_TOKEN - GitHub Personal Access Token (repo + workflow scopes)
  • โ€”GITHUB_USERNAME - Your GitHub username

๐Ÿš€ How It Works

  1. 1.Receive Request - API receives task via POST /request
  2. 2.Immediate Response - Returns 200 OK immediately
  3. 3.Background Processing:
  4. 4.Decode attachments
  5. 5.Generate app using LLM
  6. 6.Create GitHub repository
  7. 7.Deploy to GitHub Pages
  8. 8.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

bash
# 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