fix(model): clear stale endpoint credentials across switches

This commit is contained in:
helix4u 2026-06-19 20:36:09 -06:00 committed by Teknium
parent 95a3affc2e
commit c253b07380
9 changed files with 187 additions and 17 deletions

View file

@ -34,7 +34,7 @@ from agent.i18n import t
from gateway.config import HomeChannel, Platform, PlatformConfig
from gateway.platforms.base import EphemeralReply, MessageEvent, MessageType
from gateway.session import SessionSource, build_session_key
from hermes_cli.config import cfg_get
from hermes_cli.config import cfg_get, clear_model_endpoint_credentials
from utils import (
atomic_json_write,
atomic_yaml_write,
@ -1239,6 +1239,8 @@ class GatewaySlashCommandsMixin:
_persist_model_cfg["provider"] = result.target_provider
if result.base_url:
_persist_model_cfg["base_url"] = result.base_url
if str(result.target_provider or "").strip().lower() != "custom":
clear_model_endpoint_credentials(_persist_model_cfg)
from hermes_cli.config import save_config
save_config(_persist_cfg)
except Exception as e:
@ -1429,6 +1431,8 @@ class GatewaySlashCommandsMixin:
model_cfg["provider"] = result.target_provider
if result.base_url:
model_cfg["base_url"] = result.base_url
if str(result.target_provider or "").strip().lower() != "custom":
clear_model_endpoint_credentials(model_cfg)
from hermes_cli.config import save_config
save_config(cfg)
except Exception as e: