feat: 前端迁移至Vue并添加RAGAS综合评估报告

主要变更:
- 前端框架从React迁移到Vue 3
- 添加RAGAS系统综合评估报告(8系统全维度对比)
- 添加Excel系统深度分析、文本系统对比等分析报告
- 新增原始数据加载服务和API端点
- 更新Dashboard文档和TODO进度追踪

评估报告亮点:
- ZHTv2-Excel综合性能最佳(0.6271)
- KBS系统答案质量最高(correctness=0.7058)
- ZHTv2相比v1提升40%+,成功追平KBS
- Text vs Excel构建形式深度对比分析

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
hughhuang(黄健铭)andClaude Sonnet 4.5 committed 2026-01-08 20:31:49 +08:00
1 parent 1933bb3dcb
commit b023af2b47
72 files changed
+5307 -5722

No files matched your search

+368
View File
@@ -0,0 +1,368 @@
<template>
<div class="overview-view">
<!-- 系统排名卡片(前4名) -->
<el-row :gutter="20" class="top-cards">
<el-col :span="6" v-for="(system, index) in topSystems" :key="system.id">
<el-card class="rank-card" :class="`rank-${index + 1}`">
<div class="rank-icon">
<el-icon v-if="index === 0"><Trophy /></el-icon>
<el-icon v-else-if="index === 1"><Medal /></el-icon>
<span v-else class="rank-number">{{ index + 1 }}</span>
</div>
<div class="system-info">
<div class="system-name">{{ system.name }}</div>
<div class="system-score">{{ system.overall_score.toFixed(4) }}</div>
</div>
</el-card>
</el-col>
</el-row>
<!-- 各指标排名表格 -->
<el-card class="metrics-rank-card">
<template #header>
<span>各指标排名</span>
</template>
<el-table :data="metricsRankData" stripe>
<el-table-column prop="metric" label="指标" width="200" />
<el-table-column label="第1名">
<template #default="{ row }">
<div class="rank-cell">
<el-icon class="rank-icon-gold"><Trophy /></el-icon>
<span>{{ row.rank1.name }}</span>
<el-tag size="small" type="success">{{ row.rank1.score.toFixed(4) }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="第2名">
<template #default="{ row }">
<div class="rank-cell">
<el-icon class="rank-icon-silver"><Medal /></el-icon>
<span>{{ row.rank2.name }}</span>
<el-tag size="small">{{ row.rank2.score.toFixed(4) }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="第3名">
<template #default="{ row }">
<div class="rank-cell">
<el-icon class="rank-icon-bronze"><Medal /></el-icon>
<span>{{ row.rank3.name }}</span>
<el-tag size="small" type="warning">{{ row.rank3.score.toFixed(4) }}</el-tag>
</div>
</template>
</el-table-column>
</el-table>
</el-card>
<!-- 排名柱状图 -->
<el-card class="chart-card">
<template #header>
<span>系统排名</span>
</template>
<div ref="barChartRef" style="height: 400px"></div>
</el-card>
<!-- 系统详情表格 -->
<el-card class="table-card">
<template #header>
<span>系统详情</span>
</template>
<el-table :data="systemsWithLowQuestions" stripe v-loading="loading">
<el-table-column prop="name" label="系统名称" width="150" />
<el-table-column prop="overall_score" label="总分" sortable width="120">
<template #default="{ row }">
<el-tag type="success">{{ row.overall_score.toFixed(4) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="data_format" label="数据格式" width="100">
<template #default="{ row }">
<el-tag :type="row.data_format === 'text' ? 'primary' : 'warning'">
{{ row.data_format.toUpperCase() }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="低分问题 (Top 3)" width="300">
<template #default="{ row }">
<div v-if="row.lowScoreQuestions && row.lowScoreQuestions.length > 0" class="low-questions">
<el-tag
v-for="q in row.lowScoreQuestions"
:key="q.question_id"
size="small"
class="question-tag"
@click="goToQuestion(q.question_id)"
>
{{ q.question_id }} ({{ q.score.toFixed(2) }})
</el-tag>
</div>
<el-text v-else type="info" size="small">无低分问题</el-text>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template #default="{ row }">
<el-button text type="primary" @click="viewDetail(row.id)">
查看详情
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script setup>
import { ref, onMounted, computed } from 'vue'
import { useRouter } from 'vue-router'
import * as echarts from 'echarts'
import { getSystems, getSystemMetrics, getSystemLowScoreQuestions } from '@/api/systems'
const router = useRouter()
const barChartRef = ref(null)
const systems = ref([])
const loading = ref(false)
const topSystems = computed(() => systems.value.slice(0, 4))
// 计算各指标排名
const metricsRankData = computed(() => {
const metrics = [
{ key: 'context_precision', name: 'Context Precision' },
{ key: 'context_recall', name: 'Context Recall' },
{ key: 'faithfulness', name: 'Faithfulness' },
{ key: 'answer_relevance', name: 'Answer Relevance' },
{ key: 'answer_correctness', name: 'Answer Correctness' }
]
return metrics.map(metric => {
// 按该指标排序
const sorted = [...systems.value].sort((a, b) => {
const aScore = a.metrics?.[metric.key] || 0
const bScore = b.metrics?.[metric.key] || 0
return bScore - aScore
})
return {
metric: metric.name,
rank1: { name: sorted[0]?.name, score: sorted[0]?.metrics?.[metric.key] || 0 },
rank2: { name: sorted[1]?.name, score: sorted[1]?.metrics?.[metric.key] || 0 },
rank3: { name: sorted[2]?.name, score: sorted[2]?.metrics?.[metric.key] || 0 }
}
})
})
// 系统列表,包含低分问题
const systemsWithLowQuestions = computed(() => {
return systems.value.map(sys => ({
...sys,
lowScoreQuestions: sys.lowScoreQuestions || []
}))
})
const loadSystems = async () => {
loading.value = true
try {
const { data } = await getSystems()
systems.value = []
// 并行加载每个系统的指标和低分问题
for (const sys of data) {
try {
const [metricsRes, lowQuestionsRes] = await Promise.all([
getSystemMetrics(sys.id),
getSystemLowScoreQuestions(sys.id, 0.5, 3)
])
systems.value.push({
...sys,
metrics: metricsRes.data,
lowScoreQuestions: lowQuestionsRes.data
})
} catch (err) {
// 如果某个系统加载失败,仍然添加到列表中,但没有指标数据
systems.value.push({
...sys,
metrics: {},
lowScoreQuestions: []
})
}
}
// 重新按总分排序
systems.value.sort((a, b) => b.overall_score - a.overall_score)
renderBarChart()
} catch (error) {
console.error('加载系统列表失败:', error)
} finally {
loading.value = false
}
}
const renderBarChart = () => {
if (!barChartRef.value) return
const chart = echarts.init(barChartRef.value)
const option = {
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' }
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
data: systems.value.map(s => s.name),
axisLabel: { interval: 0, rotate: 30 }
},
yAxis: {
type: 'value',
name: '总分'
},
series: [
{
name: '总分',
type: 'bar',
data: systems.value.map(s => ({
value: s.overall_score,
itemStyle: {
color: s.overall_score > 0.8 ? '#52c41a' : s.overall_score > 0.6 ? '#1890ff' : '#faad14'
}
})),
label: {
show: true,
position: 'top',
formatter: '{c}'
}
}
]
}
chart.setOption(option)
}
const viewDetail = (id) => {
router.push({ name: 'Comparison', query: { systems: [id] } })
}
const goToQuestion = (questionId) => {
router.push({ name: 'QuestionDetail', params: { id: questionId } })
}
onMounted(() => {
loadSystems()
})
</script>
<style scoped>
.overview-view {
display: flex;
flex-direction: column;
gap: 20px;
}
.top-cards {
margin-bottom: 20px;
}
.rank-card {
display: flex;
align-items: center;
gap: 16px;
border: 2px solid transparent;
}
.rank-card.rank-1 {
border-color: #ffd700;
background: linear-gradient(135deg, #fff9e6 0%, #fff 100%);
}
.rank-card.rank-2 {
border-color: #c0c0c0;
background: linear-gradient(135deg, #f5f5f5 0%, #fff 100%);
}
.rank-card.rank-3 {
border-color: #cd7f32;
background: linear-gradient(135deg, #fff4e6 0%, #fff 100%);
}
.rank-icon {
font-size: 36px;
color: #1890ff;
display: flex;
align-items: center;
justify-content: center;
width: 50px;
height: 50px;
}
.rank-number {
font-size: 24px;
font-weight: bold;
color: #1890ff;
}
.system-info {
flex: 1;
}
.system-name {
font-size: 16px;
font-weight: 500;
margin-bottom: 8px;
}
.system-score {
font-size: 24px;
font-weight: bold;
color: #1890ff;
}
.metrics-rank-card {
margin-top: 20px;
}
.rank-cell {
display: flex;
align-items: center;
gap: 8px;
}
.rank-icon-gold {
color: #ffd700;
font-size: 20px;
}
.rank-icon-silver {
color: #c0c0c0;
font-size: 20px;
}
.rank-icon-bronze {
color: #cd7f32;
font-size: 20px;
}
.chart-card,
.table-card {
margin-top: 20px;
}
.low-questions {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.question-tag {
cursor: pointer;
transition: all 0.2s;
}
.question-tag:hover {
transform: translateY(-2px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
</style>