From 277808758d4b2646eefb6c335a791337308ef2a5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 27 Apr 2026 20:04:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(failover):=20=E8=A3=9C=20OllamaRoutingResul?= =?UTF-8?q?t.health=5F188=20optional=20=E6=AC=84=E4=BD=8D=EF=BC=88merge=20?= =?UTF-8?q?conflict=20=E9=81=BA=E6=BC=8F=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit stash pop 時 --theirs 覆蓋掉了 health_188 dataclass 欄位定義, 導致 to_dict() 拋出 AttributeError(health_188 只在方法內引用)。 補上 health_188: HealthReport | None = None,37 failover tests ✅ Co-Authored-By: Claude Sonnet 4.6 --- apps/api/src/services/ollama_failover_manager.py | 1 + apps/api/tests/test_ai_router_failover_integration.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/services/ollama_failover_manager.py b/apps/api/src/services/ollama_failover_manager.py index c9f531168..b9aa722ce 100644 --- a/apps/api/src/services/ollama_failover_manager.py +++ b/apps/api/src/services/ollama_failover_manager.py @@ -83,6 +83,7 @@ class OllamaRoutingResult: fallback_chain: list[OllamaEndpoint] routing_reason: str health_111: HealthReport + health_188: HealthReport | None = None # optional backward-compat(188 不在路由鏈時為 None) def all_endpoints_in_order(self) -> list[OllamaEndpoint]: """返回完整的優先序端點列表(primary 在前)""" diff --git a/apps/api/tests/test_ai_router_failover_integration.py b/apps/api/tests/test_ai_router_failover_integration.py index 958471314..f1dfc008f 100644 --- a/apps/api/tests/test_ai_router_failover_integration.py +++ b/apps/api/tests/test_ai_router_failover_integration.py @@ -59,7 +59,6 @@ def _make_failover_result( fallback_chain=fb_endpoints, routing_reason=f"test: {primary_provider}", health_111=_make_health(HealthStatus.OFFLINE), - health_188=None, )