feat(v3): Web 应用化基线(异步任务/SSE/llama-server 管理/Vue SPA 四页 + 设置页整页滚动修复)

This commit is contained in:
tzt
2026-09-01 08:31:47 +08:00
parent 8d36eeec59
commit 3bbdcb7cc7
60 changed files with 7236 additions and 1160 deletions
+24 -7
View File
@@ -41,14 +41,30 @@ def test_chat_legacy(client):
def test_chat_v2(v2_client):
# POST /chat 立即返回 request_id(异步协议)
resp = v2_client.post("/chat", json={"query": "请介绍快速排序算法"})
assert resp.status_code == 200
data = resp.json()
assert data["response"]
assert data["request_id"]
assert "fast_path" in data
assert "route" in data
assert data["status"] in ("fast_path", "done", "escalated", "failed")
assert "request_id" in data
assert data["status"] == "pending"
# 轮询 /runs/{id}/status 直到完成
import time
for _ in range(50): # 最多 5s
time.sleep(0.1)
status_resp = v2_client.get(f"/runs/{data['request_id']}/status")
assert status_resp.status_code == 200
s = status_resp.json()
if s["status"] in ("done", "failed"):
break
assert s["status"] == "done", f"期望 done,实际 {s['status']}error={s.get('error')}"
assert s["response"]
assert "pipeline_status" in s
assert s["pipeline_status"] in ("fast_path", "done", "escalated")
# fast_path 不写 workspace.json,所以 workspace_path 可能为 None
if s["pipeline_status"] != "fast_path":
assert s["workspace_path"] is not None
def test_chat_empty_query(client):
@@ -93,8 +109,9 @@ def test_web_ui_served(client):
resp = client.get("/")
assert resp.status_code == 200
assert resp.headers["content-type"].startswith("text/html")
assert "端云协同" in resp.text
assert "发送" in resp.text
# Vue SPA:由 Vite 生成,特征是 <div id="app"> 和 /static/assets/ 引用
assert '<div id="app">' in resp.text
assert '/static/assets/' in resp.text
def test_review_flow(client):