opencode: offer one model, not a menu where four of five fail
Only one model is loaded at a time, so listing every model that fits gave a picker with one working entry and four that now answer 404 -- and the entry that worked changed id on every `llmhost switch`, invalidating any client's saved default. Replace the list with a single entry, `default`, which is a name the API itself answers to: vLLM takes it as a second --served-model-name and still reports the real slug, being first in the list; the MLX proxy accepts it as an alias. So `llmhost/default` survives a switch. The local entry is labelled with whatever is loaded, refreshed by both switch paths; a remote block is pasted once and never refreshed, so it names no model rather than make a claim that goes stale. Existing configs point at a specific model, which this provider no longer has and opencode would reject, so configure() and sync() migrate `<prov>/<model>` to `<prov>/default`. Other providers' defaults are untouched, and an older remote block that still lists many models keeps working, including as the fallback when the local provider is removed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
51c2880a2e
commit
9af7f1e545
6 changed files with 124 additions and 50 deletions
|
|
@ -120,7 +120,7 @@ def catalog_entry(catalog, name):
|
|||
def vllm_args(entry, choice, port, tp):
|
||||
"""Arguments after `vllm serve`."""
|
||||
v = entry.get("vllm", {})
|
||||
args = [choice["repo"], "--served-model-name", entry["name"],
|
||||
args = [choice["repo"], "--served-model-name", entry["name"], SERVED_ALIAS,
|
||||
"--host", "0.0.0.0", "--port", str(port),
|
||||
"--max-model-len", "-1", # let vLLM fit the context to free memory (capped at native)
|
||||
"--gpu-memory-utilization", f"{choice['util']:.2f}",
|
||||
|
|
@ -162,6 +162,14 @@ def mlx_args(entry, choice, port):
|
|||
return args
|
||||
|
||||
|
||||
# A second name the API answers to, besides the model's own. opencode (and any client
|
||||
# with a saved default) points at this instead of a specific model, so the choice keeps
|
||||
# working after `llmhost switch` -- only one model is loaded at a time, so naming one in
|
||||
# a client config only ever goes stale. vLLM takes it as a second --served-model-name and
|
||||
# still reports the real slug, being the first; the MLX proxy accepts it as an alias.
|
||||
SERVED_ALIAS = "default"
|
||||
|
||||
|
||||
# ---- reasoning effort -------------------------------------------------------------
|
||||
# Not a backend flag: it's a chat-template kwarg, read per request. "default" means send
|
||||
# nothing and let the template decide; "off" suppresses thinking; anything else is an
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue