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 +7 -0
- package/client/client.js +38 -27
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
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
|
-
|
|
118
|
-
|
|
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
|
-
|
|
182
|
-
|
|
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
|
-
*
|
|
1965
|
-
*
|
|
1966
|
-
*
|
|
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
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
const token
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
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
|
-
*
|
|
1980
|
-
*
|
|
1981
|
-
*
|
|
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' },
|
|
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.
|
|
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",
|