feat(v2): Web 界面(对话/协作过程/人工检验/指标)+ worker 优雅降级

This commit is contained in:
tzt
2026-08-30 21:26:16 +08:00
parent 0ec7a9d034
commit 5ba3cc778b
5 changed files with 202 additions and 10 deletions
+10
View File
@@ -107,6 +107,9 @@ class HealthResponse(BaseModel):
# ---- FastAPI 应用 ----
try:
from fastapi import FastAPI, HTTPException
from fastapi.responses import HTMLResponse
_INDEX_PATH = Path(__file__).resolve().parent / "static" / "index.html"
app = FastAPI(
title="端云协同 LLM 协作系统",
@@ -118,6 +121,13 @@ try:
async def health():
return get_router().health()
@app.get("/", response_class=HTMLResponse, tags=["ui"])
async def index():
"""端云协同 Web 界面(单文件前端,无需构建)。"""
if _INDEX_PATH.exists():
return HTMLResponse(_INDEX_PATH.read_text(encoding="utf-8"))
return HTMLResponse("<h1>Web 界面未生成</h1><p>缺少 gateway/static/index.html</p>")
# ---------------- v2/chat ----------------
@app.post("/chat", tags=["chat"])
async def chat(req: QueryRequest):