feat(sense): T-X4 可解释决策留痕三元结构 + 修复 sense live 分流潜伏 bug(采纳 ai-model-router 决策模型)
- store:新增 sense_decisions 表(CREATE IF NOT EXISTS 幂等迁移), insert_decision / list_decisions(JSON 字段反序列化),q_hash 不落原文(D-G6) - grader:全模式落库决策三元——reasons(§8 判定顺序最小完备集)、 candidate_scores(线性头 probs)、rejected(落选档位+原因); 留痕失败静默不影响决策主链路 - 修复:chat_completions 的 sense 分流引用未导入的 settings_store,NameError 被 except 吞掉导致 D-G7 live 分流从未生效;改为 build_proxy_router 显式注入 settings_provider(api.py 传 settings_store),缺省 None 行为安全 - 新增 /proxy/admin/sense-decisions 管理面查询端点(sense 未启用返回空集) - 回归测试:注入 settings_provider 后 x-campus-tier 头出现且 T1 决策经 管理面可查(修复前该头永远缺失) pytest 466 passed(T-X6 后 461 + 5)
This commit is contained in:
+2
-1
@@ -208,7 +208,8 @@ try:
|
||||
from gateway.proxy.config import build_proxy_config
|
||||
_proxy_cfg = build_proxy_config(settings_store().to_dict())
|
||||
if _proxy_cfg.enabled:
|
||||
app.include_router(build_proxy_router(_proxy_cfg, get_pool()))
|
||||
app.include_router(build_proxy_router(_proxy_cfg, get_pool(),
|
||||
settings_provider=settings_store))
|
||||
from gateway.proxy.routes import install_error_handlers
|
||||
install_error_handlers(app)
|
||||
except Exception as _pe: # pragma: no cover - 代理层装配失败不拖垮主应用
|
||||
|
||||
Reference in New Issue
Block a user