feat: 多专业小模型+路由模型系统 MVP(mock 全链路 + FastAPI 网关 + 论文调研)

This commit is contained in:
tzt
2026-08-12 10:40:04 +08:00
commit 1e51167ea5
50 changed files with 49382 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
"""???????? fastapi + httpx??"""
import pytest
pytest.importorskip("fastapi")
pytest.importorskip("httpx")
from fastapi.testclient import TestClient
from gateway.api import app
@pytest.fixture()
def client():
return TestClient(app)
def test_health(client):
resp = client.get("/health")
assert resp.status_code == 200
data = resp.json()
assert data["status"] == "ok"
assert "code" in data["domains"]
def test_chat(client):
resp = client.post("/chat", json={"query": "? Python ???????"})
assert resp.status_code == 200
data = resp.json()
assert data["response"]
assert data["domain"] == "code"
assert "route" in data
def test_chat_empty_query(client):
resp = client.post("/chat", json={"query": ""})
assert resp.status_code == 422
def test_metrics(client):
resp = client.get("/metrics")
assert resp.status_code == 200
data = resp.json()
assert "router" in data
assert "cache" in data