feat: 添加 RAG 评估结果展示系统(Web Dashboard)

实现功能完整的 Web 展示系统,支持实时数据读取和版本对比分析。

主要功能:
- 全局概览:8个系统排名、得分卡片、排名图表
- 系统对比:多系统对比、雷达图可视化
- 版本对比:ZHT vs ZHTv2 专项对比(+43.69%整体提升)
- 问题横评:单个问题的多系统得分对比

技术栈:
- 后端:Python + FastAPI + Uvicorn
- 前端:React 18 + TypeScript + Vite + Ant Design + ECharts

核心特性:
- 实时数据读取(无缓存,更新后刷新即可)
- 完整的类型安全(Pydantic + TypeScript)
- 丰富的可视化(ECharts 雷达图、柱状图)
- 自动生成 API 文档(Swagger UI)

版本对比亮点:
- 整体提升:+43.69%
- Context Recall:+86.1% 提升
- 识别改进/退化问题
- 雷达图对比

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
hughhuang(黄健铭)andClaude Sonnet 4.5 committed 2026-01-08 14:22:36 +08:00
1 parent 6a6522c337
commit d0ccccc47b
33 files changed
+7797

No files matched your search

+101
View File
@@ -0,0 +1,101 @@
"""
FastAPI 主应用
RAG 评估结果展示系统的 API 服务
"""
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
import uvicorn
from src.api.routers import systems, comparison, version_compare, questions
# 创建 FastAPI 应用
app = FastAPI(
title="RAG Evaluation Dashboard API",
description="RAG 评估结果展示系统的 API 服务",
version="1.0.0",
docs_url="/docs",
redoc_url="/redoc"
)
# CORS 配置(本地开发)
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://localhost:5173", # Vite 默认端口
"http://localhost:3000", # 备用端口
"http://127.0.0.1:5173",
"http://127.0.0.1:3000"
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# 注册路由(添加 /api 前缀)
app.include_router(systems.router, prefix="/api")
app.include_router(comparison.router, prefix="/api")
app.include_router(version_compare.router, prefix="/api")
app.include_router(questions.router, prefix="/api")
@app.get("/")
def root():
"""根路径"""
return {
"message": "RAG Evaluation Dashboard API",
"version": "1.0.0",
"docs": "/docs",
"status": "running"
}
@app.get("/health")
def health_check():
"""健康检查"""
return {
"status": "healthy",
"service": "RAG Evaluation Dashboard API"
}
@app.get("/api/info")
def api_info():
"""API 信息"""
return {
"name": "RAG Evaluation Dashboard API",
"version": "1.0.0",
"endpoints": {
"systems": "/api/systems",
"comparison": "/api/comparison",
"version_compare": "/api/version-compare",
"questions": "/api/questions"
},
"documentation": "/docs"
}
# 全局异常处理
@app.exception_handler(Exception)
async def global_exception_handler(request, exc):
"""全局异常处理器"""
return JSONResponse(
status_code=500,
content={
"success": False,
"error": str(exc),
"detail": "服务器内部错误,请检查日志获取详细信息"
}
)
if __name__ == "__main__":
# 运行服务器
uvicorn.run(
"src.api.main:app",
host="0.0.0.0",
port=8000,
reload=True, # 开发模式,自动重载
log_level="info"
)