Files
siemens_ragas/webapp/static/css/app.css
wangwei 1a2cc534b8 feat(webapp): add optimization advice section to report UI
- index.html: add section ⑤ advice block (hidden by default, shown when advice_markdown present)
- report.js: add renderAdvice() called in render(), simple Markdown→HTML converter
- app.js: add noise_sensitivity / factual_correctness / semantic_similarity to shortMetric map
- app.css: add .advice-panel, .advice-badge, .advice-md styles (purple left-border theme)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-16 17:26:37 +08:00

328 lines
14 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; }
/* ---------- 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; }
/* ---------- ⑤ 优化建议面板 ---------- */
.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; }