fix(hub): render AI coach summary and chat as Markdown

Reuse shared ai_review_render.js so summaries and coach replies display formatted lists and bold text instead of raw syntax.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-07 00:23:44 +08:00
parent 821e260912
commit 8417784dd8
4 changed files with 110 additions and 14 deletions
+15
View File
@@ -234,6 +234,21 @@ async def _hub_lifespan(_app: FastAPI):
app = FastAPI(title="复盘系统中控", docs_url=None, redoc_url=None, lifespan=_hub_lifespan)
STATIC_DIR = DIR / "static"
_REPO_STATIC = _REPO_ROOT / "static"
_AI_REVIEW_RENDER_JS = _REPO_STATIC / "ai_review_render.js"
@app.get("/assets/ai_review_render.js")
def hub_ai_review_render_js():
"""与四所实例共用仓库根 static/ai_review_render.js(须在 /assets mount 之前注册)。"""
if not _AI_REVIEW_RENDER_JS.is_file():
raise HTTPException(status_code=404, detail="ai_review_render.js not found")
return FileResponse(
str(_AI_REVIEW_RENDER_JS),
media_type="application/javascript; charset=utf-8",
)
if STATIC_DIR.is_dir():
app.mount("/assets", StaticFiles(directory=str(STATIC_DIR)), name="assets")