dsh-recent-usage-metrics 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.3.7
2
+
3
+ - `#` 表头的提示拆成三行:最近记录、三个状态图标、两种行颜色。原来挤成一句,
4
+ 三件事连在一起读起来费劲。
5
+ - 实时行不再显示总用时的工具提示。还在跑的请求尚未结算工具时间,提示只能给出
6
+ 「无工具调用」或一个不完整的数,对一个仍在进行的请求都是错的;行结算后再出现。
7
+
1
8
  ## 0.3.6
2
9
 
3
10
  - `#` 表头的提示加了一行颜色说明:黄色表示缓存命中过低,蓝色表示这一步切换了模型。
package/client/client.js CHANGED
@@ -114,8 +114,13 @@ window.__ModuleLoader__.load({
114
114
  hoursAgo: '{count} 小时前',
115
115
  // Column-header hints. `{bolt}` / `{tools}` / `{compact}` are replaced by the glyphs
116
116
  // themselves, which is why these are rendered by the tooltip component and not by title.
117
- hintIndex:
118
- '行号:1–10 为已完成的最近记录,{bolt} 为模型输出中,{tools} 为工具调用中,{compact} 为压缩上下文中',
117
+ /*
118
+ * The index hint is three lines: what the column holds, what the glyphs mean, then what
119
+ * the row colours mean. Splitting them keeps each line short enough to read at a glance
120
+ * instead of being one long sentence the eye has to parse.
121
+ */
122
+ hintIndexRows: '行号:1–10 为已完成的最近记录',
123
+ hintIndexGlyphs: '{bolt} 为模型输出中,{tools} 为工具调用中,{compact} 为压缩上下文中',
119
124
  hintColour: '整行黄色表示缓存命中过低,蓝色表示这一步切换了模型',
120
125
  hintTime: '请求发出的时刻(本地时间)',
121
126
  hintTtft: '从发出到收到第一个 token 的耗时',
@@ -178,8 +183,8 @@ window.__ModuleLoader__.load({
178
183
  secondsAgo: '{count}s ago',
179
184
  minutesAgo: '{count}m ago',
180
185
  hoursAgo: '{count}h ago',
181
- hintIndex:
182
- 'Row number: 1–10 are the most recent finished records; {bolt} is a model reply, {tools} is a tool call, {compact} is a context compaction',
186
+ hintIndexRows: 'Row number: 1–10 are the most recent finished records',
187
+ hintIndexGlyphs: '{bolt} is a model reply, {tools} is a tool call, {compact} is a context compaction',
183
188
  hintColour: 'A yellow row means a low cache hit; a blue row means this step switched models',
184
189
  hintTime: 'When the request was issued (local time)',
185
190
  hintTtft: 'Time from issuing the request to receiving its first token',
@@ -1961,29 +1966,33 @@ window.__ModuleLoader__.load({
1961
1966
  function indexHint(t) {
1962
1967
  const glyph = (Icon) => h(Icon, { className: 'dsh-rum-tip-icon' })
1963
1968
  /*
1964
- * Split on every placeholder first, then walk the pieces: a string piece is literal text,
1965
- * a placeholder becomes its glyph. Walking once over a token list is simpler to follow
1966
- * than nesting one split per placeholder.
1969
+ * Turn one sentence into elements, replacing each glyph placeholder with the glyph itself.
1970
+ * A single pass over a token list is simpler to follow than nesting one split per
1971
+ * placeholder, and it keeps the placeholders in whatever order a translation uses.
1967
1972
  */
1968
- const tokens = t('hintIndex').split(/(\{bolt\}|\{tools\}|\{compact\})/)
1969
- const nodes = []
1970
- for (let i = 0; i < tokens.length; i += 1) {
1971
- const token = tokens[i]
1972
- if (token === '') continue
1973
- if (token === '{bolt}') nodes.push(glyph(BoltIcon))
1974
- else if (token === '{tools}') nodes.push(glyph(ToolIcon))
1975
- else if (token === '{compact}') nodes.push(glyph(CompactionIcon))
1976
- else nodes.push(token)
1973
+ const withGlyphs = (text) => {
1974
+ const tokens = text.split(/(\{bolt\}|\{tools\}|\{compact\})/)
1975
+ const nodes = []
1976
+ for (const token of tokens) {
1977
+ if (token === '') continue
1978
+ if (token === '{bolt}') nodes.push(glyph(BoltIcon))
1979
+ else if (token === '{tools}') nodes.push(glyph(ToolIcon))
1980
+ else if (token === '{compact}') nodes.push(glyph(CompactionIcon))
1981
+ else nodes.push(token)
1982
+ }
1983
+ return nodes
1977
1984
  }
1978
1985
  /*
1979
- * The colour legend is its own line, with the two highlights drawn as swatches rather than
1980
- * named. A reader can then match a row to the legend by colour instead of translating a
1981
- * word, and the swatches use the same tokens the rows do, so the two cannot drift.
1986
+ * Three lines: what the column holds, what the glyphs mean, then what the row colours mean.
1987
+ * The colour line leads with two swatches instead of naming the hues, so a reader matches a
1988
+ * row against the legend by colour rather than by translating a word. The swatches take the
1989
+ * same tokens the rows take, so the two cannot drift apart.
1982
1990
  */
1983
1991
  return h(
1984
1992
  'span',
1985
1993
  { className: 'dsh-rum-tip-body' },
1986
- h('span', { className: 'dsh-rum-tip-line' }, ...nodes),
1994
+ h('span', { className: 'dsh-rum-tip-line' }, t('hintIndexRows')),
1995
+ h('span', { className: 'dsh-rum-tip-line' }, ...withGlyphs(t('hintIndexGlyphs'))),
1987
1996
  h(
1988
1997
  'span',
1989
1998
  { className: 'dsh-rum-tip-line' },
@@ -3912,15 +3921,17 @@ window.__ModuleLoader__.load({
3912
3921
  : speedText(live.speed, live.estimated === true, t),
3913
3922
  ),
3914
3923
  h('span', { className: 'dsh-rum-col', role: 'cell' }, tokensText(live.tokens, live.estimated === true, t)),
3924
+ /*
3925
+ * No hint on the live row's total.
3926
+ *
3927
+ * A running request has not reported its tool time yet, so the only
3928
+ * possible readings are "no tools" or a partial count — both would be
3929
+ * wrong about a request that is still going. The hint appears when the
3930
+ * row settles and the fold has the real figures.
3931
+ */
3915
3932
  h(
3916
3933
  'span',
3917
- {
3918
- className: 'dsh-rum-col',
3919
- role: 'cell',
3920
- /* Same hint as the numbered rows, so the meaning never changes. */
3921
- onMouseEnter: (event) => hint.show(toolHintText(live, t), event),
3922
- onMouseLeave: hint.hide,
3923
- },
3934
+ { className: 'dsh-rum-col', role: 'cell' },
3924
3935
  secondsText(
3925
3936
  live.compaction !== null && live.compaction !== undefined
3926
3937
  ? compactionSpan(live.compaction, now)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-recent-usage-metrics",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Geek level for the Performance & usage setting: a live reading of the newest request (first-token latency, speed, tokens, total, amortised) plus a drawer listing the last ten, all derived from the shipped Statistics view data",
5
5
  "repository": {
6
6
  "type": "git",