fix(setup): correct LM Studio loaded state value to "loaded" not "loaded_instance"
Querying the live /api/v0/models endpoint shows LM Studio uses state="loaded" for in-memory models (not "loaded_instance"), so the filter never matched. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -391,7 +391,7 @@ def fetch_loaded_models(provider: Provider) -> list[str]:
|
||||
resp.raise_for_status()
|
||||
return [
|
||||
m["id"] for m in resp.json().get("data", [])
|
||||
if m.get("state") == "loaded_instance"
|
||||
if m.get("state") == "loaded"
|
||||
]
|
||||
else: # llamacpp — /models returns only the active loaded model
|
||||
resp = httpx.get(f"{provider.base_url}/models", timeout=3.0)
|
||||
@@ -427,7 +427,7 @@ def _fetch_local_models(provider: Provider) -> list[str]:
|
||||
resp.raise_for_status()
|
||||
return [
|
||||
m["id"] for m in resp.json().get("data", [])
|
||||
if m.get("state") == "loaded_instance"
|
||||
if m.get("state") == "loaded"
|
||||
]
|
||||
else:
|
||||
resp = httpx.get(f"{provider.base_url}/models", timeout=3.0)
|
||||
|
||||
@@ -101,7 +101,7 @@ def test_fetch_local_models_lmstudio_returns_loaded_model_ids(monkeypatch):
|
||||
mock_resp = MagicMock()
|
||||
mock_resp.json.return_value = {
|
||||
"data": [
|
||||
{"id": "gemma-4b", "state": "loaded_instance"},
|
||||
{"id": "gemma-4b", "state": "loaded"},
|
||||
{"id": "llama3", "state": "not_loaded"},
|
||||
]
|
||||
}
|
||||
@@ -418,7 +418,7 @@ def test_fetch_loaded_models_lmstudio_uses_beta_api_and_filters(monkeypatch):
|
||||
mock_resp = MagicMock()
|
||||
mock_resp.json.return_value = {
|
||||
"data": [
|
||||
{"id": "gemma-4b", "state": "loaded_instance"},
|
||||
{"id": "gemma-4b", "state": "loaded"},
|
||||
{"id": "llama3", "state": "not_loaded"},
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user