Files
siemens_ragas/webapp/static/css/app.css
wangwei 791738bb07 feat: rename project to 'Siemens RAGAS 评估平台' in frontend
- index.html: page title, brand-mark, brand-sub
- server.py: FastAPI app title
- app.css: comment header

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-24 10:20:23 +08:00

548 lines
22 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* Siemens RAGAS 评估平台 — 样式表
配色取自西门子品牌色petrol / 深青)与中性灰,呼应企业语境。 */
:root {
--petrol: #009999;
--petrol-dark: #007a7a;
--ink: #0f1b2d;
--ink-soft: #1a2942;
--slate: #64748b;
--slate-light: #94a3b8;
--line: #e2e8f0;
--bg: #f4f6f9;
--surface: #ffffff;
--good: #16a34a;
--warn: #eab308;
--bad: #dc2626;
--shadow: 0 1px 3px rgba(15, 27, 45, 0.08), 0 1px 2px rgba(15, 27, 45, 0.04);
--radius: 10px;
font-synthesis: none;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
background: var(--bg);
color: var(--ink);
font-size: 14px;
line-height: 1.5;
}
.app { display: flex; min-height: 100vh; }
/* ---------- 左侧导航 ---------- */
.sidebar {
width: 208px;
flex-shrink: 0;
background: linear-gradient(180deg, var(--ink) 0%, var(--ink-soft) 100%);
color: #cbd5e1;
display: flex;
flex-direction: column;
padding: 20px 14px;
position: sticky;
top: 0;
height: 100vh;
}
.brand { padding: 0 8px 22px; }
.brand-mark {
font-size: 20px; font-weight: 700; letter-spacing: 1px; color: #fff;
}
.brand-sub { font-size: 12px; color: var(--petrol); margin-top: 2px; letter-spacing: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
display: flex; align-items: center; gap: 10px;
background: transparent; border: none; color: #cbd5e1;
padding: 10px 12px; border-radius: 8px; cursor: pointer;
font-size: 14px; text-align: left; width: 100%;
transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active { background: var(--petrol); color: #fff; }
.nav-item.active .nav-ico { color: #fff; }
.nav-item:disabled { opacity: 0.4; cursor: not-allowed; }
.nav-ico { width: 18px; text-align: center; color: var(--petrol); font-weight: 700; }
.nav-item.active .nav-ico { color: #fff; }
.sidebar-foot {
display: flex; align-items: center; gap: 8px;
font-size: 12px; color: var(--slate-light);
padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--slate-light); }
.dot.ok { background: var(--good); }
.dot.bad { background: var(--bad); }
/* ---------- 主内容区 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
display: flex; align-items: center; justify-content: space-between;
padding: 18px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 18px; font-weight: 600; }
.view { padding: 24px 28px; }
/* ---------- 按钮 ---------- */
.btn {
border: 1px solid var(--line); background: var(--surface); color: var(--ink);
padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px;
transition: all 0.15s; font-family: inherit;
}
.btn:hover { border-color: var(--petrol); color: var(--petrol); }
.btn-primary { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.btn-primary:hover { background: var(--petrol-dark); border-color: var(--petrol-dark); color: #fff; }
.btn-primary:disabled { background: var(--slate-light); border-color: var(--slate-light); cursor: not-allowed; }
.btn-ghost { background: transparent; }
/* ---------- 运行列表 ---------- */
.runs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.run-card {
background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
padding: 16px; cursor: pointer; transition: all 0.15s; box-shadow: var(--shadow);
}
.run-card:hover { border-color: var(--petrol); transform: translateY(-1px); }
.run-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.run-card-title { font-size: 15px; font-weight: 600; word-break: break-all; }
.run-card-meta { font-size: 12px; color: var(--slate); margin-top: 6px; line-height: 1.7; }
.run-card-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.metric-chip {
font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--bg);
border: 1px solid var(--line);
}
.metric-chip b { font-variant-numeric: tabular-nums; }
/* ---------- 通用面板 ---------- */
.panel {
background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.panel h2 { font-size: 16px; margin-bottom: 6px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.muted { color: var(--slate); }
.tiny { font-size: 11px; margin-top: 8px; }
.tight { margin: 0 !important; }
code {
background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
padding: 1px 6px; font-size: 12px; font-family: "Cascadia Code", Consolas, monospace;
}
/* ---------- 新建评估 ---------- */
.scenario-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.scenario-item {
display: flex; align-items: center; justify-content: space-between; gap: 12px;
border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; cursor: pointer;
transition: all 0.15s;
}
.scenario-item:hover { border-color: var(--petrol); background: #f0fbfb; }
.scenario-item.selected { border-color: var(--petrol); background: #e6f7f7; box-shadow: inset 0 0 0 1px var(--petrol); }
.scenario-item.invalid { opacity: 0.55; cursor: not-allowed; }
.scenario-name { font-weight: 600; font-size: 14px; }
.scenario-path { font-size: 12px; color: var(--slate); font-family: monospace; }
.scenario-tags { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.tag {
font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg);
border: 1px solid var(--line); color: var(--slate);
}
.tag.mode-online { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.tag.mode-offline { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.run-actions { display: flex; align-items: center; gap: 14px; }
.selected-scenario { font-size: 13px; }
/* ---------- 任务进度 ---------- */
.task-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.badge {
font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600;
background: var(--bg); color: var(--slate); border: 1px solid var(--line);
}
.badge.queued { background: #f1f5f9; color: var(--slate); }
.badge.running { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.badge.completed { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.badge.failed { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.log-box {
background: #0b1220; color: #cbd5e1; border-radius: 8px; padding: 14px;
font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; line-height: 1.7;
max-height: 320px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
.task-actions { margin-top: 12px; }
/* ---------- 报告详情 ---------- */
.report-meta {
background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
padding: 14px 18px; display: flex; justify-content: space-between; align-items: center;
flex-wrap: wrap; gap: 10px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.report-meta-title { font-size: 15px; font-weight: 600; }
.report-meta-info { font-size: 12px; color: var(--slate); }
.status-pill { font-size: 12px; font-weight: 600; }
.status-pill.completed { color: var(--good); }
.section-label {
font-size: 12px; font-weight: 600; letter-spacing: 0.5px; color: var(--slate);
text-transform: uppercase; margin: 18px 0 10px;
}
.metric-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.metric-card {
background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
padding: 16px; text-align: center; box-shadow: var(--shadow);
}
.metric-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-value.good { color: var(--good); }
.metric-value.warn { color: var(--warn); }
.metric-value.bad { color: var(--bad); }
.metric-value.na { color: var(--slate-light); }
.metric-name { font-size: 12px; color: var(--slate); margin-top: 4px; }
.report-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.report-half { margin-bottom: 0; }
.select {
border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; font-size: 12px;
background: var(--surface); color: var(--ink); font-family: inherit; cursor: pointer;
}
.grouping-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.grouping-tab {
font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line);
background: var(--surface); cursor: pointer; color: var(--slate);
}
.grouping-tab.active { background: var(--petrol); color: #fff; border-color: var(--petrol); }
table.group-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.group-table th, table.group-table td { padding: 6px 8px; text-align: left; }
table.group-table th { color: var(--slate); border-bottom: 1px solid var(--line); font-weight: 600; }
table.group-table td { border-bottom: 1px solid #f1f5f9; font-variant-numeric: tabular-nums; }
/* 最低分样本表 */
.lowest-table {
background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
overflow: hidden; box-shadow: var(--shadow);
}
.lowest-row {
display: grid; grid-template-columns: 90px 1fr auto; gap: 12px; align-items: center;
padding: 11px 16px; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background 0.12s;
}
.lowest-row:hover { background: var(--bg); }
.lowest-row .sid { font-size: 12px; color: var(--slate); font-family: monospace; }
.lowest-row .q { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lowest-row .scores { display: flex; gap: 8px; }
.score-badge {
font-size: 12px; padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums;
font-weight: 600;
}
.score-badge.good { background: #dcfce7; color: #166534; }
.score-badge.warn { background: #fef9c3; color: #854d0e; }
.score-badge.bad { background: #fee2e2; color: #991b1b; }
.score-badge.na { background: var(--bg); color: var(--slate-light); }
.lowest-detail { padding: 0 16px; background: #fcfdfe; border-bottom: 1px solid #f1f5f9; }
.lowest-detail-inner { padding: 14px 0; font-size: 13px; line-height: 1.7; }
.detail-field { margin-bottom: 10px; }
.detail-label { font-size: 12px; color: var(--slate); font-weight: 600; margin-bottom: 3px; }
.detail-context { color: #475569; font-size: 12px; }
.detail-context .ctx-item {
padding: 4px 0; border-bottom: 1px dashed var(--line);
}
.detail-gt { color: var(--good); }
.empty { text-align: center; padding: 60px 20px; color: var(--slate); }
.empty p { margin-bottom: 8px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line);
border-top-color: var(--petrol); border-radius: 50%; animation: spin 0.7s linear infinite;
vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 880px) {
.report-row { grid-template-columns: 1fr; }
.sidebar { width: 64px; }
.brand-sub, .nav-item span:not(.nav-ico), .sidebar-foot span:last-child { display: none; }
}
/* ---------- LLM 配置管理页 ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.profile-card {
background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
padding: 16px; box-shadow: var(--shadow);
}
.profile-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.profile-card-name { font-size: 15px; font-weight: 600; }
.profile-card-actions { display: flex; gap: 6px; }
.profile-card-field { font-size: 12px; color: var(--slate); margin-top: 4px; }
.field-label { font-weight: 600; color: var(--ink); }
/* Form */
.profile-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; max-width: 560px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 13px; font-weight: 600; }
.req { color: var(--bad); }
.form-input {
border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
font-size: 13px; font-family: inherit; width: 100%;
}
.form-input:focus { outline: none; border-color: var(--petrol); }
.form-input-sm { max-width: 120px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.form-error { font-size: 12px; color: var(--bad); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: #fee2e2; }
.btn-test { color: #0369a1; border-color: #0369a1; }
.btn-test:hover { background: #e0f2fe; }
/* LLM 连通性测试结果 */
.profile-test-result {
margin-top: 8px;
padding: 6px 10px;
border-radius: 6px;
font-size: 12px;
font-weight: 500;
display: none;
}
.profile-test-result:not([hidden]) { display: block; }
.profile-test-result.ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.profile-test-result.fail { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; word-break: break-all; }
/* 选中态 run 卡片 */
.run-card.selected {
border-color: var(--petrol);
box-shadow: 0 0 0 2px rgba(0,153,153,0.25), var(--shadow);
}
/* ---------- LLM 角色配置面板 ---------- */
.llm-assignment-panel { border-left: 3px solid var(--petrol); }
.llm-role-rows { display: flex; flex-direction: column; gap: 10px; }
.llm-role-row { display: flex; align-items: center; gap: 14px; }
.llm-role-label { font-size: 13px; font-weight: 600; min-width: 180px; color: var(--ink); }
.llm-role-select { min-width: 240px; }
/* ---------- API 文档 iframe ---------- */
#view-apidocs { padding: 0; display: flex; flex-direction: column; flex: 1; }
#view-apidocs[hidden] { display: none; }
.apidocs-frame {
flex: 1;
width: 100%;
height: calc(100vh - 64px);
border: none;
}
.report-actions {
display: flex; justify-content: flex-end; margin: 0 0 12px;
}
.btn-export-pdf {
font-size: 13px; display: flex; align-items: center; gap: 6px;
}
/* ---------- 报告历史切换下拉 ---------- */
.report-switcher {
display: flex; align-items: center; gap: 10px;
background: var(--surface); border: 1px solid var(--line);
border-radius: var(--radius); padding: 10px 16px;
margin-bottom: 14px; box-shadow: var(--shadow);
}
.report-switcher-label {
font-size: 13px; font-weight: 600; color: var(--slate); white-space: nowrap;
}
.report-switcher-select {
flex: 1; min-width: 0;
border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px;
font-size: 13px; font-family: inherit; background: var(--bg); color: var(--ink);
cursor: pointer;
}
.report-switcher-select:focus { outline: none; border-color: var(--petrol); }
/* ?? ?????? ??????????????????????????????????? */
.weight-config-panel { margin-top: 12px; }
.weight-section-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.weight-rows { display: flex; flex-direction: column; gap: 6px; }
.weight-row {
display: flex; align-items: center; gap: 10px;
font-size: 13px;
}
.weight-row-label { min-width: 180px; color: var(--slate); font-family: monospace; }
.weight-row-input {
width: 80px; padding: 4px 8px; border: 1px solid var(--border);
border-radius: 6px; font-size: 13px; text-align: right;
}
.weight-row-input:focus { outline: none; border-color: #6366f1; }
.doc-weight-name {
flex: 1; padding: 4px 8px; border: 1px solid var(--border);
border-radius: 6px; font-size: 13px; min-width: 0;
}
.weight-row-remove { color: var(--bad); cursor: pointer; font-size: 14px; background: none; border: none; padding: 2px 6px; }
.weight-row-remove:hover { background: #fee2e2; border-radius: 4px; }
/* weighted_score ???????? */
.metric-card.weighted-score-card {
border: 2px solid #6366f1;
background: #f5f3ff;
}
.metric-card.weighted-score-card .metric-name { color: #4f46e5; font-weight: 700; }
/* ================================================================
打印样式(导出 PDF 用)
浏览器打印时隐藏 UI chrome保留报告内容图表 canvas 原样输出
================================================================ */
@media print {
/* ── 页面尺寸与边距 ── */
@page {
size: A4 portrait;
margin: 18mm 16mm 18mm 16mm;
}
/* ── 隐藏所有非报告元素 ── */
.sidebar,
.topbar,
.report-actions,
.no-print,
#dist-metric-select,
.grouping-tabs,
#view-runs,
#view-new,
#view-profiles { display: none !important; }
/* ── 全局基础 ── */
body {
font-size: 11pt;
line-height: 1.5;
color: #0f1b2d;
background: #fff;
}
/* ── 布局重置main 全宽 ── */
.app { display: block; }
.main { display: block; width: 100%; }
.view { padding: 0; display: block !important; }
#view-apidocs { display: none !important; } /* never print the API docs iframe */
#view-report { display: block !important; }
/* ── 报告内容 ── */
#report-content { display: block !important; }
#report-empty { display: none !important; }
/* ── 元信息条 ── */
.report-meta {
display: flex;
justify-content: space-between;
border-bottom: 2px solid #009999;
padding-bottom: 8pt;
margin-bottom: 14pt;
}
.report-meta-title { font-size: 14pt; font-weight: 700; }
.report-meta-info { font-size: 9pt; color: #64748b; }
/* ── Section 标签 ── */
.section-label {
font-size: 9pt;
font-weight: 700;
letter-spacing: 0.5px;
color: #64748b;
text-transform: uppercase;
margin: 14pt 0 6pt;
border-bottom: 1px solid #e2e8f0;
padding-bottom: 3pt;
break-after: avoid;
}
/* ── ① 指标均值卡片 ── */
.metric-cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(90pt, 1fr));
gap: 8pt;
margin-bottom: 12pt;
}
.metric-card {
border: 1px solid #e2e8f0;
border-radius: 6pt;
padding: 10pt 8pt;
text-align: center;
break-inside: avoid;
}
.metric-value { font-size: 20pt; font-weight: 700; }
.metric-name { font-size: 8pt; color: #64748b; margin-top: 2pt; }
/* ── ② 分布 + ③ 分组:打印时改为纵向排列 ── */
.report-row {
display: block;
}
.report-half {
margin-bottom: 12pt;
break-inside: avoid;
}
#dist-chart {
max-height: 160pt;
width: 100% !important;
}
/* ── 面板统一 ── */
.panel {
border: 1px solid #e2e8f0;
border-radius: 6pt;
padding: 10pt 12pt;
margin-bottom: 10pt;
break-inside: avoid;
box-shadow: none;
}
.panel h2 { font-size: 12pt; margin-bottom: 4pt; }
/* ── ④ 最低分样本:打印时全部展开,隐藏点击提示 ── */
.lowest-detail { display: block !important; hidden: false; }
.lowest-row { break-inside: avoid; }
.lowest-detail-inner { padding: 8pt 0; font-size: 10pt; }
.detail-label { font-size: 8pt; font-weight: 700; color: #64748b; margin-bottom: 2pt; }
.detail-context .ctx-item { border-bottom: 1px dashed #e2e8f0; padding: 2pt 0; font-size: 9pt; }
/* ── ⑤ 优化建议 ── */
#advice-section { display: block !important; }
.advice-panel { border: 1px solid #e2e8f0; border-radius: 6pt; padding: 10pt 12pt; }
.advice-md h2 { font-size: 12pt; margin-top: 10pt; }
.advice-md h3 { font-size: 11pt; }
.advice-md ul { margin: 4pt 0 4pt 16pt; }
.advice-md li { margin-bottom: 3pt; }
/* ── 分组表 ── */
table.group-table { width: 100%; font-size: 9pt; border-collapse: collapse; }
table.group-table th,
table.group-table td { padding: 4pt 6pt; border-bottom: 1px solid #e2e8f0; }
table.group-table th { font-weight: 700; color: #64748b; }
/* ── 颜色保留(部分浏览器打印默认去色) ── */
.good { color: #16a34a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.warn { color: #eab308 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bad { color: #dc2626 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.score-badge.good { background: #dcfce7 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.score-badge.warn { background: #fef9c3 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.score-badge.bad { background: #fee2e2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* ---------- ⑤ 优化建议面板 ---------- */
.advice-panel { border-left: 3px solid #7c3aed; }
.advice-header {
display: flex; align-items: center; gap: 10px;
margin-bottom: 14px;
}
.advice-badge {
background: #7c3aed; color: #fff;
font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
padding: 3px 8px; border-radius: 4px; text-transform: uppercase;
}
.advice-model { font-size: 12px; color: var(--slate); }
.advice-body { line-height: 1.7; color: var(--ink); }
.advice-md h1 { font-size: 16px; font-weight: 700; margin: 16px 0 8px; color: var(--ink); }
.advice-md h2 {
font-size: 14px; font-weight: 700; margin: 20px 0 8px;
padding-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--ink-soft);
}
.advice-md h3 { font-size: 13px; font-weight: 600; margin: 12px 0 6px; color: var(--slate); }
.advice-md hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.advice-md ul { padding-left: 20px; margin: 6px 0; }
.advice-md li { margin: 3px 0; font-size: 13px; }
.advice-md strong { color: var(--ink); font-weight: 600; }