mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-03 02:11:48 +00:00
fix(tui): address code review feedback on model picker
- Reset keySaving on back() to prevent blocked key entry after Esc - Show '(needs setup)' for non-API-key auth providers instead of generic '(no key)' - Set is_current correctly for unauthenticated providers that happen to be the active session provider - Guard model.save_key with is_managed() check — return error on managed installs where .env is read-only
This commit is contained in:
parent
f4c761c6a0
commit
c8e506c383
2 changed files with 9 additions and 3 deletions
|
|
@ -4758,7 +4758,7 @@ def _(rid, params: dict) -> dict:
|
|||
authenticated.append({
|
||||
"slug": entry.slug,
|
||||
"name": _PROVIDER_LABELS.get(entry.slug, entry.label),
|
||||
"is_current": False,
|
||||
"is_current": entry.slug == current_provider,
|
||||
"is_user_defined": False,
|
||||
"models": [],
|
||||
"total_models": 0,
|
||||
|
|
@ -4794,7 +4794,7 @@ def _(rid, params: dict) -> dict:
|
|||
"""
|
||||
try:
|
||||
from hermes_cli.auth import PROVIDER_REGISTRY
|
||||
from hermes_cli.config import save_env_value
|
||||
from hermes_cli.config import is_managed, save_env_value
|
||||
from hermes_cli.model_switch import list_authenticated_providers
|
||||
|
||||
slug = (params.get("slug") or "").strip()
|
||||
|
|
@ -4802,6 +4802,9 @@ def _(rid, params: dict) -> dict:
|
|||
if not slug or not api_key:
|
||||
return _err(rid, 4001, "slug and api_key are required")
|
||||
|
||||
if is_managed():
|
||||
return _err(rid, 4006, "managed install — credentials are read-only")
|
||||
|
||||
pconfig = PROVIDER_REGISTRY.get(slug)
|
||||
if not pconfig:
|
||||
return _err(rid, 4002, f"unknown provider: {slug}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue