fix(model-picker): hydrate truncated provider model lists#27914
Conversation
d1ef773 to
920e633
Compare
|
Thanks for the focused fix — I verified the classic prompt_toolkit CLI bug is still present on current main. Problems
Suggested changes
The current CLI premise is real: Automated hermes-sweeper review. |
|
Fixed on This was one of several PRs targeting the same picker cap. We merged @islam666's #48297 as the implementation (cleanest scope — it correctly keeps the Telegram/Discord inline-keyboard cap, which genuinely needs a bound) plus a follow-up tightening |
Summary
Fix two related interactive CLI
/modelpicker issues that show up with providers exposing more models than the top-level picker embeds (for example LiteLLM Proxy showing134 models):Hydrate truncated provider model lists on selection.
build_models_payload(ctx, max_models=50)intentionally keeps provider rows small by including only the first 50 model IDs while preserving the full count intotal_models. The top-level picker therefore correctly shows providers likeLiteLLM Proxy (134 models), but the second-stage picker reused the truncatedprovider_data["models"]list directly and only fetched live models when that list was empty. The result was that users could only select the first 50 models even though the provider advertised many more.This changes provider selection to call
provider_model_ids(provider_slug)whentotal_models > len(models), while preserving the existing behavior for complete curated lists.Preserve model row indentation for long slash-delimited model IDs.
textwrap.wrap()drops leading whitespace by default. Passing a row as" " + model_idcan strip the two-space indent for a long unbroken model ID near the wrap boundary, rendering│ modelinstead of│ model. The picker now wraps the raw model ID and adds the selection/indent prefix afterwards so row alignment stays stable.Tests
PYTHONPATH=. venv/bin/python3 -m pytest tests/hermes_cli/test_cli_model_picker.py -q -o 'addopts='PYTHONPATH=. venv/bin/python3 -m pytest tests/test_tui_gateway_server.py::test_model_options_does_not_overwrite_curated_models -q -o 'addopts='PYTHONPATH=. venv/bin/python3 -m py_compile cli.py