Add selectable LLM profiles and treat LAN Ollama as local.
Saved presets keep URL and model per stage so detect can switch to Ollama without re-entering settings or sending plaintext to OpenRouter. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
af6fe55577
commit
bef422a429
20 files changed
+903
-114
No files matched your search
@@ -210,6 +210,30 @@ def test_list_provider_models() -> None:
|
||||
expect(list_provider_models(fake) == [], "fake provider has no catalog")
|
||||
|
||||
|
||||
def test_list_ollama_tags() -> None:
|
||||
reset_catalog()
|
||||
|
||||
def fake_get(url, *args, **kwargs):
|
||||
if str(url).endswith("/api/tags"):
|
||||
return FakeResponse({"models": [{"name": "llama3.1:latest"}, {"name": "qwen2.5:7b"}]})
|
||||
return FakeResponse({"nope": True})
|
||||
|
||||
config = ProviderConfig(
|
||||
role="detect",
|
||||
name="ollama",
|
||||
mode="http",
|
||||
url="http://192.168.2.144:11434/v1/chat/completions",
|
||||
model="llama3.1:latest",
|
||||
key="",
|
||||
local=True,
|
||||
zdr=True,
|
||||
no_train=True,
|
||||
)
|
||||
with patch("model_catalog.httpx.get", fake_get):
|
||||
items = list_provider_models(config)
|
||||
expect([item["id"] for item in items] == ["llama3.1:latest", "qwen2.5:7b"], "ollama tags fill the picker")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
test_reads_context_and_completion()
|
||||
test_model_not_in_catalog()
|
||||
@@ -217,6 +241,7 @@ def main() -> None:
|
||||
test_cache_hit_and_ttl_expiry()
|
||||
test_env_fallback_and_fail_closed()
|
||||
test_list_provider_models()
|
||||
test_list_ollama_tags()
|
||||
print("model catalog tests passed.")
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user