fix(ai): route alerts through openclaw before gemini
All checks were successful
Code Review / ai-code-review (push) Successful in 11s
CD Pipeline / tests (push) Successful in 1m5s
CD Pipeline / build-and-deploy (push) Successful in 3m42s
CD Pipeline / post-deploy-checks (push) Successful in 1m36s

This commit is contained in:
Your Name
2026-05-06 20:11:24 +08:00
parent 572e7640cd
commit 1a1ab0df6e
3 changed files with 80 additions and 13 deletions

View File

@@ -217,7 +217,7 @@ class OpenClawService:
alert_context: dict | None = None,
cloud_provider_order: list[str] | None = None,
) -> list[str]:
"""Resolve GCP-A/GCP-B/111, then Gemini backup, for alert analysis."""
"""Resolve GCP-A/GCP-B/111, then OpenClaw/Nemo before Gemini backup."""
provider_order: list[str] = []
try:
route = await get_ollama_failover_manager().select_provider(task_type=task_type)
@@ -257,11 +257,19 @@ class OpenClawService:
if not self._cloud_fallback_allowed_for_alert(alert_context):
return ordered_ollama
cloud_candidates = cloud_provider_order or []
cloud_backup: list[str] = []
for provider_name in [*cloud_candidates, "gemini"]:
if provider_name == "gemini" and provider_name not in cloud_backup:
cloud_backup.append(provider_name)
cloud_aliases = {"nvidia": "openclaw_nemo"}
cloud_candidates = {
cloud_aliases.get(provider_name, provider_name)
for provider_name in (cloud_provider_order or [])
}
# Gemini remains the final paid backup, but alert traffic should use
# OpenClaw/Nemo first whenever the router control plane has not disabled it.
cloud_candidates.add("gemini")
cloud_backup = [
provider_name
for provider_name in ("openclaw_nemo", "gemini")
if provider_name in cloud_candidates
]
return ordered_ollama + cloud_backup