Files
calderbuild 516324fe93 feat: demo reliability, UX polish, and backend hardening
- Add Pydantic input validation (prompt length, duration, num_shots)
- Per-job output directory for concurrent job isolation
- LLM JSON parse retry (1 retry with explicit JSON instruction)
- Music failure surfaced as amber "Skipped" state in frontend
- Agent card states: completed (green), failed (red), skipped (amber)
- Error banner with "Try Again" button on pipeline failure
- Elapsed timer (MM:SS) during production
- Script preview section after Script agent completes
- Form inputs disabled during production
- Style presets (5 visual cards replacing plain text chips)
- Demo gallery section with placeholder videos
- Production summary (time, shots, agents, cost) on completion
- Structured logging replacing bare print calls
- Background job cleanup (1 hour TTL, 10 min interval)
- Per-stage error propagation with tracebacks in logs
2026-02-24 17:52:17 +08:00

32 lines
890 B
Python

"""Configuration and shared constants."""
import os
import sys
import requests
from dotenv import load_dotenv
load_dotenv(os.path.join(os.path.dirname(__file__), '..', '.env'))
MINIMAX_API_KEY = os.getenv("MINIMAX_API_KEY", "")
MINIMAX_BASE_URL = "https://api.minimax.io/v1"
OUTPUT_DIR = os.path.join(os.path.dirname(__file__), "output")
os.makedirs(OUTPUT_DIR, exist_ok=True)
HEADERS = {
"Authorization": f"Bearer {MINIMAX_API_KEY}",
"Content-Type": "application/json",
}
# Shared HTTP session with default timeout
api_session = requests.Session()
api_session.headers.update(HEADERS)
api_session.timeout = 120
def validate_config():
"""Validate required configuration at startup."""
if not MINIMAX_API_KEY:
import logging
logging.getLogger("agentcut").error("MINIMAX_API_KEY not set. Copy .env.example to .env and add your key.")
sys.exit(1)