Repository navigation
Render composer dock stats + billing on one line (instead of ellipsis + hover) #3431
Replies: 2 comments
|
这个诉求成立——"三级 chrome 却要靠 hover 才能读"确实是本末倒置。但你那个 701px / 716px 的测量里有一个结构性前提可能不成立,值得在开 PR 之前处理掉,否则很可能在评审里被挡下来。
|
| 座位 | kind | scope |
|---|---|---|
conversation.composer.dock |
list | session |
list 意味着任意数量的贡献者可以各自往里加条目,互不覆盖。你的提案里其实已经出现了两个:StatsLine 是一个,dsh-balance 的 本轮 ¥1.477 是另一个——后者是第三方插件,不在 DSH 仓库里。
所以 "701px 对 716px、还剩 15px" 这个测量描述的是你这台机器上这两个贡献者的宽度和。装了第三个 dock 贡献者的用户,这个数就不成立了。而这不是假想:我们自己(Pi 生态兼容层)就往 composer 附近的座位写东西,社区插件里往 dock 加读数的也不止 dsh-balance 一个。
为什么这会把"改进"变成"回归"
现在的 ellipsis + ResizeObserver 虽然难用,但它有一个性质:它在任何条目组合下都不会破版。内容超了就省略号,布局稳定。
你提的硬 nowrap 且"drops the ellipsis + ResizeObserver machinery entirely",把这个性质拿掉了。超出之后会发生什么取决于外层容器:要么把 dock 撑宽推歪输入区,要么被 overflow: hidden 无声裁掉——而裁掉比省略号更糟,因为省略号至少告诉用户"这里还有东西",裁切什么都不说。
评审看到"移除 ResizeObserver"这句,第一个问题多半就是这个。
建议:把它提成两件事,分开卖
你自己在最后已经想到了正解(min-width: 0 + overflow-wrap: anywhere 那条),我建议把它从"可选的让步"提到"方案本体":
- 主体改动(几乎无争议):把 dock 条目收进一个居中 flex 行、压紧分隔符、11px nowrap 排版。这一半解决了你 90% 的抱怨——现在的问题主要是排版松散导致过早溢出,不是省略号本身。
- 保留降级路径(把 ResizeObserver 留着):正常情况下一行读完,容器真的装不下时(窄视口、或者用户装了第四个 dock 插件)仍然优雅省略 + hover。
这样提的好处是:评审不需要相信你的宽度测量。 现在这版的说服力建立在"最长的典型数据集能放下",而这句话对一个 list slot 是没法保证的;改成"放得下就全显示、放不下才退回今天的行为"之后,它在任何条目组合下都严格不比现状差,这是一个容易通过的论证。
一个小建议
如果要保留 ResizeObserver,可以顺手做一件今天缺的事:溢出时给一个视觉暗示。你原文里那句抱怨很准——"with no visual hint that data is hidden"。省略号本身是有的,但用户不知道它可以 hover。加个 cursor: help 或一点点下划虚线,成本接近零,而它解决的正是你提案里那个真正的痛点。这一条独立于要不要 nowrap 都成立,甚至可以单独提。
边界与利益相关
我们不修 DSH 自家组件——composer dock、StatsLine、InputBar 全在 DSH 的 Web 客户端里,上面是设计意见,不是我能替你落地的东西。座位清单那条是我自己从客户端包的 SlotMap 声明里数出来的,不是官方文档,如果你在源码里读到不同结果以你的为准。
利益相关:我维护 pi2dsh,我们也往 DSH Web 的座位里写东西——所以我算是你这个 nowrap 方案的潜在受害者之一,这个利益冲突我先说在前面。不过上面那条建议对我们没有偏袒:保留降级路径之后,多一个 dock 贡献者只会让大家一起退回省略号,而不是把布局撑坏。
Uh oh!
There was an error while loading. Please reload this page.
Proposal: render the composer dock stats + billing on a single line
The problem
The session-stats strip in the composer dock is one of the longest UI lines in the harness:
The current treatment elides overlong content with an ellipsis and hides the full text behind a delayed hover tooltip. On a typical desktop width, the wall-time, throughput, cache-hit, and billing figures are simply not visible — a user has to hover the strip and wait 500ms to learn anything, with no visual hint that data is hidden.
The proposed change
Render the strip as one compact nowrap row that shares the composer dock with the billing pill (e.g.
dsh-balance's本轮 ¥1.477), so a long session's figures read on a single line:11pxnowrap strip with tight|separators (2px). Drops the ellipsis +ResizeObservertooltip machinery entirely — the row no longer elides.conversation.composer.dockentries are wrapped in one centered flex row (.dockFooter) with10pxtop /16pxbottom padding (plus the existing 8px root pad) so the strip keeps breathing room — more below than above.Why this fits
1 轮 · 1 步| LLM 1.3s| 首 token 平均 0.8s · 108 tok/s| 缓存命中 29%| 输入 9.7K tok · 输出 47 tok 本轮 ¥0.0156renders at 701px against a 716px available column at 11px (longest typical figure set fits with ~15px headroom).--dsw-alias-*/--dsh-*tokens, no new palette or typeface.Working implementation
A full working change (5 files:
StatsLine.tsx/.module.css,InputBar.tsx/.module.css,chat-stats.client.spec.tsx) is on the fork branchfeat/stats-line-single-row. I attempted a PR but hit permission limits with the token, so I'm posting here first. Tests pass locally (chat-stats22/22,chat-view46/46).If maintainers agree, I'm happy to open the PR (or adjust the approach — e.g. keep a longer-hover tooltip as a fallback for very narrow viewports, or clamp with
min-width: 0+overflow-wrap: anywhereas a graceful degradation instead of hardnowrap).All reactions