The canvas "Auto-detect" path (spec R3.1/R3.3/R3.5/R5.4). Async because extraction on
an image-only paper takes ~15-60s (Card-12 grounding):
POST /api/exam/templates/{id}/analyse -> {job_id} (BackgroundTasks)
GET /api/exam/jobs/{id} -> {status, counts, suggestions}
suggestions = questions + response_areas + boundaries, each source:'ai',confirmed:false
with confidence + page-fraction bounds + deterministic uuids — rendered as ghosts the
teacher confirms/dismisses; never overwrites manual shapes; persistence stays PUT /templates/{id}.
Access is as-the-user (E1/E2): the template is read under RLS (unseen -> 404, IDOR-safe)
and a job is only visible to the user who started it.
The heavy pipeline stays OUT of the API behind modules/services/exam_extract.py — an HTTP
client (aiohttp) to the exam-structure extraction service (the docling-exam-spike pipeline,
GPU-attached, deterministic), mirroring how the app calls Docling Serve/Ollama. Configured
via EXAM_EXTRACT_URL; unset -> the job fails cleanly as 'extraction unavailable'.
Follow-on (S6-1b): stand up that extraction service (POST /api/extract: source -> suggestions)
wrapping scripts/structure.py + scripts/analyse.py.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
188 lines
6.4 KiB
Plaintext
188 lines
6.4 KiB
Plaintext
# Classroom Copilot API - Environment Variables Template
|
|
# Copy this file to .env and fill in the values
|
|
|
|
# =============================================================================
|
|
# Server Configuration
|
|
# =============================================================================
|
|
PORT_OLLAMA=11434
|
|
UVICORN_PORT=8000
|
|
UVICORN_WORKERS=4
|
|
UVICORN_TIMEOUT=120
|
|
HOST_OLLAMA=http://localhost:11434
|
|
OLLAMA_MODEL=llama3.2
|
|
|
|
# =============================================================================
|
|
# Supabase Configuration
|
|
# =============================================================================
|
|
SUPABASE_URL=https://your-project.supabase.co
|
|
ANON_KEY=your-supabase-anon-key
|
|
SERVICE_ROLE_KEY=your-supabase-service-role-key
|
|
|
|
# =============================================================================
|
|
# Authentication
|
|
# =============================================================================
|
|
JWT_SECRET=your-jwt-secret-min-32-chars
|
|
|
|
# =============================================================================
|
|
# Admin Configuration (for initial setup)
|
|
# =============================================================================
|
|
ADMIN_EMAIL=admin@example.com
|
|
ADMIN_PASSWORD=change-me-immediately
|
|
ADMIN_USERNAME=admin
|
|
ADMIN_NAME=Admin User
|
|
ADMIN_DISPLAY_NAME=Administrator
|
|
ADMIN_WORKER_EMAIL=worker@example.com
|
|
|
|
# =============================================================================
|
|
# Redis Configuration
|
|
# =============================================================================
|
|
REDIS_HOST=localhost
|
|
REDIS_PORT=6379
|
|
REDIS_PASSWORD=
|
|
REDIS_SSL=false
|
|
REDIS_RECOVERY_ENABLED=true
|
|
REDIS_MAX_RETRY_ATTEMPTS=3
|
|
REDIS_HEALTH_CHECK_INTERVAL=30
|
|
|
|
# Dev/Prod/Test DB isolation
|
|
REDIS_DB_DEV=0
|
|
REDIS_DB_PROD=1
|
|
REDIS_DB_TEST=2
|
|
|
|
# Task TTL (seconds)
|
|
REDIS_TASK_TTL_DEV=3600
|
|
REDIS_TASK_TTL_PROD=7200
|
|
|
|
# Persistence
|
|
REDIS_PERSIST_DEV=false
|
|
REDIS_PERSIST_PROD=true
|
|
|
|
# =============================================================================
|
|
# OpenAI / LLM Configuration
|
|
# =============================================================================
|
|
OPENAI_API_KEY=your-openai-api-key
|
|
OPENAI_BASE_URL=https://api.openai.com/v1
|
|
|
|
# =============================================================================
|
|
# LangChain Configuration (optional)
|
|
# =============================================================================
|
|
LANGCHAIN_API_KEY=
|
|
LANGCHAIN_PROJECT=classroom-copilot
|
|
|
|
# =============================================================================
|
|
# Document Processing (Docling)
|
|
# =============================================================================
|
|
DOCLING_URL=http://localhost:8000
|
|
DOCLING_TIMEOUT=300
|
|
DOCLING_PDF_BACKEND=marker
|
|
DOCLING_INCLUDE_IMAGES=false
|
|
DOCLING_IMAGES_SCALE=1.0
|
|
DOCLING_VLM_MODEL=
|
|
DOCLING_VLM_TIMEOUT=300
|
|
DOCLING_NO_OCR_BY_PAGE=false
|
|
DOCLING_OCR_BY_PAGE=false
|
|
DOCLING_VLM_BY_PAGE=false
|
|
DOCLING_SPLIT_THRESHOLD=0.95
|
|
DOCLING_USE_SPLIT_MAP=false
|
|
DOCLING_PICTURE_DESCRIPTION_AREA_THRESHOLD=0.1
|
|
|
|
# Auto-processing flags
|
|
AUTO_DOCLING_OCR=false
|
|
AUTO_DOCLING_NO_OCR=false
|
|
AUTO_DOCLING_VLM=false
|
|
AUTO_DOCUMENT_ANALYSIS=false
|
|
AUTO_PAGE_IMAGES=false
|
|
AUTO_SPLIT_MAP_GENERATION=false
|
|
AUTO_TIKA_PROCESSING=false
|
|
|
|
# =============================================================================
|
|
# Document Processing (Tika)
|
|
# =============================================================================
|
|
TIKA_URL=http://localhost:9998
|
|
TIKA_TIMEOUT=120
|
|
|
|
# =============================================================================
|
|
# Queue Configuration
|
|
# =============================================================================
|
|
QUEUE_WORKERS=4
|
|
QUEUE_MAX_MEMORY_MB=512
|
|
QUEUE_MAX_USER_MEMORY_MB=128
|
|
QUEUE_DOCLING_LIMIT=5
|
|
QUEUE_DOCUMENT_ANALYSIS_LIMIT=3
|
|
QUEUE_LLM_LIMIT=2
|
|
QUEUE_PAGE_IMAGES_LIMIT=10
|
|
QUEUE_SPLIT_MAP_LIMIT=5
|
|
QUEUE_TIKA_LIMIT=5
|
|
|
|
# Upload processing
|
|
UPLOAD_QUEUE_ENABLED=true
|
|
UPLOAD_IMMEDIATE_PROCESSING=false
|
|
UPLOAD_STATUS_POLLING_INTERVAL=5
|
|
MAX_FILE_SIZE_MB=50
|
|
|
|
# =============================================================================
|
|
# OCR Configuration
|
|
# =============================================================================
|
|
OCR_ENGINE=tesseract
|
|
OCR_LANG=eng
|
|
|
|
# =============================================================================
|
|
# Memory / Warning Thresholds
|
|
# =============================================================================
|
|
MEMORY_WARNING_THRESHOLD=80
|
|
MEMORY_REJECT_THRESHOLD=95
|
|
|
|
# =============================================================================
|
|
# TLSync Configuration
|
|
# =============================================================================
|
|
# Server-side secret used to sign short-lived TLSync auth tokens. Do not expose with a VITE_ prefix.
|
|
TLSYNC_SECRET=change-me-server-side-only
|
|
TLSYNC_TOKEN_TTL_SECONDS=300
|
|
|
|
# =============================================================================
|
|
# CORS Configuration
|
|
# =============================================================================
|
|
CORS_SITE_URL=https://app.classroomcopilot.ai
|
|
CORS_API_URL=https://api.classroomcopilot.ai
|
|
CORS_GRAPH_URL=https://graph.classroomcopilot.ai
|
|
|
|
# =============================================================================
|
|
# Logging
|
|
# =============================================================================
|
|
LOG_LEVEL=info
|
|
LOG_PATH=/var/log/classroom-copilot
|
|
|
|
# =============================================================================
|
|
# Development Mode
|
|
# =============================================================================
|
|
DEV_MODE=false
|
|
BACKEND_DEV_MODE=false
|
|
BACKEND_INIT_PATH=/app/init
|
|
|
|
# =============================================================================
|
|
# App Metadata
|
|
# =============================================================================
|
|
APP_NAME=Classroom Copilot
|
|
APP_VERSION=1.0.0
|
|
APP_AUTHOR=KevlarAI
|
|
APP_AUTHOR_EMAIL=kcar@kevlarai.com
|
|
APP_DESCRIPTION=AI-powered classroom collaboration platform
|
|
APP_PROTOCOL=https
|
|
APP_BOLT_URL=bolt://neo4j:7687
|
|
APP_GRAPH_URL=http://localhost:7474
|
|
|
|
# =============================================================================
|
|
# External API Keys
|
|
# =============================================================================
|
|
YOUTUBE_API_KEY=
|
|
GOOGLE_CLIENT_SECRETS_FILE=
|
|
|
|
# =============================================================================
|
|
# Node Filesystem (for document storage)
|
|
# =============================================================================
|
|
NODE_FILESYSTEM_PATH=/tmp/cc-nodes
|
|
|
|
# Exam-structure extraction service (docling-exam-spike pipeline) for /api/exam analyse (S6-1)
|
|
EXAM_EXTRACT_URL=
|
|
EXAM_EXTRACT_TIMEOUT=180
|