From 00684403887745e35848bbbab5ac795cfdd6fd58 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 3 May 2026 23:03:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(failover):=20Gemini=20=E6=B0=B8=E9=81=A0?= =?UTF-8?q?=E9=99=84=E5=9C=A8=20Ollama=20fallback=20=E9=8F=88=E5=B0=BE?= =?UTF-8?q?=EF=BC=88ADR-110=20=E6=BC=8F=E5=8A=A0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- apps/api/src/services/ollama_failover_manager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/api/src/services/ollama_failover_manager.py b/apps/api/src/services/ollama_failover_manager.py index f09a8557..dc0e7c86 100644 --- a/apps/api/src/services/ollama_failover_manager.py +++ b/apps/api/src/services/ollama_failover_manager.py @@ -316,22 +316,22 @@ class OllamaFailoverManager: now_ts = datetime.datetime.now(TAIPEI_TZ).isoformat() - # GCP-A 健康 → 主 GCP-A + # GCP-A 健康 → 主 GCP-A,Gemini 永遠在 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-B,Gemini 在鏈尾 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,