mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-03 02:11:48 +00:00
feat(cli): add native /model picker modal for provider → model selection
When /model is called with no arguments in the interactive CLI, open a two-step prompt_toolkit modal instead of the previous text-only listing: 1. Provider selection — curses_single_select with all authenticated providers 2. Model selection — live API fetch with curated fallback Also fixes: - OpenAI Codex model normalization (openai/gpt-5.4 → gpt-5.4) - Dedicated Codex validation path using provider_model_ids() Preserves curses_radiolist (used by setup, tools, plugins) alongside the new curses_single_select. Retains tool elapsed timer in spinner. Cherry-picked from PR #7438 by MestreY0d4-Uninter.
This commit is contained in:
parent
39cd57083a
commit
06f862fa1b
5 changed files with 831 additions and 58 deletions
|
|
@ -1809,6 +1809,35 @@ def validate_requested_model(
|
|||
"message": message,
|
||||
}
|
||||
|
||||
# OpenAI Codex has its own catalog path; /v1/models probing is not the right validation path.
|
||||
if normalized == "openai-codex":
|
||||
try:
|
||||
codex_models = provider_model_ids("openai-codex")
|
||||
except Exception:
|
||||
codex_models = []
|
||||
if codex_models:
|
||||
if requested_for_lookup in set(codex_models):
|
||||
return {
|
||||
"accepted": True,
|
||||
"persist": True,
|
||||
"recognized": True,
|
||||
"message": None,
|
||||
}
|
||||
suggestions = get_close_matches(requested_for_lookup, codex_models, n=3, cutoff=0.5)
|
||||
suggestion_text = ""
|
||||
if suggestions:
|
||||
suggestion_text = "\n Similar models: " + ", ".join(f"`{s}`" for s in suggestions)
|
||||
return {
|
||||
"accepted": True,
|
||||
"persist": True,
|
||||
"recognized": False,
|
||||
"message": (
|
||||
f"Note: `{requested}` was not found in the OpenAI Codex model listing. "
|
||||
f"It may still work if your account has access to it."
|
||||
f"{suggestion_text}"
|
||||
),
|
||||
}
|
||||
|
||||
# Probe the live API to check if the model actually exists
|
||||
api_models = fetch_api_models(api_key, base_url)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue