Add OpenRouter support and improve JSON parsing robustness

- Add OpenRouter as third LLM provider option in config.py
- Implement _extract_json() to handle markdown-wrapped JSON responses
- Add default values for missing required fields in ScriptPlan
- Handle navigation_strategy as list or string
- Add .env.example with configuration templates
- Add test script and sample generated scrapers for RWTH and KAUST

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
yangxiaoyu-crypto
2025-12-10 13:13:39 +08:00
parent d80db75d4e
commit fb2aa12f2b
8 changed files with 1446 additions and 9 deletions

14
.env.example Normal file
View File

@ -0,0 +1,14 @@
# OpenRouter Configuration (recommended)
CODEGEN_MODEL_PROVIDER=openrouter
OPENAI_API_KEY=your-openrouter-api-key-here
CODEGEN_OPENROUTER_MODEL=anthropic/claude-sonnet-4
# Alternative: Direct Anthropic
# CODEGEN_MODEL_PROVIDER=anthropic
# ANTHROPIC_API_KEY=your-anthropic-api-key-here
# CODEGEN_ANTHROPIC_MODEL=claude-sonnet-4-20250514
# Alternative: OpenAI
# CODEGEN_MODEL_PROVIDER=openai
# OPENAI_API_KEY=your-openai-api-key-here
# CODEGEN_OPENAI_MODEL=gpt-4o