feat: 足球 LLM 预测服务初始提交
Profeto — 给 LLM 提供数据,让 LLM 预测足球比分。 核心模块: - FastAPI 后端 + PostgreSQL (SQLAlchemy async) - 多 Agent LLM 预测 (5 专家 + 终裁) - 数据采集 (bzzoiro / understat / injuries) - React 前端 (Vite + Tailwind) 包含: - 数据源抽象 (DataSource 协议 + 注册表) - Alembic 数据库迁移 - Prompt 模板 (单/多 Agent) - 核心路径单元测试
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
"""检查 injuries 数据源 api-football 的响应结构。"""
|
||||
API_FOOTBALL_INJURY_RESPONSE_EXAMPLE = """
|
||||
{
|
||||
"response": [
|
||||
{
|
||||
"player": {
|
||||
"id": 12345,
|
||||
"name": "Bukayo Saka",
|
||||
"photo": "https://...",
|
||||
"type": "Missing Fixture"
|
||||
},
|
||||
"team": {"id": 42, "name": "Arsenal"},
|
||||
"fixture": {"id": 100000, "date": "2026-09-15T19:00:00+00:00"},
|
||||
"league": {"id": 39, "name": "Premier League"},
|
||||
"reason": "Hamstring Injury",
|
||||
"type": "Missing Fixture"
|
||||
}
|
||||
]
|
||||
}
|
||||
"""
|
||||
|
||||
"""
|
||||
injuries 表设计:
|
||||
|
||||
CREATE TABLE injuries (
|
||||
id SERIAL PRIMARY KEY,
|
||||
player_id INT, -- api-football 球员 ID
|
||||
player_name VARCHAR(120) NOT NULL, -- 球员名
|
||||
team_id INT REFERENCES teams(id), -- 关联球队(按名归一后匹配)
|
||||
fixture_id INT, -- api-football 比赛 ID(无法直接关联 matches.id)
|
||||
league_id INT,
|
||||
injury_type VARCHAR(50), -- 'Missing Fixture' / 'Suspended'
|
||||
reason VARCHAR(200), -- 伤停原因(如 'Hamstring Injury')
|
||||
injury_date DATE, -- 伤停日期
|
||||
return_date DATE, -- 预计回归日期(如有)
|
||||
retrieved_at TIMESTAMPTZ DEFAULT now(),
|
||||
UNIQUE(player_id, fixture_id, injury_type) -- 幂等
|
||||
);
|
||||
|
||||
-- 查询某队某场比赛的伤停:
|
||||
SELECT player_name, injury_type, reason
|
||||
FROM injuries
|
||||
WHERE team_id = :team_id
|
||||
AND injury_date <= :match_date
|
||||
AND (return_date IS NULL OR return_date >= :match_date);
|
||||
"""
|
||||
Reference in New Issue
Block a user