Files
dreamweaver/.claude/specs/robustness-improvement/dev-plan.md
zhangtuo 145be0e67b refactor: externalize hardcoded model config and clean up robustness plan
- Add openai_model, tts_minimax_model, tts_elevenlabs_model, tts_edge_voice,
  antigravity_model to Settings; set image_model default to nano-banana-pro
- Update provider_router._get_default_config to read from settings
- Add nul to .gitignore (Windows artifact)
- Mark all robustness tasks as completed in dev-plan.md
2026-03-09 16:54:58 +08:00

50 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# DreamWeaver 工程鲁棒性改进计划
## 概述
本计划旨在提升 DreamWeaver 项目的工程质量,包括测试覆盖、稳定性、可观测性等方面。
## 任务列表
### P0 - 关键问题修复
#### Task-1: 修复 Rate Limit 内存泄漏 ✅
- **文件**: `backend/app/api/stories.py`
- **方案**: 已迁移至 Redis 分布式限流,内存泄漏问题不再存在
#### Task-2: 添加核心 API 测试 ✅
- **文件**: `backend/tests/`
- **范围**: test_auth, test_stories, test_profiles, test_universes, test_push_configs, test_reading_events, test_provider_router
### P1 - 稳定性提升
#### Task-3: 添加 API 重试机制 ✅
- **方案**: 所有适配器已使用 `tenacity` 指数退避重试 (gemini, openai, cqtai, antigravity, minimax, elevenlabs)
#### Task-4: 添加结构化日志 ✅
- **文件**: `backend/app/core/logging.py`
- **方案**: structlog JSON/Console 双模式,所有适配器和 provider_router 已集成
### P2 - 代码优化
#### Task-5: 重构 Provider Router ✅
- **文件**: `backend/app/services/provider_router.py`
- **方案**: 已实现统一 `_route_with_failover` 函数
#### Task-6: 配置外部化 ✅
- **文件**: `backend/app/core/config.py`, `backend/app/services/provider_router.py`
- **方案**: 所有模型名已移至 Settings支持环境变量覆盖
#### Task-7: 修复脆弱的 URL 解析 ✅
- **状态**: `drawing.py` 已被适配器系统取代,不再存在
## 新增依赖 (已添加)
```toml
# pyproject.toml [project.dependencies]
cachetools>=5.0.0 # Task-1: TTL cache
tenacity>=8.0.0 # Task-3: 重试机制
structlog>=24.0.0 # Task-4: 结构化日志
# [project.optional-dependencies.dev]
pytest-cov>=4.0.0 # Task-2: 覆盖率报告
```