Skip to content

Auto-detect models in /local add - #31

Merged
Revantark merged 5 commits into
Revantark:mainfrom
abdulsaheel:main
Oct 5, 2026
Merged

Revantark merged 5 commits into
Revantark:mainfrom
abdulsaheel:main

Conversation

@abdulsaheel

Copy link
Copy Markdown
Contributor

/local add now hits {url}/models when you land on Model ID and opens a searchable picker of what the server serves. Works with anything OpenAI-compatible (CLIProxyAPI, Ollama, LM Studio, vLLM, llama.cpp).

If detection fails it says why and falls back to typing:

  • HTTP 401 Unauthorized / HTTP 404 Not Found (e.g. URL missing /v1)
  • could not connect, timed out (10s), invalid URL

Other changes:

  • Fields reordered: URL, API, API Key, Model ID.
  • Enter with an empty model jumps to Model ID instead of erroring the form closed.
  • Esc out of the picker leaves a N found, Enter to pick hint; Enter reopens it. Custom ids still typeable.
  • Fixing url/key and tabbing back re-detects; stale in-flight results are dropped.
  • Edit mode doesn't auto-detect (model id is the entry key).
  • API Key placeholder says optional.

Tested against a live CLIProxyAPI: picked a model, saved, chatted through it. Unit tests cover parsing, auth header, HTTP errors, unreachable and invalid URLs.

Unrelated, already on main: Shift+Tab doesn't move focus in this form, the global keymap eats it as mode toggle.

Fetch {url}/models once url + key are filled and open a searchable
picker. On failure show the reason (HTTP status, could not connect,
timed out, invalid URL) and fall back to typing the id.

Fields reordered to URL, API, API Key, Model ID so detection has what
it needs. Enter on an empty model jumps to the field instead of
erroring the form closed. API Key placeholder now says optional.
@Revantark Revantark self-assigned this Oct 4, 2026
@Revantark

Copy link
Copy Markdown
Owner

Thanks for the PR @abdulsaheel
Looks good to me, But I have one issue, once resolved, it should be good to go.

  1. Once I select a model in the overlay, I can't select another model again. User could have selected a wrong model previously.
    Thinking, maybe we can do something like
    Model ID : ◀ model_name ▶

now those arrows left or right should open the model picker again for selection.

Model ID renders as ◀ id ▶ once the server's model list is detected;
Left/Right reopen the picker so a wrong pick can be changed.
@abdulsaheel

Copy link
Copy Markdown
Contributor Author

Makes sense @Revantark, made the change in accd8f6 . Once the server's model list is detected, Model ID shows as ◀ model ▶ and Left/Right reopen the picker; Esc keeps the current pick.

@Revantark

Copy link
Copy Markdown
Owner

Thanks.

@Revantark
Revantark merged commit edd0c98 into Revantark:main Oct 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants