fix(failover): Gemini 永遠附在 Ollama fallback 鏈尾(ADR-110 漏加)
All checks were successful
Code Review / ai-code-review (push) Successful in 54s
CD Pipeline / tests (push) Successful in 1m55s
CD Pipeline / build-and-deploy (push) Successful in 41m6s
CD Pipeline / post-deploy-checks (push) Successful in 3m36s

GCP-A HEALTHY → fallback=[GCP-B, Local, Gemini]
GCP-B HEALTHY → fallback=[Local, Gemini]
與舊 111 HEALTHY → fallback=[Gemini] 行為一致,保留雲端最後防線。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Your Name
2026-05-03 23:03:34 +08:00
parent 2409d861fa
commit 0068440388

View File

@@ -316,22 +316,22 @@ class OllamaFailoverManager:
now_ts = datetime.datetime.now(TAIPEI_TZ).isoformat()
# GCP-A 健康 → 主 GCP-A
# GCP-A 健康 → 主 GCP-AGemini 永遠在 Ollama 鏈最後(與舊 111 行為一致)
if health_gcp_a.status == HealthStatus.HEALTHY:
return OllamaRoutingResult(
primary=ep_gcp_a,
fallback_chain=[ep_gcp_b, ep_local],
fallback_chain=[ep_gcp_b, ep_local, _GEMINI_ENDPOINT],
routing_reason="GCP-A HEALTHY → primary GCP-A",
health_gcp_a=health_gcp_a,
health_gcp_b=health_gcp_b,
health_local=health_local,
)
# GCP-A 不健康GCP-B 健康 → 切 GCP-B
# GCP-A 不健康GCP-B 健康 → 切 GCP-BGemini 在鏈尾
if health_gcp_b.status == HealthStatus.HEALTHY:
return OllamaRoutingResult(
primary=ep_gcp_b,
fallback_chain=[ep_local],
fallback_chain=[ep_local, _GEMINI_ENDPOINT],
routing_reason=f"GCP-A {health_gcp_a.status.value} → 切 GCP-B at {now_ts}",
health_gcp_a=health_gcp_a,
health_gcp_b=health_gcp_b,