Add data-driven AI predictions via API-Football
- football_data.py: 수집·캐싱·데이터블록 조립 (48팀 ID/FIFA랭킹) - FootballCache 테이블: 폼·H2H·스쿼드 캐시 (외부 DB) - 프롬프트에 랭킹·폼·H2H·스쿼드·WC실제결과 주입 - 키 없으면 기존(이름만) 동작 폴백, 무료 한도 점진 수집
This commit is contained in:
1 parent
356706e1b4
commit
4246ad6936
6 files changed
+378
No files matched your search
@@ -30,6 +30,7 @@ class MatchContext:
|
||||
team_b: str
|
||||
venue: str
|
||||
kickoff: str # ISO
|
||||
data_block: str | None = None # 실데이터(폼·H2H·랭킹·WC결과) 주입 블록. 없으면 이름만.
|
||||
|
||||
|
||||
# 모델별 분석 관점(페르소나) — 동일 경기라도 서로 다른 시각으로 보게 해
|
||||
@@ -54,6 +55,8 @@ PERSONA = {
|
||||
|
||||
|
||||
def _prompt(ctx: MatchContext, persona: str) -> str:
|
||||
# 실데이터 블록이 있으면 팀/킥오프 다음에 삽입(없으면 빈 문자열 — 기존 동작 동일).
|
||||
data = f"\n{ctx.data_block}\n" if ctx.data_block else ""
|
||||
return (
|
||||
f"{persona}\n"
|
||||
f"Predict the result of this 2026 FIFA World Cup match using YOUR perspective "
|
||||
@@ -61,6 +64,7 @@ def _prompt(ctx: MatchContext, persona: str) -> str:
|
||||
f"pick when your perspective warrants it.\n"
|
||||
f"Team A: {ctx.team_a}\nTeam B: {ctx.team_b}\n"
|
||||
f"Venue: {ctx.venue}\nKickoff: {ctx.kickoff}\n"
|
||||
f"{data}"
|
||||
f"Important: World Cup group-stage matches are played at NEUTRAL venues. "
|
||||
f"Neither team has home advantage unless it is a host nation "
|
||||
f"(Mexico, USA, or Canada). Do NOT claim home advantage otherwise.\n\n"
|
||||
|
||||
Reference in new issue
Block a user