diff --git a/assets/dashboard/overview.png b/assets/dashboard/overview.png index 2d16ef5..b437dce 100644 Binary files a/assets/dashboard/overview.png and b/assets/dashboard/overview.png differ diff --git a/docs/guide/dashboard.md b/docs/guide/dashboard.md index 13fab1c..307b8e4 100644 --- a/docs/guide/dashboard.md +++ b/docs/guide/dashboard.md @@ -46,12 +46,12 @@ http://127.0.0.1:3392/dashboard 「供应商请求分布」与「订阅状态」并排一行,并排与堆叠的断点见[订阅状态](#订阅状态);三张趋势图共用一个图位的三个页签,页签行右端标明当前时间区间。 -| 图表 | 说明 | -| ---------------------- | ---------------------------------------- | -| 供应商请求分布 | 所选时间区间内各供应商请求占比的甜甜圈图 | -| 请求量 | 按天的请求量 | -| Token(按供应商) | 各供应商按天的 Token 消耗 | -| Token(Vendor / 模型) | 模型级 Token 消耗 | +| 图表 | 说明 | +| -------------- | ---------------------------------------- | +| 供应商请求分布 | 所选时间区间内各供应商请求占比的甜甜圈图 | +| Requests | 按天的请求量 | +| Token / Vendor | 各供应商按天的 Token 消耗 | +| Token / Model | 模型级 Token 消耗 | 三张趋势图都是堆叠面积图,每条线填充到上一条堆叠线;所选区间没有数据时,图位显示「暂无数据」。图形读屏读不到,每张图的 canvas 带 `role=img` 与一句文字摘要(区间、合计、单日最高;分布图是各供应商占比)。分布图的图例默认在右侧;并排右列放不下最长的标签(视口约 1210px 以下)时移到图下方自动换行,避免标签被画布右缘裁掉。 diff --git a/src/coding/proxy/server/dashboard.py b/src/coding/proxy/server/dashboard.py index f1e3236..d91771e 100644 --- a/src/coding/proxy/server/dashboard.py +++ b/src/coding/proxy/server/dashboard.py @@ -541,6 +541,8 @@ def file_response(self, *args: Any, **kwargs: Any) -> Response: border-bottom: 2px solid transparent; padding: 8px 12px 10px; font-family: inherit; font-size: 13px; font-weight: 500; + /* 行高钉死:normal 下含汉字的标签行盒 18px、纯拉丁 16px,页签行高与同排区间说明的基线不能随文案语言变 */ + line-height: 18px; color: var(--text-secondary); white-space: nowrap; cursor: pointer; transition: color .15s ease, border-color .15s ease; @@ -1178,9 +1180,9 @@ def file_response(self, *args: Any, **kwargs: Any) -> Response:
- - - + + +
近 7 天
diff --git a/tests/test_dashboard_overview.py b/tests/test_dashboard_overview.py index 0468efe..acec2ff 100644 --- a/tests/test_dashboard_overview.py +++ b/tests/test_dashboard_overview.py @@ -27,9 +27,9 @@ ("lat", "今日平均延迟", "kpi-card"), ) _TREND_TABS = ( - ("requests", "请求量", "chart-timeline"), - ("tokens", "Token(按供应商)", "chart-token-timeline"), - ("models", "Token(Vendor / 模型)", "chart-model-token-timeline"), + ("requests", "Requests", "chart-timeline"), + ("tokens", "Token / Vendor", "chart-token-timeline"), + ("models", "Token / Model", "chart-model-token-timeline"), ) @@ -163,6 +163,8 @@ def test_overview_css_constraints(client: TestClient): ) # 负下边距:选中页签的下划线盖住头部 hairline;负左边距:首个页签的文字与其它卡片标题左对齐 assert "margin: 0 0 -1px -12px;" in _rule(html, ".trend-tabs") + # 页签行高钉死:标签换成纯拉丁文案后行盒从 18px 缩到 16px,页签行矮 2px、与区间说明的基线错开 1px + assert "line-height: 18px;" in _rule(html, ".trend-tab") # 区间标签只有「近 N 天」:标签与说明都不需要任意断行 assert "white-space: nowrap;" in _rule(html, ".trend-range") assert "white-space: nowrap;" in _rule(html, ".kpi-sub-label, .kpi-sub-val")