refactor: context_builder 按 slice 拆到 src/llm/slices/ 包
单文件拆分(仅搬迁无逻辑修改): - common.py 共享类型/头信息/_outcome/_is_stats_available - form.py form_slice + _get_form - h2h.py h2h_slice + _get_h2h - stats.py stats_slice(复用 form._get_form) - home_away.py home_away_slice + _get_home_away - standings.py standings_slice - aggregate.py build_context context_builder.py 改为纯 re-export 门面,公开签名不变。 同步修复测试 patch 目标(p0_home_away/h2h_perspective/multi_agent_cutoff) 与 regressions 源码断言(读 slices/*.py)。 全量测试 270 通过。
This commit is contained in:
@@ -101,7 +101,7 @@ class TestFormSliceHomeAwayIdentity:
|
||||
home_name="曼城",
|
||||
away_name="利物浦",
|
||||
)
|
||||
import src.llm.context_builder as cb
|
||||
import src.llm.slices.form as cb
|
||||
orig_get_form = cb._get_form
|
||||
async def mock_get_form(db, team_id, before, *, limit):
|
||||
return [hist_match] if team_id == 1 else []
|
||||
@@ -132,7 +132,7 @@ class TestFormSliceHomeAwayIdentity:
|
||||
home_name="阿森纳",
|
||||
away_name="切尔西",
|
||||
)
|
||||
import src.llm.context_builder as cb
|
||||
import src.llm.slices.form as cb
|
||||
orig_get_form = cb._get_form
|
||||
async def mock_get_form(db, team_id, before, *, limit):
|
||||
return [hist_match] if team_id == 2 else []
|
||||
@@ -169,7 +169,7 @@ class TestStatsSliceHomeAwayIdentity:
|
||||
stats=_make_stats(home_xg=2.5, away_xg=0.8, home_shots=15, away_shots=5,
|
||||
home_sot=6, away_sot=2, home_poss=60.0),
|
||||
)
|
||||
import src.llm.context_builder as cb
|
||||
import src.llm.slices.stats as cb
|
||||
orig_get_form = cb._get_form
|
||||
async def mock_get_form(db, team_id, before, *, limit):
|
||||
return [hist_match] if team_id == 1 else []
|
||||
|
||||
Reference in New Issue
Block a user