dsh-desktop-statusbar 3.0.6 → 3.0.8
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/docs/official-models.json +24 -2
- package/docs/official-models.md +5 -3
- package/lib/balance-api.js +175 -3
- package/lib/client.js +278 -40
- package/lib/index.js +153 -14
- package/package.json +1 -1
- package/tests/verify-clock.js +3 -2
- package/tests/verify-context.js +44 -11
- package/tests/verify-copy.js +1 -1
- package/tests/verify-fixes.js +58 -0
- package/tests/verify-generic-relay.js +25 -15
- package/tests/verify-magpie-quota.mjs +328 -1
- package/tests/verify-prices.js +1 -1
- package/tests/verify-provider-fees.js +66 -1
- package/tests/verify-relay-settings.js +8 -8
- package/tests/verify-render.js +14 -0
- package/tests/verify-tips.js +87 -0
- package/tests/verify.js +94 -16
package/lib/client.js
CHANGED
|
@@ -76,23 +76,24 @@ window.__ModuleLoader__.load({
|
|
|
76
76
|
*/
|
|
77
77
|
const CONFIG_VERSION = 6;
|
|
78
78
|
/** 插件版本:显示在设置页底部,用来确认页面加载的是哪一版客户端代码。 */
|
|
79
|
-
const VERSION = "3.0.
|
|
79
|
+
const VERSION = "3.0.8";
|
|
80
80
|
/** 官方参考价的版本:官方调价时改这个数字,老价格库会自动并入新参考价。
|
|
81
81
|
* v4:官方模型目录(MODEL_PRESENTATION)**默认全部加入价格表**(按官网价播种),
|
|
82
82
|
* 不再需要「点名字加入」;用户删掉的模型可用「恢复默认」找回。
|
|
83
83
|
* v5:清理旧版目录点选加入、现已下架的官方模型(它们不该落进「自定义模型」组)。
|
|
84
84
|
* v6:官方目录**新增**的模型自动补播给老用户(只补缺失项,已有条目不动)。
|
|
85
85
|
* v7:每个条目补内部基准价 `base`(切币种来回切不漂的锚点,见 normalizeBase)。
|
|
86
|
-
* v8:官方目录新增 Claude Fable 5.2,老用户价格库自动补播(只补缺失项,已有条目不覆盖)。
|
|
87
|
-
|
|
86
|
+
* v8:官方目录新增 Claude Fable 5.2,老用户价格库自动补播(只补缺失项,已有条目不覆盖)。
|
|
87
|
+
* v10:补 GPT-6.2 Astra / Sol,老用户价格库自动补播(只补缺失项,已有条目不覆盖)。 */
|
|
88
|
+
const PRICE_VERSION = 10;
|
|
88
89
|
/** 官方目录默认播种的版本(v4 一次性迁移;后续版本不再重复播种)。 */
|
|
89
90
|
const PRICE_SEED_VERSION = 4;
|
|
90
91
|
/** 清理已下架官方残留条目的版本(v5 起;v8 再清一次 MiniMax / 阶跃星辰两个默认条目)。
|
|
91
92
|
* v8 起与 PRICE_VERSION 同步:价格库版本 <8 的老用户升级时清理一次,≥8 不再重复。 */
|
|
92
93
|
const PRICE_RETIRED_PRUNE_VERSION = 8;
|
|
93
|
-
/** 补播官方目录新增模型的版本(v6 起每次目录加型号都靠这条自动补;v8 补 Claude Fable 5.2)。
|
|
94
|
+
/** 补播官方目录新增模型的版本(v6 起每次目录加型号都靠这条自动补;v8 补 Claude Fable 5.2;v10 补 GPT-6.2 Astra / Sol)。
|
|
94
95
|
* 只补当前价格库缺失项,已有条目(用户改过的价 / 倍率)一律不动。 */
|
|
95
|
-
const PRICE_BACKFILL_VERSION =
|
|
96
|
+
const PRICE_BACKFILL_VERSION = 10;
|
|
96
97
|
/** 给价格条目补「基准价」的版本(v7 一次性迁移;缺 base 的条目按当前值 + 当前币种补,不改数值)。 */
|
|
97
98
|
const PRICE_BASE_VERSION = 7;
|
|
98
99
|
/** 项目主页:设置页那个「去 GitHub 点 star」按钮跳这里(与 package.json 的 repository 同址)。 */
|
|
@@ -125,7 +126,7 @@ window.__ModuleLoader__.load({
|
|
|
125
126
|
};
|
|
126
127
|
|
|
127
128
|
/**
|
|
128
|
-
* 官方模型目录(数据源:docs/official-models.json,2026-11-04 核验、2026-11-10 补 Claude Fable 5.2;每厂商只留最新一代)。
|
|
129
|
+
* 官方模型目录(数据源:docs/official-models.json,2026-11-04 核验、2026-11-10 补 Claude Fable 5.2、2026-11-22 补 GPT-6.2;每厂商只留最新一代)。
|
|
129
130
|
* 只保留 UI 需要的两样:厂商 id + 官方价;来源链接 / 备注 / 分档说明不进界面。
|
|
130
131
|
* 价格字段为 null = 官网未公布 → 不参与自动计费(不要填 0)。
|
|
131
132
|
* 厂商与模型顺序 = JSON 的 vendors / models 顺序。
|
|
@@ -136,6 +137,8 @@ window.__ModuleLoader__.load({
|
|
|
136
137
|
"claude-opus-5.5": { manufacturer: "anthropic", price: { tiered: false, currency: "USD", peak: { input: 4, cacheRead: 0.2, cacheWrite: 5, output: 20 }, offPeak: { input: 4, cacheRead: 0.2, cacheWrite: 5, output: 20 } } },
|
|
137
138
|
"claude-sonnet-5.5": { manufacturer: "anthropic", price: { tiered: false, currency: "USD", peak: { input: 2, cacheRead: 0.1, cacheWrite: 2.5, output: 10 }, offPeak: { input: 2, cacheRead: 0.1, cacheWrite: 2.5, output: 10 } } },
|
|
138
139
|
"claude-haiku-5.5": { manufacturer: "anthropic", price: { tiered: false, currency: "USD", peak: { input: 0.1, cacheRead: 0.01, cacheWrite: 0.125, output: 0.5 }, offPeak: { input: 0.1, cacheRead: 0.01, cacheWrite: 0.125, output: 0.5 } } },
|
|
140
|
+
"gpt-6.2-astra": { manufacturer: "openai", price: { tiered: false, currency: "USD", peak: { input: 8, cacheRead: 0.4, cacheWrite: 10, output: 40 }, offPeak: { input: 8, cacheRead: 0.4, cacheWrite: 10, output: 40 } } },
|
|
141
|
+
"gpt-6.2-sol": { manufacturer: "openai", price: { tiered: false, currency: "USD", peak: { input: 2, cacheRead: 0.1, cacheWrite: 2.5, output: 10 }, offPeak: { input: 2, cacheRead: 0.1, cacheWrite: 2.5, output: 10 } } },
|
|
139
142
|
"gpt-6-astra": { manufacturer: "openai", price: { tiered: false, currency: "USD", peak: { input: 10, cacheRead: 1, cacheWrite: 12.5, output: 50 }, offPeak: { input: 10, cacheRead: 1, cacheWrite: 12.5, output: 50 } } },
|
|
140
143
|
"gpt-6.1-sol": { manufacturer: "openai", price: { tiered: false, currency: "USD", peak: { input: 2, cacheRead: 0.1, cacheWrite: 2.5, output: 10 }, offPeak: { input: 2, cacheRead: 0.1, cacheWrite: 2.5, output: 10 } } },
|
|
141
144
|
"gpt-6.1-terra": { manufacturer: "openai", price: { tiered: false, currency: "USD", peak: { input: 1, cacheRead: 0.05, cacheWrite: 1.25, output: 5 }, offPeak: { input: 1, cacheRead: 0.05, cacheWrite: 1.25, output: 5 } } },
|
|
@@ -1895,7 +1898,8 @@ function platformOfBook(book, platforms, model) {
|
|
|
1895
1898
|
*/
|
|
1896
1899
|
const PRICE_BACKFILL_ADDED = [
|
|
1897
1900
|
{ version: 6, names: ["kimi-k3"] },
|
|
1898
|
-
{ version: 8, names: ["claude-fable-5.2"] }
|
|
1901
|
+
{ version: 8, names: ["claude-fable-5.2"] },
|
|
1902
|
+
{ version: 10, names: ["gpt-6.2-astra", "gpt-6.2-sol"] }
|
|
1899
1903
|
];
|
|
1900
1904
|
/** 从 fromVersion 升到当前版本时需要补播的官方新模型(只含新增项,已有条目不动)。 */
|
|
1901
1905
|
function officialBackfillModels(fromVersion) {
|
|
@@ -2077,6 +2081,8 @@ function platformOfBook(book, platforms, model) {
|
|
|
2077
2081
|
tipCreditsRefreshLatest: " · {date} 刷新(最近)",
|
|
2078
2082
|
tipCreditsExpireLatest: " · {date} 到期(最近)",
|
|
2079
2083
|
tipCreditsLeft: "剩余 {left} / {total}",
|
|
2084
|
+
quotaFiveHour: "5 小时额度",
|
|
2085
|
+
quotaSevenDay: "7 天额度",
|
|
2080
2086
|
|
|
2081
2087
|
secSegments: "统计字段",
|
|
2082
2088
|
secSegmentsHint: "勾选显示;按住拖动调整顺序。",
|
|
@@ -2251,6 +2257,8 @@ function platformOfBook(book, platforms, model) {
|
|
|
2251
2257
|
tipCreditsRefreshLatest: " · refreshes {date} (nearest)",
|
|
2252
2258
|
tipCreditsExpireLatest: " · expires {date} (nearest)",
|
|
2253
2259
|
tipCreditsLeft: "{left} / {total} left",
|
|
2260
|
+
quotaFiveHour: "5-hour quota",
|
|
2261
|
+
quotaSevenDay: "7-day quota",
|
|
2254
2262
|
|
|
2255
2263
|
secSegments: "Stats fields",
|
|
2256
2264
|
secSegmentsHint: "Select to show; drag to reorder.",
|
|
@@ -2418,6 +2426,8 @@ function platformOfBook(book, platforms, model) {
|
|
|
2418
2426
|
"tipCreditsRefreshLatest": " · {date} 更新(直近)",
|
|
2419
2427
|
"tipCreditsExpireLatest": " · {date} 期限(直近)",
|
|
2420
2428
|
"tipCreditsLeft": "残り {left} / {total}",
|
|
2429
|
+
"quotaFiveHour": "5時間クォータ",
|
|
2430
|
+
"quotaSevenDay": "7日間クォータ",
|
|
2421
2431
|
"secSegments": "統計項目",
|
|
2422
2432
|
"secSegmentsHint": "選択して表示、ドラッグで並べ替え。",
|
|
2423
2433
|
"secPrices": "カスタムモデル価格",
|
|
@@ -2579,6 +2589,8 @@ function platformOfBook(book, platforms, model) {
|
|
|
2579
2589
|
"tipCreditsRefreshLatest": " · se renueva {date} (próxima)",
|
|
2580
2590
|
"tipCreditsExpireLatest": " · caduca {date} (próxima)",
|
|
2581
2591
|
"tipCreditsLeft": "Quedan {left} / {total}",
|
|
2592
|
+
"quotaFiveHour": "Cuota de 5 horas",
|
|
2593
|
+
"quotaSevenDay": "Cuota de 7 días",
|
|
2582
2594
|
"secSegments": "Campos de estadísticas",
|
|
2583
2595
|
"secSegmentsHint": "Marca para mostrar; arrastra para reordenar.",
|
|
2584
2596
|
"secPrices": "Precios personalizados de modelos",
|
|
@@ -2740,6 +2752,8 @@ function platformOfBook(book, platforms, model) {
|
|
|
2740
2752
|
"tipCreditsRefreshLatest": " · renouvelé le {date} (le plus proche)",
|
|
2741
2753
|
"tipCreditsExpireLatest": " · expire le {date} (le plus proche)",
|
|
2742
2754
|
"tipCreditsLeft": "{left} / {total} restants",
|
|
2755
|
+
"quotaFiveHour": "Quota 5 heures",
|
|
2756
|
+
"quotaSevenDay": "Quota 7 jours",
|
|
2743
2757
|
"secSegments": "Champs de statistiques",
|
|
2744
2758
|
"secSegmentsHint": "Sélectionnez pour afficher ; faites glisser pour réorganiser.",
|
|
2745
2759
|
"secPrices": "Prix des modèles personnalisés",
|
|
@@ -2901,6 +2915,8 @@ function platformOfBook(book, platforms, model) {
|
|
|
2901
2915
|
"tipCreditsRefreshLatest": " · erneuert sich {date} (nächste)",
|
|
2902
2916
|
"tipCreditsExpireLatest": " · verfällt {date} (nächste)",
|
|
2903
2917
|
"tipCreditsLeft": "{left} / {total} übrig",
|
|
2918
|
+
"quotaFiveHour": "5-Stunden-Kontingent",
|
|
2919
|
+
"quotaSevenDay": "7-Tage-Kontingent",
|
|
2904
2920
|
"secSegments": "Statistikfelder",
|
|
2905
2921
|
"secSegmentsHint": "Zum Anzeigen auswählen; per Ziehen sortieren.",
|
|
2906
2922
|
"secPrices": "Eigene Modellpreise",
|
|
@@ -3062,6 +3078,8 @@ function platformOfBook(book, platforms, model) {
|
|
|
3062
3078
|
"tipCreditsRefreshLatest": " · обновление {date} (ближайшее)",
|
|
3063
3079
|
"tipCreditsExpireLatest": " · истекает {date} (ближайшее)",
|
|
3064
3080
|
"tipCreditsLeft": "осталось {left} / {total}",
|
|
3081
|
+
"quotaFiveHour": "Квота на 5 часов",
|
|
3082
|
+
"quotaSevenDay": "Квота на 7 дней",
|
|
3065
3083
|
"secSegments": "Поля статистики",
|
|
3066
3084
|
"secSegmentsHint": "Выберите для показа; перетащите для порядка.",
|
|
3067
3085
|
"secPrices": "Свои цены моделей",
|
|
@@ -3223,6 +3241,8 @@ function platformOfBook(book, platforms, model) {
|
|
|
3223
3241
|
"tipCreditsRefreshLatest": " · renova a {date} (mais próxima)",
|
|
3224
3242
|
"tipCreditsExpireLatest": " · expira a {date} (mais próxima)",
|
|
3225
3243
|
"tipCreditsLeft": "{left} / {total} restantes",
|
|
3244
|
+
"quotaFiveHour": "Cota de 5 horas",
|
|
3245
|
+
"quotaSevenDay": "Cota de 7 dias",
|
|
3226
3246
|
"secSegments": "Campos de estatísticas",
|
|
3227
3247
|
"secSegmentsHint": "Selecione para mostrar; arraste para reordenar.",
|
|
3228
3248
|
"secPrices": "Preços de modelos personalizados",
|
|
@@ -4044,15 +4064,34 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
4044
4064
|
* 蓝紫两色复用总计令牌条已有的「输出」蓝与「未命中输入」紫,不新造颜色。
|
|
4045
4065
|
* 旋转是 CSS animation(见样式表),不占 JS 定时器。
|
|
4046
4066
|
*/
|
|
4047
|
-
function contextRing(percent, state, compact) {
|
|
4067
|
+
function contextRing(percent, state, compact, labelPercent) {
|
|
4068
|
+
const displayPercent = typeof percent === "number" && Number.isFinite(percent)
|
|
4069
|
+
? Math.max(0, Math.min(100, percent))
|
|
4070
|
+
: 0;
|
|
4071
|
+
/* 环心数字显示的是**主会话自己**的占用(labelPercent,调用处传 contextMeter.percent),
|
|
4072
|
+
与弧长(percent,团队运行时是成员级最大/深层最小)不同源 —— 用户拍板:
|
|
4073
|
+
「环里的数字只显示主会话自己的上下文占用」,弧长仍按谁在跑切数据源。
|
|
4074
|
+
只显示整数(四舍五入);到 100 留空(14px 环心塞不下三位,回退的 4.5px 字号已删除)。
|
|
4075
|
+
labelPercent 缺失 / 非数字 / null ⇒ 同样留空:不退回弧长的 percent(那是团队级数据,
|
|
4076
|
+
|
|
4077
|
+
而且没有数据时 percent 也可能是 0,显示 "0" 会让用户误以为占用真的是 0)。 */
|
|
4078
|
+
const labelRaw = typeof labelPercent === "number" && Number.isFinite(labelPercent)
|
|
4079
|
+
? labelPercent
|
|
4080
|
+
: null;
|
|
4081
|
+
const labelRounded = labelRaw === null ? null : Math.round(Math.max(0, Math.min(100, labelRaw)));
|
|
4082
|
+
const ringLabel = labelRounded === null || labelRounded >= 100 ? "" : String(labelRounded);
|
|
4048
4083
|
const stateClass = state === "running" ? " dsb-ring-running"
|
|
4049
4084
|
: (state === "teamRunning" ? " dsb-ring-team"
|
|
4050
4085
|
: (state === "deepRunning" ? " dsb-ring-deep"
|
|
4051
4086
|
: (state === "error" ? " dsb-ring-error" : (state === "approval" ? " dsb-ring-approval" : ""))));
|
|
4052
|
-
const offset = METER_CIRCUMFERENCE * (1 -
|
|
4087
|
+
const offset = METER_CIRCUMFERENCE * (1 - displayPercent / 100);
|
|
4053
4088
|
const dashes = notchDashes(compact);
|
|
4054
|
-
|
|
4055
|
-
|
|
4089
|
+
/* 圆环 = 外层 span(相对定位,尺寸即 14px)套着 SVG(绝对铺满)+ 绝对定位居中的数字 span。
|
|
4090
|
+
数字改用 HTML 覆盖层强制居中(flex align/justify center),彻底不依赖 SVG text 的
|
|
4091
|
+
dominantBaseline 基线 —— 那套基线在不同渲染环境里会偏,用户实测"有点不居中"。
|
|
4092
|
+
数字只在 label 非空时渲染;100 与空数据留空(不生成节点)。 */
|
|
4093
|
+
const ringSvg = h("svg", {
|
|
4094
|
+
className: "dsb-ring", key: "__ring", viewBox: "0 0 14 14", width: 14, height: 14
|
|
4056
4095
|
},
|
|
4057
4096
|
h("circle", {
|
|
4058
4097
|
className: "dsb-ring-track", cx: 7, cy: 7, r: METER_RADIUS,
|
|
@@ -4067,7 +4106,16 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
4067
4106
|
/* SVG 的弧默认从 3 点方向起,整体转 -90° 才是官方那种"12 点起、顺时针长" */
|
|
4068
4107
|
transform: "rotate(-90 7 7)",
|
|
4069
4108
|
strokeDasharray: METER_CIRCUMFERENCE, strokeDashoffset: offset
|
|
4070
|
-
})
|
|
4109
|
+
})
|
|
4110
|
+
);
|
|
4111
|
+
const percentSpan = ringLabel === ""
|
|
4112
|
+
? null
|
|
4113
|
+
: h("span", {
|
|
4114
|
+
className: "dsb-ring-percent", key: "__pct", "aria-hidden": "true"
|
|
4115
|
+
}, ringLabel);
|
|
4116
|
+
return h("span", {
|
|
4117
|
+
className: "dsb-ring-wrap" + stateClass, key: "__ringwrap"
|
|
4118
|
+
}, percentSpan === null ? [ringSvg] : [ringSvg, percentSpan]);
|
|
4071
4119
|
}
|
|
4072
4120
|
|
|
4073
4121
|
/** 气泡自己那一圈描边的宽度(.dsb-tip 的 box-shadow spread:0 0 0 .5px):
|
|
@@ -6070,6 +6118,59 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
6070
6118
|
return { title: t("tipCreditsTitle"), totalText: totalText, rewards: rows };
|
|
6071
6119
|
}
|
|
6072
6120
|
|
|
6121
|
+
/**
|
|
6122
|
+
* 订阅型配额(Magpie 百分比窗口)→ **复用积分套餐面板**的数据形状。
|
|
6123
|
+
* 五小时/七天窗口各构成 creditsPanel 的一个 rewards 块:
|
|
6124
|
+
* { label: 本地化窗口名, valueText: '剩余 xx%', percent: 已用%, remainingText: '剩余 xx%' }
|
|
6125
|
+
* 进度条沿用 creditsPanel 的 barOf(.dsb-bar/.dsb-bar-seg,灰=剩余、透明=已用),
|
|
6126
|
+
* 行沿用 .dsb-meter-row —— 不新造组件、不新增 CSS,视觉与现有积分套餐一致。
|
|
6127
|
+
* 返回 null 表示没有可显示的窗口(此时调用方不给 quota 气泡)。
|
|
6128
|
+
*/
|
|
6129
|
+
/**
|
|
6130
|
+
* 单个百分比窗口 → creditsPanel 的 reward 形状(quotaPanelView 主行与 items 共用这一份映射)。
|
|
6131
|
+
* 输入 {key?, name, used, remaining},输出 {name,label,valueText,percent,remainingText}。
|
|
6132
|
+
* label 本地化:优先按 key(fiveHour/sevenDay)→ 再按 name 子串兜底 → 再原样/占位。
|
|
6133
|
+
*/
|
|
6134
|
+
function quotaRewardRow(one, t, fallbackLabel) {
|
|
6135
|
+
const used = Number(one.used);
|
|
6136
|
+
const remaining = Number(one.remaining);
|
|
6137
|
+
const usedPct = Math.max(0, Math.min(100, Number.isFinite(used) ? used : 0));
|
|
6138
|
+
const leftPct = (100 - usedPct).toFixed(2) + "%";
|
|
6139
|
+
let label;
|
|
6140
|
+
const key = typeof one.key === "string" ? one.key : "";
|
|
6141
|
+
const rawName = typeof one.name === "string" ? one.name.toLowerCase() : "";
|
|
6142
|
+
if (key === "fiveHour" || rawName.indexOf("5") >= 0 || rawName.indexOf("hour") >= 0) label = t("quotaFiveHour");
|
|
6143
|
+
else if (key === "sevenDay" || rawName.indexOf("7") >= 0 || rawName.indexOf("day") >= 0) label = t("quotaSevenDay");
|
|
6144
|
+
else label = typeof one.name === "string" && one.name.length > 0 ? one.name : (fallbackLabel !== undefined ? fallbackLabel : t("segBalance"));
|
|
6145
|
+
return { name: label, label: label, valueText: leftPct, percent: usedPct, remainingText: leftPct };
|
|
6146
|
+
}
|
|
6147
|
+
function quotaPanelView(windows, t) {
|
|
6148
|
+
const list = Array.isArray(windows) ? windows : [];
|
|
6149
|
+
const rows = [];
|
|
6150
|
+
list.forEach((one) => {
|
|
6151
|
+
if (one === null || one === undefined || typeof one !== "object") return;
|
|
6152
|
+
if (Number.isFinite(Number(one.used)) !== true || Number.isFinite(Number(one.remaining)) !== true) return;
|
|
6153
|
+
const main = quotaRewardRow(one, t);
|
|
6154
|
+
/* 逐账号明细(items):复用同一映射函数(账号名作 label、不带 key)。 */
|
|
6155
|
+
const rawItems = Array.isArray(one.items) ? one.items : [];
|
|
6156
|
+
const items = [];
|
|
6157
|
+
rawItems.forEach((it) => {
|
|
6158
|
+
if (it === null || it === undefined || typeof it !== "object") return;
|
|
6159
|
+
if (Number.isFinite(Number(it.used)) !== true || Number.isFinite(Number(it.remaining)) !== true) return;
|
|
6160
|
+
items.push(quotaRewardRow({ name: it.name, used: it.used, remaining: it.remaining }, t));
|
|
6161
|
+
});
|
|
6162
|
+
rows.push({
|
|
6163
|
+
name: main.name, label: main.label, valueText: main.valueText,
|
|
6164
|
+
percent: main.percent, remainingText: main.remainingText,
|
|
6165
|
+
count: items.length, items: items
|
|
6166
|
+
});
|
|
6167
|
+
});
|
|
6168
|
+
if (rows.length === 0) return null;
|
|
6169
|
+
/* totalText 填第一行剩余百分比(与行内 valueText 同源);此前是空串。 */
|
|
6170
|
+
const totalText = rows[0].valueText;
|
|
6171
|
+
return { title: t("segBalance"), totalText: totalText, rewards: rows };
|
|
6172
|
+
}
|
|
6173
|
+
|
|
6073
6174
|
/** 单次调用的缓存命中率(%);缓存字段没上报或没有输入 token 时返回 null(算不出可信比例)。 */
|
|
6074
6175
|
function hitRateOf(call) {
|
|
6075
6176
|
if (call === null || call === undefined) return null;
|
|
@@ -6721,12 +6822,20 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
6721
6822
|
宿主侧 `spent` 字段照旧返回(智谱适配器会给),但客户端一律不画 ——
|
|
6722
6823
|
这一行口径与「总计」不同源、又只在部分平台出现,
|
|
6723
6824
|
摆在同一张气泡里容易被当成同一个数字。 */
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6825
|
+
/* 订阅型配额(Magpie 百分比窗口):底栏文字仍按 quotaLeft(剩余)显示,不变;
|
|
6826
|
+
点击时若带非空 windows,则弹「五小时/七天」进度条面板(复用 creditsPanel)。
|
|
6827
|
+
其它口径(金额/积分/无窗口的配额)保持原 rows 气泡。 */
|
|
6828
|
+
const quotaPanel = isQuota === true && Array.isArray(balance.windows) && balance.windows.length > 0
|
|
6829
|
+
? quotaPanelView(balance.windows, t)
|
|
6830
|
+
: null;
|
|
6831
|
+
const tip = quotaPanel !== null
|
|
6832
|
+
? { kind: "quota", title: t("segBalance"), panel: quotaPanel }
|
|
6833
|
+
: {
|
|
6834
|
+
kind: "rows",
|
|
6835
|
+
title: t("segBalance"),
|
|
6836
|
+
segments: balanceSegments,
|
|
6837
|
+
rows: balanceRows
|
|
6838
|
+
};
|
|
6730
6839
|
/* 不足一分钱时官方显示 <¥0.01,这里跟着来 */
|
|
6731
6840
|
if (balance.subCent === true) return { id: id, text: t("f_balanceSubCent", { symbol: balSymbol }), tip: tip };
|
|
6732
6841
|
/* 底栏那行文字:**百分比配额走 `quotaLeft`(剩余),不走 `balance.total`(已用)**。
|
|
@@ -6844,7 +6953,13 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
6844
6953
|
* 整条规则挂在 html.dsb-on 上:这个类由插件挂载/卸载时增删(设置页里
|
|
6845
6954
|
* **没有**「启用状态栏」开关,别按那个理解)。卸下后官方原本的统计行与
|
|
6846
6955
|
* 上下文按钮随即恢复(否则关掉插件只剩一片空白)。 */
|
|
6847
|
-
|
|
6956
|
+
/* 只藏「含官方特征」的直接子节点(官方统计行包装层):用 :has() 认它是官方节点的祖先。
|
|
6957
|
+
第三方插件注册的直接子节点没有官方特征 ⇒ 不匹配 ⇒ 绝不误藏。 */
|
|
6958
|
+
'html.dsb-on [data-slot="conversation.composer.dock"] > *:not(.dsb-root):not(:has(.dsb-root)):has([data-composer-stat],button[aria-haspopup="dialog"][aria-label*="上下文"],button[aria-haspopup="dialog"][aria-label*="context used"],span[class$="_root"]>button[aria-haspopup="dialog"]){display:none !important}',
|
|
6959
|
+
/* 官方 InputBar 的 dock 根 [data-composer-dock]:同理只藏含官方特征的包装层,第三方直接子节点不动。 */
|
|
6960
|
+
'html.dsb-on [data-composer-dock] > *:not(.dsb-root):not(:has(.dsb-root)):has([data-composer-stat],button[aria-haspopup="dialog"][aria-label*="上下文"],button[aria-haspopup="dialog"][aria-label*="context used"],span[class$="_root"]>button[aria-haspopup="dialog"]){display:none !important}',
|
|
6961
|
+
/* 官方 StatsPills(活动 / 数据库用量)根节点固定带 data-composer-stat,直接隐藏。 */
|
|
6962
|
+
'html.dsb-on [data-composer-stat]{display:none !important}',
|
|
6848
6963
|
/* 官方新版在输入卡片下方右侧另有一个上下文占用按钮:已被本插件的圆环接管,藏掉它。
|
|
6849
6964
|
* 用 aria-label 认它(中文含"上下文"、英文含"context used",随语言变),不碰官方 hash 类名。 */
|
|
6850
6965
|
'html.dsb-on button[aria-haspopup="dialog"][aria-label*="上下文"],html.dsb-on button[aria-haspopup="dialog"][aria-label*="context used"]{display:none !important}',
|
|
@@ -6852,15 +6967,23 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
6852
6967
|
* 它的类名是 CSS module 的 <hash>_root / <hash>_trigger,hash 随构建变,因此按后缀认结构:
|
|
6853
6968
|
* root 外壳里包着带 aria-haspopup 的 trigger 按钮(trigger 本身没有 aria-label 可认)。 */
|
|
6854
6969
|
'html.dsb-on span[class$="_root"]>button[aria-haspopup="dialog"][class$="_trigger"]{display:none !important}',
|
|
6970
|
+
/* 消息操作行(MessageIconActions 的 [data-clock="end"])里的官方 TurnUsagePanel(「用量 6.6M tok」):
|
|
6971
|
+
* 上面的精确后缀选择器在真实 DOM 可能认不到,这里按行作用域再兜一层(只碰这一行内的按钮外壳,
|
|
6972
|
+
* 不会误伤 composer 或别的按钮)。 */
|
|
6973
|
+
'html.dsb-on [data-clock="end"] span[class$="_root"]{display:none !important}',
|
|
6974
|
+
'html.dsb-on [data-clock="end"] span:has(>button[aria-haspopup="dialog"]){display:none !important}',
|
|
6855
6975
|
".dsb-root{display:flex;align-items:center;justify-content:center;gap:2px;width:100%;max-width:var(--dsh-chat-content-width);box-sizing:border-box;padding:4px calc(var(--dsh-composer-side-clearance) + 16px) 0;margin:0 auto;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}",
|
|
6856
6976
|
/* 上下文占用:圆环、分段小条与分项面板都按官方 ContextMeter 的几何与配色复刻 */
|
|
6857
|
-
|
|
6977
|
+
".dsb-ring-wrap{position:relative;display:inline-flex;width:14px;height:14px;flex:none;align-items:center;justify-content:center}",
|
|
6978
|
+
".dsb-ring{position:absolute;inset:0;width:14px;height:14px}",
|
|
6858
6979
|
".dsb-ring-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:none;padding:3px;margin-right:5px;background:0 0;border:none;border-radius:50%;cursor:pointer;color:var(--dsw-alias-label-tertiary)}",
|
|
6859
6980
|
'.dsb-ring-btn:hover,.dsb-ring-btn[aria-expanded="true"]{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.1));color:var(--dsw-alias-label-secondary)}',
|
|
6860
6981
|
".dsb-seg-click{position:relative;cursor:pointer;border-radius:999px;padding:1px 6px;margin:0 -6px}",
|
|
6861
6982
|
'.dsb-seg-click:hover,.dsb-seg-click[aria-expanded="true"]{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.1));color:var(--dsw-alias-label-secondary)}',
|
|
6862
6983
|
".dsb-ring-track{fill:none;stroke:var(--dsw-alias-border-l3,rgba(127,127,127,.25));stroke-width:2px}",
|
|
6863
6984
|
".dsb-ring-fill{fill:none;stroke:var(--dsw-alias-label-tertiary);stroke-width:2px;stroke-linecap:round}",
|
|
6985
|
+
/* 环心的占用数字:填色跟随主题文字色、细字重、不吃鼠标事件(否则会挡住圆环按钮的点击/悬停) */
|
|
6986
|
+
".dsb-ring-percent{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:12px;transform:scale(0.5);transform-origin:center center;font-weight:600;line-height:1;pointer-events:none;color:var(--dsw-alias-label-secondary,currentColor);font-variant-numeric:tabular-nums}",
|
|
6864
6987
|
/* 运行时:绿色那段在淡灰圆圈里匀速转,像加载圈。
|
|
6865
6988
|
-90° 必须写进关键帧:circle 上的 SVG transform="rotate(-90 7 7)"(把弧的起点挪到 12 点)
|
|
6866
6989
|
会被 CSS transform 整个覆盖,不写回来就会从 3 点起、看起来跑偏。
|
|
@@ -9636,6 +9759,8 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
9636
9759
|
/* 积分套餐气泡的下钻层:null = 根视图,数字 = 点开了第几个聚合行(×N 那行)。
|
|
9637
9760
|
换字段 / 收起气泡 / 点标题返回都清掉,下次打开回到套餐列表。 */
|
|
9638
9761
|
const [creditSub, setCreditSub] = react.useState(null);
|
|
9762
|
+
/* 订阅配额下钻的独立下标(与积分套餐 creditSub 分开,互不串状态)。 */
|
|
9763
|
+
const [quotaSub, setQuotaSub] = react.useState(null);
|
|
9639
9764
|
/* 子视图「每列几行」:默认 3 行一列;量到一排放不下(列被折到下一排)就
|
|
9640
9765
|
逐档 +1(最多 12 行,见下面气泡定位那条 layout effect)。换字段 / 换子视图都重置回 3。
|
|
9641
9766
|
**名字保留 `toolRows`(历史原因),但它现在服务三个列表**:工具调用、技能注入、
|
|
@@ -10117,7 +10242,7 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
10117
10242
|
跟着 scroll 收起的话,气泡会在这些时刻莫名其妙消失。 */
|
|
10118
10243
|
react.useEffect(() => {
|
|
10119
10244
|
if (tipId === null) return undefined;
|
|
10120
|
-
const close = () => { setTipId(null); setTipPos(null); setTipSub(null); setCreditSub(null); };
|
|
10245
|
+
const close = () => { setTipId(null); setTipPos(null); setTipSub(null); setCreditSub(null); setQuotaSub(null); };
|
|
10121
10246
|
/**
|
|
10122
10247
|
* 点面板外部就收起。
|
|
10123
10248
|
*
|
|
@@ -10383,34 +10508,131 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
10383
10508
|
}
|
|
10384
10509
|
}, [tipId]);
|
|
10385
10510
|
|
|
10386
|
-
/* 开关状态同步到 <html>:CSS
|
|
10387
|
-
官方「活动 / 用量 / 上下文」节点会重新插回 dock 的嵌套层,光靠 CSS
|
|
10388
|
-
|
|
10511
|
+
/* 开关状态同步到 <html>:CSS 里那几条"藏官方底栏"的规则挂在 html.dsb-on 上。
|
|
10512
|
+
官方「活动 / 用量 / 上下文」节点会重新插回 dock 的嵌套层,光靠 CSS 的直系子节点规则藏不住。
|
|
10513
|
+
|
|
10514
|
+
**3.0.7 起只认官方节点**(用户拍板):旧做法是"从 .dsb-root 逐层向上到 dock,把同层
|
|
10515
|
+
所有非本插件兄弟节点全部 display:none"。那会把第三方插件**后插入**的节点也一并误藏
|
|
10516
|
+
(它们既不是官方节点、也不是本插件)。现在改成用与 CSS 相同的官方选择器精确定位、
|
|
10517
|
+
**只隐藏这些官方节点**:
|
|
10518
|
+
· button[aria-haspopup="dialog"][aria-label*="上下文"] / [aria-label*="context used"]
|
|
10519
|
+
· span[class$="_root"]>button[aria-haspopup="dialog"][class$="_trigger"]
|
|
10520
|
+
第三方插件节点不匹配这些选择器,就永远不会被我们碰。
|
|
10521
|
+
|
|
10522
|
+
**MutationObserver 只在"新增节点匹配(或包含匹配)官方选择器"时重扫一次**:普通流式
|
|
10523
|
+
文字变化不触发,避免每帧空转卡顿。卸载时只还原被我们隐藏过的官方节点。 */
|
|
10389
10524
|
react.useEffect(() => {
|
|
10390
10525
|
if (typeof document === "undefined" || document === null) return undefined;
|
|
10391
10526
|
const root = document.documentElement;
|
|
10392
10527
|
if (root === null || root === undefined || root.classList === undefined) return undefined;
|
|
10393
10528
|
root.classList.add("dsb-on");
|
|
10394
|
-
|
|
10395
|
-
const
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10529
|
+
/* 与 CSS 里那几条官方规则同源的官方选择器;顺序无关,匹配任一即算官方节点。 */
|
|
10530
|
+
const OFFICIAL_SELECTORS = [
|
|
10531
|
+
'button[aria-haspopup="dialog"][aria-label*="上下文"]',
|
|
10532
|
+
'button[aria-haspopup="dialog"][aria-label*="context used"]',
|
|
10533
|
+
'span[class$="_root"]>button[aria-haspopup="dialog"][class$="_trigger"]',
|
|
10534
|
+
'[data-composer-stat]',
|
|
10535
|
+
'[data-clock="end"] span:has(>button[aria-haspopup="dialog"])'
|
|
10536
|
+
];
|
|
10537
|
+
const OFFICIAL = OFFICIAL_SELECTORS.join(",");
|
|
10538
|
+
/* el -> 我们改之前它的行内 display(可能为空串),卸载时逐个还原 */
|
|
10539
|
+
const hidden = new Map();
|
|
10540
|
+
/* 官方 InputBar 的 dock 根节点是 [data-composer-dock](.dock),把 slot 与
|
|
10541
|
+
ContextMeter/图标等官方兄弟节点都放进去;slot 只是它的子节点之一。优先查这个根,
|
|
10542
|
+
老结构没有时退回 slot(行为不变)。 */
|
|
10543
|
+
const dockOf = () => document.querySelector("[data-composer-dock]")
|
|
10544
|
+
|| document.querySelector('[data-slot="conversation.composer.dock"]');
|
|
10545
|
+
/* 独立隐藏一个节点(记下原行内 display,卸载还原),由 sweep 复用。 */
|
|
10546
|
+
const hideNode = (node) => {
|
|
10547
|
+
if (node === null || node === undefined || node.nodeType !== 1) return;
|
|
10548
|
+
if (node.style.display !== "none") {
|
|
10549
|
+
if (!hidden.has(node)) hidden.set(node, node.style.display);
|
|
10550
|
+
node.style.display = "none";
|
|
10551
|
+
}
|
|
10552
|
+
};
|
|
10553
|
+
/* 只藏**官方节点**以及它向上最近的、直属 dock 的包装层:
|
|
10554
|
+
· 先藏 dock 子树里匹配 OFFICIAL 的所有节点;
|
|
10555
|
+
· 再对每个官方节点,向上找它「最近的、parent 恰为 dock 的祖先」,一起藏掉
|
|
10556
|
+
(官方有时把 ContextMeter/StatsPills 包在一层外壳 div 里,那层本身不带官方特征)。
|
|
10557
|
+
**绝不无条件隐藏 dock 的其他直接子节点** —— 第三方插件后插入的直接子节点
|
|
10558
|
+
只要没有任何官方特征,一律不碰(旧写法会把它们一起藏掉,实测误伤)。 */
|
|
10559
|
+
const sweep = () => {
|
|
10560
|
+
const dock = dockOf();
|
|
10561
|
+
if (dock === null || dock === undefined) return null;
|
|
10562
|
+
const officials = Array.from(dock.querySelectorAll(OFFICIAL));
|
|
10563
|
+
officials.forEach(hideNode);
|
|
10564
|
+
officials.forEach((node) => {
|
|
10565
|
+
let cur = node;
|
|
10566
|
+
while (cur !== null && cur !== undefined && cur.parentNode !== null && cur.parentNode !== dock) {
|
|
10567
|
+
cur = cur.parentNode;
|
|
10568
|
+
}
|
|
10569
|
+
/* cur 现在要么是 dock 的直接子节点(parent=dock),要么是 dock 本身/越界。
|
|
10570
|
+
双重保险:它自身是 .dsb-root、或**包含** .dsb-root(官方与本插件根同层)时都不藏,
|
|
10571
|
+
否则会把整层连本插件状态栏一起藏掉。 */
|
|
10572
|
+
if (cur !== null && cur !== undefined && cur !== dock && cur.nodeType === 1
|
|
10573
|
+
&& !(cur.classList !== undefined && cur.classList.contains("dsb-root"))
|
|
10574
|
+
&& !(typeof cur.querySelector === "function" && cur.querySelector(".dsb-root") !== null)) {
|
|
10575
|
+
hideNode(cur);
|
|
10576
|
+
}
|
|
10577
|
+
});
|
|
10578
|
+
return dock;
|
|
10579
|
+
};
|
|
10580
|
+
/* 新增节点里有没有"官方节点":自己匹配,或子树里含匹配(官方有时整体替换一层外壳)。 */
|
|
10581
|
+
const touchesOfficial = (node) => {
|
|
10582
|
+
if (node === null || node === undefined || node.nodeType !== 1) return false;
|
|
10583
|
+
if (typeof node.matches === "function" && node.matches(OFFICIAL)) return true;
|
|
10584
|
+
return typeof node.querySelector === "function" && node.querySelector(OFFICIAL) !== null;
|
|
10585
|
+
};
|
|
10586
|
+
sweep();
|
|
10587
|
+
/* 只观察 childList:我们自己写 display 是 attribute 变动,不观察它就不会自激。
|
|
10588
|
+
老环境 / 测试替身没有 MutationObserver 时退回"只清扫一次",行为不退化。 */
|
|
10589
|
+
let observer = null;
|
|
10590
|
+
let classObserver = null;
|
|
10591
|
+
if (typeof MutationObserver === "function") {
|
|
10592
|
+
observer = new MutationObserver((records) => {
|
|
10593
|
+
/* 仍用 touchesOfficial 过滤:只有新增节点牵涉官方节点才重扫。
|
|
10594
|
+
普通流式文本每帧新增的节点不命中官方选择器 ⇒ 不触发,避免卡顿。 */
|
|
10595
|
+
let relevant = false;
|
|
10596
|
+
for (const record of records) {
|
|
10597
|
+
const added = record.addedNodes;
|
|
10598
|
+
for (let i = 0; i < added.length; i += 1) {
|
|
10599
|
+
if (touchesOfficial(added[i])) { relevant = true; break; }
|
|
10600
|
+
}
|
|
10601
|
+
if (relevant) break;
|
|
10602
|
+
}
|
|
10603
|
+
/* 只有真正牵涉官方节点才重扫;但**有新增节点时也轻扫一次**很难两全 ——
|
|
10604
|
+
这里坚持必须命中官方节点才 sweep(防止流式文本每帧重扫)。 */
|
|
10605
|
+
if (relevant) sweep();
|
|
10606
|
+
});
|
|
10607
|
+
sweep();
|
|
10608
|
+
/* 更稳的通用观察:看 document.body(无 body 退回 documentElement)的 childList+subtree。
|
|
10609
|
+
打开侧栏可能替换整个 dock 或把官方节点插到深层子树,固定观察旧 dockRoot 会漏。
|
|
10610
|
+
sweep 内部 dockOf() 每次重新查 [data-composer-dock],dock 被替换也能压住新树。 */
|
|
10611
|
+
const observeRoot = (document.body !== null && document.body !== undefined)
|
|
10612
|
+
? document.body
|
|
10613
|
+
: document.documentElement;
|
|
10614
|
+
if (observeRoot !== null && observeRoot !== undefined) {
|
|
10615
|
+
observer.observe(observeRoot, { childList: true, subtree: true });
|
|
10616
|
+
}
|
|
10617
|
+
/* 额外盯 documentElement 的 class:html.dsb-on 被意外移除(官方重插根节点)时补回。 */
|
|
10618
|
+
if (typeof document.documentElement !== "undefined" && document.documentElement !== null
|
|
10619
|
+
&& document.documentElement.classList !== undefined) {
|
|
10620
|
+
classObserver = new MutationObserver(() => {
|
|
10621
|
+
if (document.documentElement.classList.contains("dsb-on") !== true) {
|
|
10622
|
+
document.documentElement.classList.add("dsb-on");
|
|
10623
|
+
sweep();
|
|
10406
10624
|
}
|
|
10407
10625
|
});
|
|
10408
|
-
|
|
10626
|
+
classObserver.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
|
|
10409
10627
|
}
|
|
10410
10628
|
}
|
|
10411
10629
|
return () => {
|
|
10630
|
+
if (observer !== null) observer.disconnect();
|
|
10631
|
+
if (classObserver !== null) classObserver.disconnect();
|
|
10632
|
+
/* 只移除我们加的 dsb-on;用户自己可能也加了同名类,但我们只在自己挂载时加过它,
|
|
10633
|
+
这里移除与旧行为一致(卸载即恢复官方原貌)。 */
|
|
10412
10634
|
root.classList.remove("dsb-on");
|
|
10413
|
-
hidden.forEach((
|
|
10635
|
+
hidden.forEach((prev, el) => { el.style.display = prev; });
|
|
10414
10636
|
};
|
|
10415
10637
|
}, []);
|
|
10416
10638
|
|
|
@@ -10573,6 +10795,7 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
10573
10795
|
/* 换字段(含收起)一律回到根视图,别把上一个字段的下钻层带过来 */
|
|
10574
10796
|
setTipSub(null);
|
|
10575
10797
|
setCreditSub(null);
|
|
10798
|
+
setQuotaSub(null);
|
|
10576
10799
|
/* 工具调用子视图的行数也回到默认 3:换字段 / 重开都重新量 */
|
|
10577
10800
|
setToolRows(LIST_ROWS_PER_COLUMN);
|
|
10578
10801
|
/* 悬停整组开关也必须复位(用户拍板的那条「放不下就全不显示」)。
|
|
@@ -10632,6 +10855,16 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
10632
10855
|
back: () => setCreditSub(null)
|
|
10633
10856
|
});
|
|
10634
10857
|
}
|
|
10858
|
+
if (tip.kind === "quota") {
|
|
10859
|
+
/* 订阅型配额窗口(五小时/七天):复用 creditsPanel,每个窗口一行 + 一条 .dsb-bar。
|
|
10860
|
+
count>1 的聚合行(多账号)可点下钻,子视图逐账号列出 5h/7d 各自剩余。
|
|
10861
|
+
下钻用**独立 quotaSub** 状态(不与积分套餐 creditSub 串),toggleTip/close 都会清空。 */
|
|
10862
|
+
return creditsPanel(tip.panel, tip.title, tipPos, tipRef, {
|
|
10863
|
+
id: quotaSub,
|
|
10864
|
+
open: (index) => setQuotaSub(index),
|
|
10865
|
+
back: () => setQuotaSub(null)
|
|
10866
|
+
});
|
|
10867
|
+
}
|
|
10635
10868
|
if (tip.kind === "meter") return meterPanel(tip.meter, t, tipPos, tipRef);
|
|
10636
10869
|
if (tip.kind === "bars") return weekBarsPanel(tip, t, tipPos, tipRef, onHover, { week: hoverWeek, bar: hoverBar });
|
|
10637
10870
|
return rowsPanel(tip, tipPos, tipRef, {
|
|
@@ -10688,7 +10921,11 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
10688
10921
|
: subagentTiers;
|
|
10689
10922
|
const ringPercent = ringPercentOf(contextMeter, agentState, ringTiers);
|
|
10690
10923
|
/* 圆环自己就是触发项:点开上下文占用面板;峰谷那两个字不带气泡 */
|
|
10691
|
-
|
|
10924
|
+
/* 用户拍板:气泡(以及环心数字)恢复成**主会话自己**的 contextMeter,
|
|
10925
|
+
不再用 ringPercent 覆盖 percent —— ringPercent 只驱动弧长,是"团队级"数据。 */
|
|
10926
|
+
const contextTip = contextMeter === null
|
|
10927
|
+
? null
|
|
10928
|
+
: { kind: "meter", meter: contextMeter };
|
|
10692
10929
|
const children = [];
|
|
10693
10930
|
if (contextTip !== null) {
|
|
10694
10931
|
children.push(h("button", {
|
|
@@ -10698,7 +10935,8 @@ function setModelCurrency(name, code, draftNow) {
|
|
|
10698
10935
|
"aria-expanded": tipId === "context" ? "true" : "false",
|
|
10699
10936
|
onClick: (event) => toggleTip("context", event)
|
|
10700
10937
|
}, [
|
|
10701
|
-
|
|
10938
|
+
/* 弧长用 ringPercent(谁在跑切数据源),环心数字用 contextMeter.percent(主会话自己) */
|
|
10939
|
+
contextRing(ringPercent, agentState, contextMeter.compact, contextMeter.empty === true ? null : contextMeter.percent),
|
|
10702
10940
|
tipId === "context" ? tipPanelOf(contextTip) : null
|
|
10703
10941
|
]));
|
|
10704
10942
|
}
|