feat(ai): commandes @/ & skills, analyse d'images et capacites des modeles (#81)
This commit is contained in:
@@ -256,6 +256,37 @@ class TestListModelsEndpoint:
|
||||
assert hdrs["api-key"] == "fake-xiaomi-key"
|
||||
assert "authorization" not in hdrs, f"Authorization leaked: {hdrs!r}"
|
||||
|
||||
def test_models_include_capabilities(self, admin_client, monkeypatch):
|
||||
"""The model list must expose per-model capability flags (#81)."""
|
||||
from backend import ai as aimod
|
||||
monkeypatch.setattr(aimod, "get_ai_key", lambda name: None)
|
||||
|
||||
token = _login_admin(admin_client)
|
||||
resp = admin_client.get(
|
||||
"/api/config/ai-models",
|
||||
params={"provider": "qwencloud"},
|
||||
headers={"Authorization": f"Bearer {token}"},
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
caps = data.get("capabilities") or {}
|
||||
assert "qwen-vl-max" in caps
|
||||
assert caps["qwen-vl-max"]["vision"] is True
|
||||
|
||||
def test_model_capabilities_endpoint(self, admin_client):
|
||||
"""GET /api/ai/model-capabilities returns the curated flags."""
|
||||
token = _login_admin(admin_client)
|
||||
resp = admin_client.get(
|
||||
"/api/ai/model-capabilities",
|
||||
params={"provider": "deepseek", "model": "deepseek-chat"},
|
||||
headers={"Authorization": f"Bearer {token}"},
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert data["provider"] == "deepseek"
|
||||
assert data["capabilities"]["chat"] is True
|
||||
assert data["capabilities"]["vision"] is False
|
||||
|
||||
def test_xiaomi_test_endpoint_uses_real_url(self, admin_client, monkeypatch):
|
||||
"""The /api/config/ai-keys/test endpoint must also use api.xiaomimimo.com.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user