shangfangjian
|
1219b4fd18
|
fix: alembic version_num 长度修复 + 前端部署配置
- env.py: 自动创建 alembic_version 表时使用 VARCHAR(255) 避免截断
- docker-compose: 添加 frontend nginx 服务 + alembic 挂载
- nginx.conf: SPA 路由 + API 代理
|
2026-09-17 01:26:58 +08:00 |
|
shangfangjian
|
312778d995
|
feat: 数据管线架构优化 + 前端部署配置
- Bronze 层 RawEvent 表(原始事件存档)
- IngestFailure 死信表(失败持久化+重试)
- DataQualityCheck 数据质量监控
- DataLineage 血缘追踪
- MatchStats xG 追踪字段
- Nginx 前端服务配置
|
2026-09-17 01:15:51 +08:00 |
|
shangfangjian
|
ff0045ad93
|
fix: 数据库与数据管线 6 个 P1 + 5 个 P2 审查问题修复
P1-1 [context_builder] build_context 共享 session,切片函数传 db 参数,
回测 20 场并发连接需求从 100+ 降至每场 1 个
P1-2 [bzzoiro] 预加载改为按 raw_events 日期范围 ±30 天按需加载
P1-3 [understat] 批量查询球队 + 比赛,从 1140 次往返降到 3 次
P1-4 [injuries] 批量幂等检查 + 分批 flush,IntegrityError 逐条回退
P1-5 [predict] 删除 threading.Lock,dict 操作原子无需同步锁
P1-6 [models] 添加 (match_id, provider, model) 唯一约束 + 迁移
P2-1 [unit_of_work] get_uow 返回类型改为 AsyncIterator[AsyncSession]
P2-2 [normalize] _parse_date 失败时记录 warning 避免静默丢数据
P2-3 [repositories] find_by_teams_and_date 改用 match_date_date 等值匹配
P2-4 [migration] 幽灵列 cutoff_at 已在 0006 迁移删除(已有)
P2-5 [migration] injuries 约束命名对齐 ORM,UniqueConstraint → 唯一索引
|
2026-09-16 03:09:39 +08:00 |
|
shangfangjian
|
983b620659
|
refactor: fix P0/P1/P2 security and performance issues
P0 fixes:
- CORS: replace wildcard methods/headers with configurable lists
- deps.py: remove unsafe global _warned_unset variable
P1 fixes:
- http_client: read default timeout from Settings
- bzzoiro: replace sync urllib with async httpx
- bzzoiro: normalize validation failures use warning level only
- db pool: read pool config from Settings (default 5+10)
- backtest: add asyncio.Semaphore(8) for concurrent execution
- predict/context_builder: add backtest parameter for cutoff buffer
P2 improvements:
- injuries: enforce int conversion for player_id/fixture_id
- injuries: use system temp dir for cache
- utils.py: extract shared actual_1x2/is_correct_1x2
- validation: downgrade 1x2 mismatch log to debug
- docker-compose: use env vars for all credentials
- .env.example: add POSTGRES_USER/PASSWORD/PORT, API_PORT
|
2026-09-16 02:38:25 +08:00 |
|
shangfangjian
|
fa69795d69
|
fix: 应用代码审查三项发现
- frontend: .tab 补 position:relative,修复激活 tab 下划线定位缺失定位上下文
- core/retry.py: 删除全项目零调用的重试模块(避免"看似生效实际未接入"的误判)
- llm/validation.py: KNOWN_AGENT_NAMES 改为从 orchestrator.SPECIALIST_SPECS 派生,单一权威源
|
2026-09-15 20:12:47 +08:00 |
|
shangfangjian
|
60e4b89822
|
docs: 统一文档与代码一致性
- 修复所有 confidence → subjective_confidence 残留(03-api, 04-agents, 05-data, 07-development)
- 修复 5 张表 → 6 张表残留(06-deployment)
- 同步 API schema 示例与实际模型一致
- 更新 predictions 表结构文档(新增 status/cutoff/input_hash 字段)
code: 修复 API 异常处理(eval/predict)和 context_builder stats 时间过滤
|
2026-09-15 02:27:48 +08:00 |
|
shangfangjian
|
0980c2242a
|
feat: P0-02/P0-03/P0-05 数据库时间语义与约束
P0-02: MatchStats 增加 source/source_record_id/retrieved_at/available_at
context_builder 过滤统计数据时检查 available_at <= cutoff
P0-03: Prediction 增加 match_kickoff_at/prediction_created_at/prediction_cutoff_at
明确区分比赛时间/预测创建时间/数据截止时间
P0-05: Prediction 增加 status 字段(success/failed/degraded)
数据库 CHECK 约束
Alembic: 0005_prediction_status_and_stats_provenance
P1-02: injuries as_of 不再截断为 date,保持 datetime 精度
|
2026-09-15 02:04:25 +08:00 |
|
shangfangjian
|
c657e04679
|
docs: 同步文档与实现一致性
- 5 张表 → 6 张表(添加 injuries)
- 同步所有 docs 和 models.py docstring
|
2026-09-15 01:44:49 +08:00 |
|
shangfangjian
|
98e3d07cf5
|
fix: 补充 Alembic 迁移 + bzzoiro 批量优化 + validation 兼容层
- 新增 0004_snapshot_and_constraints.py: 重命名 confidence → subjective_confidence,
新增 cutoff_at/input_hash, 添加 CHECK 约束
- bzzoiro.py: 预加载完整 Match 对象到内存,更新路径不再重复查询
- validation.py: 旧字段 confidence 兼容并打 deprecation 日志
|
2026-09-15 01:42:52 +08:00 |
|
shangfangjian
|
2c205c68b1
|
fix: 修复剩余审查问题
- ingest.py: 异常不再暴露客户端,改为通用错误消息+日志记录
- bzzoiro.py: 修复 normalize 重复调用,改为一次遍历缓存结果
- understat.py: 使用 Repository 替代原始 SQL
|
2026-09-15 01:26:15 +08:00 |
|
shangfangjian
|
53e602b4f6
|
fix: 代码审查问题修复
- unit_of_work.py: 简化为纯 session 上下文管理器,消除 double-close 风险
- validation.py: 移除未使用的 import,简化 _score_to_1x2 逻辑
- repositories.py: 将 func 导入移到模块顶层
- 更新所有 get_uow() 调用点使用新接口(yield session 而非 uow 对象)
|
2026-09-15 01:18:35 +08:00 |
|
shangfangjian
|
74586aa5b7
|
docs: 更新 README 反映当前架构
- 更新架构图(添加分层架构、backtest 端点)
- 更新项目结构(添加 unit_of_work.py、repositories.py、backtest.py)
- 更新核心模块表
- 添加数据正确性保障章节
- 修正表数量(6 张表)
- confidence → subjective_confidence
|
2026-09-15 00:48:43 +08:00 |
|
shangfangjian
|
483cb956ba
|
refactor: Sprint 3 - 引入 UnitOfWork + Repository 架构
新增:
- src/db/unit_of_work.py: UnitOfWork 事务封装
- src/db/repositories.py: Match/Team/League/Prediction Repository
重构:
- 删除 src/data/match_lookup.py(由 Repository 替代)
- 数据源(bzzoiro/understat/injuries)不再自行 commit
- API 路由(ingest)改用 UnitOfWork
- LLM 服务(predict/orchestrator/eval/backtest)改用 UnitOfWork
事务边界统一由调用方控制,数据层不再自行决定 commit。
|
2026-09-15 00:42:05 +08:00 |
|
shangfangjian
|
cb36dc3ef9
|
feat: Sprint 2 - 概率语义 + 轻量快照 + 数据库约束
P0-05: confidence → subjective_confidence 改名(15 文件)
LLM 主观置信度与概率分离
P0-02: predictions 增加 cutoff_at + input_hash(轻量快照)
MatchContext 暴露 match_dt
单/多 Agent 路径均记录快照元数据
P2-05: 数据库 CHECK 约束
- pred_home_goals >= 0
- pred_away_goals >= 0
- subjective_confidence 0~1
- pred_1x2 IN (1,X,2)
- mode IN (single,multi)
P2-06: limit 分页约束(ge=1, le=200)
P2-01: 新增 /health/ready 就绪检查
|
2026-09-15 00:14:24 +08:00 |
|
shangfangjian
|
f3160e3062
|
feat: Sprint 1 - 数据正确性整改
P2-01: 移除 lifespan create_all,改为仅验证连接
新增 /health/ready 就绪检查
P0-04: LLM 输出严格 Pydantic 校验
- Agent 输出越界/非法 → parse_error
- 预测输出自动修正 1X2 与比分一致性
P0-01: injuries cutoff 修复
- get_injuries_for_match 增加 as_of 参数
- injuries_slice 使用 as_of 过滤 retrieved_at
- 防止回测时未来采集数据泄漏
P1-12: 批量入库优化
- 预加载 teams 到内存 dict
- 预加载 existing matches 到内存 set
- 消灭 N+1 查询
|
2026-09-14 23:36:35 +08:00 |
|
shangfangjian
|
9b44905192
|
chore: gitignore AI 助手上下文文件
|
2026-09-14 22:09:45 +08:00 |
|
shangfangjian
|
c2b8a37bdd
|
Revert "docs: 建立多 Agent 协同架构"
This reverts commit f50784f9dc.
|
2026-09-14 22:09:28 +08:00 |
|
shangfangjian
|
f50784f9dc
|
docs: 建立多 Agent 协同架构
4 个专业 Agent 协同:
- DBA: 数据库 schema、迁移、模型
- FE: 前端 React 界面
- BE: 后端 API、LLM 预测、数据采集
- Ops: 部署、Docker、配置
详见 docs/AGENTS.md 和各 Agent 上下文文件
|
2026-09-14 21:59:45 +08:00 |
|
shangfangjian
|
3071ffd533
|
feat: 前端 Error Boundary + 体验改进
- 新增 ErrorBoundary 组件: 捕获组件崩溃,显示友好错误页+重试按钮
- App: 用 ErrorBoundary 包裹,标题改为「先知 Profeto」
- Matches 页面:
- 预测模式切换 (单次/多 Agent)
- 加载中动画指示
- 预测中状态提示
- 错误提示可关闭
|
2026-09-09 21:58:57 +08:00 |
|
shangfangjian
|
494751bbb0
|
feat: 数据采集健壮性改进
- 新增 src/core/retry.py: 指数退避 + 抖动的重试装饰器
- bzzoiro: 改进重试逻辑
- 429/5xx/网络错误均触发指数退避重试
- 4xx 直接抛(不重试)
- understat: 新增重试(原无重试)
- injuries: 新增重试 + 文件缓存 7 天过期
- sources.py: 延迟导入修复循环导入
|
2026-09-09 21:47:56 +08:00 |
|
shangfangjian
|
1166a157ec
|
feat: 添加回测框架
- 新增 src/llm/backtest.py: 回测核心逻辑
- 查询历史已完赛比赛
- 逐场预测(自动防未来信息泄漏)
- 实际比分回填 + 统计
- 1X2 准确率 / 比分 RMSE / 置信度校准
- 新增 POST /api/v1/backtest 路由
- 支持按联赛/日期范围/模式/模型筛选
|
2026-09-09 21:39:56 +08:00 |
|
shangfangjian
|
9c24b5f744
|
docs: 移除 MatchPro 对比,加入项目中文名「先知」
|
2026-09-09 02:23:02 +08:00 |
|
shangfangjian
|
d9b1c3aeb5
|
docs: 完善 README 文档
|
2026-09-09 02:17:47 +08:00 |
|
shangfangjian
|
0a27b18c27
|
feat: 足球 LLM 预测服务初始提交
Profeto — 给 LLM 提供数据,让 LLM 预测足球比分。
核心模块:
- FastAPI 后端 + PostgreSQL (SQLAlchemy async)
- 多 Agent LLM 预测 (5 专家 + 终裁)
- 数据采集 (bzzoiro / understat / injuries)
- React 前端 (Vite + Tailwind)
包含:
- 数据源抽象 (DataSource 协议 + 注册表)
- Alembic 数据库迁移
- Prompt 模板 (单/多 Agent)
- 核心路径单元测试
|
2026-09-09 02:10:47 +08:00 |
|