orchestrator: 全专家失败时不调用 aggregator provider

This commit is contained in:
Profeto Agent
2026-09-19 08:42:09 +00:00
parent 6c24672e87
commit c0bcf1d851
2 changed files with 60 additions and 2 deletions
+6 -2
View File
@@ -259,7 +259,8 @@ async def predict_match_multi(
"match %s: 所有 %d 位专家均无有效数据,跳过终裁,标记 degraded",
match_id, len(reports),
)
aggregator_provider = await _agent_provider("aggregator", tier="aggregator")
# 无有效专家时不调用 aggregator provider,避免多余开销
# model 使用 settings 默认值占位(无实际 LLM 调用)
final = {
"pred_home_goals": None,
"pred_away_goals": None,
@@ -272,6 +273,7 @@ async def predict_match_multi(
}
agg_prompt_tokens = 0
agg_completion_tokens = 0
aggregator_model = settings.LLM_MODEL # 占位,无实际 LLM 调用
latency_ms = int((time.perf_counter() - start) * 1000)
@@ -297,17 +299,19 @@ async def predict_match_multi(
raise RuntimeError(f"终裁输出校验失败: {e}")
agent_weights = validate_agent_weights(final.get("agent_weights"))
pred_status = "success"
model_name = aggregator_provider.model
else:
# 无有效报告:跳过严格校验,直接构造降级结果
validated = None # type: ignore
agent_weights = {}
pred_status = "degraded"
model_name = aggregator_model
pred = await _upsert_prediction(
session,
match_id=match_id,
provider_name=settings.LLM_PROVIDER,
model=aggregator_provider.model,
model=model_name,
mode="multi",
run_type="backtest" if backtest else "live",
values={