mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-27 01:19:25 +08:00
feat(panel): Orchestrator compatibility, ID display toggle, and Hydrogen pricing (v1.4.5)
This commit is contained in:
@@ -51,7 +51,7 @@ The dashboard is organized into four tabs, with a top header to switch conversat
|
|||||||
- **Preferences**
|
- **Preferences**
|
||||||
- **Mount Mode**: Dual-mount (Top Bar + Sidebar) or Sidebar only.
|
- **Mount Mode**: Dual-mount (Top Bar + Sidebar) or Sidebar only.
|
||||||
- **Top-Bar Customization**: Independently toggle the live running-sessions indicator, and customize the content and left-to-right order of the three metric slots in the capsule.
|
- **Top-Bar Customization**: Independently toggle the live running-sessions indicator, and customize the content and left-to-right order of the three metric slots in the capsule.
|
||||||
- **Model Name Format**: Compact short alias (e.g. `argon-4-high`) or raw upstream model ID (e.g. `gemini-3.8-flash-n`).
|
- **Model Name Format**: Compact short alias (e.g. `argon-4-high`) or raw upstream model ID (e.g. `gemini-3.8-flash-n`), plus an independent Orchestrator series ID selector (`orchestrator-argon` / `worker-agy-hydrogen` compact mode by default, or full annotated IDs).
|
||||||
- **Version Updates & Pricing Sync**: Dynamically sync [`pricing-catalog.json`](pricing-catalog.json) from GitHub, with three update modes: *Notify only, manual update* (default), *Auto update*, and *Off*.
|
- **Version Updates & Pricing Sync**: Dynamically sync [`pricing-catalog.json`](pricing-catalog.json) from GitHub, with three update modes: *Notify only, manual update* (default), *Auto update*, and *Off*.
|
||||||
|
|
||||||
## Model Identification & Cost Accounting
|
## Model Identification & Cost Accounting
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@
|
|||||||
- **偏好设置**
|
- **偏好设置**
|
||||||
- 选择面板挂载方式:双栖挂载(顶部栏 + 侧边栏)或仅侧边栏。
|
- 选择面板挂载方式:双栖挂载(顶部栏 + 侧边栏)或仅侧边栏。
|
||||||
- 顶部栏定制:独立开关实时运行会话入口,并自由定义右侧三个指标槽位的显示内容与排列顺序。
|
- 顶部栏定制:独立开关实时运行会话入口,并自由定义右侧三个指标槽位的显示内容与排列顺序。
|
||||||
- 选择模型名称格式:精简代号或原始模型 ID。
|
- 选择模型名称格式:精简代号或原始模型 ID,并可独立设置 Orchestrator 系列显示精简代号(如 `orchestrator-argon`、`worker-agy-hydrogen`)或原始完整 ID。
|
||||||
- 版本更新与价格表同步:支持从云端 [`pricing-catalog.json`](pricing-catalog.json) 动态同步最新模型价格表,并提供「仅提示新版本,手动更新」(默认)、「自动更新」与「关闭更新」三档更新方式。
|
- 版本更新与价格表同步:支持从云端 [`pricing-catalog.json`](pricing-catalog.json) 动态同步最新模型价格表,并提供「仅提示新版本,手动更新」(默认)、「自动更新」与「关闭更新」三档更新方式。
|
||||||
|
|
||||||
## 模型识别与费用口径
|
## 模型识别与费用口径
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "usage-monitor",
|
"name": "usage-monitor",
|
||||||
"displayName": "Usage & Speed Monitor",
|
"displayName": "Usage & Speed Monitor",
|
||||||
"version": "1.4.4",
|
"version": "1.4.5",
|
||||||
"description": "实时查看生成速度、首字延迟、上下文占用、可用额度及历史用量。",
|
"description": "实时查看生成速度、首字延迟、上下文占用、可用额度及历史用量。",
|
||||||
"logo": "assets/logo.svg",
|
"logo": "assets/logo.svg",
|
||||||
"suggestedPrompts": [
|
"suggestedPrompts": [
|
||||||
|
|||||||
+30
-13
@@ -1,12 +1,16 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"catalogVersion": "2026.11.12.1",
|
"catalogVersion": "2026.11.13.3",
|
||||||
"updatedAt": "2026-11-13T13:20:00+09:00",
|
"updatedAt": "2026-11-13T17:10:00+09:00",
|
||||||
"latestPluginVersion": "1.4.4",
|
"latestPluginVersion": "1.4.5",
|
||||||
"releaseUrl": "https://github.com/yuhuan-dev/antigravity-usage-monitor/releases/latest",
|
"releaseUrl": "https://github.com/yuhuan-dev/antigravity-usage-monitor/releases/latest",
|
||||||
"downloadUrl": "https://github.com/yuhuan-dev/antigravity-usage-monitor/releases/latest/download/usage-monitor.zip",
|
"downloadUrl": "https://github.com/yuhuan-dev/antigravity-usage-monitor/releases/latest/download/usage-monitor.zip",
|
||||||
"archiveFallbackUrl": "https://codeload.github.com/yuhuan-dev/antigravity-usage-monitor/zip/refs/heads/main",
|
"archiveFallbackUrl": "https://codeload.github.com/yuhuan-dev/antigravity-usage-monitor/zip/refs/heads/main",
|
||||||
"pricing": {
|
"pricing": {
|
||||||
|
"gemini-pro-orchestrator": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "orch-carbon", "family": "Gemini" },
|
||||||
|
"orchestrator-carbon": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "orch-carbon", "family": "Gemini" },
|
||||||
|
"gemini-pro-orchestrator-argon": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "orch-argon", "family": "Gemini" },
|
||||||
|
"orchestrator-argon": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "orch-argon", "family": "Gemini" },
|
||||||
"gemini-4-carbon-high": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4-high", "family": "Gemini" },
|
"gemini-4-carbon-high": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4-high", "family": "Gemini" },
|
||||||
"gemini-4-carbon-medium": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4", "family": "Gemini" },
|
"gemini-4-carbon-medium": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4", "family": "Gemini" },
|
||||||
"gemini-4-carbon-low": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4-low", "family": "Gemini" },
|
"gemini-4-carbon-low": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4-low", "family": "Gemini" },
|
||||||
@@ -15,16 +19,19 @@
|
|||||||
"gemini-4-argon-medium": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "argon-4", "family": "Gemini" },
|
"gemini-4-argon-medium": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "argon-4", "family": "Gemini" },
|
||||||
"gemini-4-argon-low": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "argon-4-low", "family": "Gemini" },
|
"gemini-4-argon-low": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "argon-4-low", "family": "Gemini" },
|
||||||
"gemini-4-argon": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "argon-4", "family": "Gemini" },
|
"gemini-4-argon": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "argon-4", "family": "Gemini" },
|
||||||
"gemini-4-hydrogen-high": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen-4-high", "family": "Gemini" },
|
"gemini-4-hydrogen-xhigh": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4-xhigh", "family": "Gemini" },
|
||||||
"gemini-4-hydrogen-medium": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen-4", "family": "Gemini" },
|
"gemini-4-hydrogen-high": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4-high", "family": "Gemini" },
|
||||||
"gemini-4-hydrogen-low": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "hydrogen-4-low", "family": "Gemini" },
|
"gemini-4-hydrogen-medium": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4", "family": "Gemini" },
|
||||||
"gemini-4-hydrogen-tiered": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen-4", "family": "Gemini" },
|
"gemini-4-hydrogen-low": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4-low", "family": "Gemini" },
|
||||||
"gemini-4-hydrogen": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen-4", "family": "Gemini" },
|
"gemini-4-hydrogen-tiered": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4", "family": "Gemini" },
|
||||||
"gemini-hydrogen-high": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen-high", "family": "Gemini" },
|
"gemini-4-hydrogen": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4", "family": "Gemini" },
|
||||||
"gemini-hydrogen-medium": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen", "family": "Gemini" },
|
"gemini-flash-worker-agy": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4", "family": "Gemini" },
|
||||||
"gemini-hydrogen-low": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen-low", "family": "Gemini" },
|
"gemini-hydrogen-xhigh": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-xhigh", "family": "Gemini" },
|
||||||
"gemini-hydrogen-tiered": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen", "family": "Gemini" },
|
"gemini-hydrogen-high": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-high", "family": "Gemini" },
|
||||||
"gemini-hydrogen": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen", "family": "Gemini" },
|
"gemini-hydrogen-medium": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen", "family": "Gemini" },
|
||||||
|
"gemini-hydrogen-low": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-low", "family": "Gemini" },
|
||||||
|
"gemini-hydrogen-tiered": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen", "family": "Gemini" },
|
||||||
|
"gemini-hydrogen": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen", "family": "Gemini" },
|
||||||
"gemini-4-helix-high": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "helix-4-high", "family": "Gemini" },
|
"gemini-4-helix-high": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "helix-4-high", "family": "Gemini" },
|
||||||
"gemini-4-helix-medium": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "helix-4", "family": "Gemini" },
|
"gemini-4-helix-medium": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "helix-4", "family": "Gemini" },
|
||||||
"gemini-4-helix-low": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "helix-4-low", "family": "Gemini" },
|
"gemini-4-helix-low": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "helix-4-low", "family": "Gemini" },
|
||||||
@@ -128,7 +135,17 @@
|
|||||||
"gpt-oss-120b-medium": { "input": 0.80, "cache": 0.10, "output": 2.40, "short": "gpt-oss", "family": "GPT" }
|
"gpt-oss-120b-medium": { "input": 0.80, "cache": 0.10, "output": 2.40, "short": "gpt-oss", "family": "GPT" }
|
||||||
},
|
},
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
|
"MODEL_PLACEHOLDER_M667": { "modelId": "gemini-pro-orchestrator", "label": "Orchestrator (Carbon)" },
|
||||||
|
"MODEL_PLACEHOLDER_M681": { "modelId": "gemini-pro-orchestrator-argon", "label": "Orchestrator (Argon)" },
|
||||||
|
"MODEL_PLACEHOLDER_M669": { "modelId": "gemini-flash-worker-agy", "label": "Orchestrator Worker (Hydrogen)" },
|
||||||
"MODEL_PLACEHOLDER_M429": { "modelId": "gemini-4-carbon-high", "label": "Gemini 4 Carbon (High)" },
|
"MODEL_PLACEHOLDER_M429": { "modelId": "gemini-4-carbon-high", "label": "Gemini 4 Carbon (High)" },
|
||||||
|
"MODEL_PLACEHOLDER_M427": { "modelId": "gemini-4-carbon-high", "label": "Gemini 4 Carbon (High)" },
|
||||||
|
"MODEL_PLACEHOLDER_M437": { "modelId": "gemini-4-carbon-medium", "label": "Gemini 4 Carbon (Medium)" },
|
||||||
|
"MODEL_PLACEHOLDER_M438": { "modelId": "gemini-4-carbon-low", "label": "Gemini 4 Carbon (Low)" },
|
||||||
|
"MODEL_PLACEHOLDER_M528": { "modelId": "gemini-4-hydrogen-xhigh", "label": "Gemini 4 Hydrogen (XHigh)" },
|
||||||
|
"MODEL_PLACEHOLDER_M525": { "modelId": "gemini-4-hydrogen-high", "label": "Gemini 4 Hydrogen (High)" },
|
||||||
|
"MODEL_PLACEHOLDER_M526": { "modelId": "gemini-4-hydrogen-medium", "label": "Gemini 4 Hydrogen (Medium)" },
|
||||||
|
"MODEL_PLACEHOLDER_M527": { "modelId": "gemini-4-hydrogen-low", "label": "Gemini 4 Hydrogen (Low)" },
|
||||||
"MODEL_PLACEHOLDER_M417": { "modelId": "gemini-4-argon-high", "label": "Gemini 4 Argon (High)" },
|
"MODEL_PLACEHOLDER_M417": { "modelId": "gemini-4-argon-high", "label": "Gemini 4 Argon (High)" },
|
||||||
"MODEL_PLACEHOLDER_M418": { "modelId": "gemini-4-argon-medium", "label": "Gemini 4 Argon (Medium)" },
|
"MODEL_PLACEHOLDER_M418": { "modelId": "gemini-4-argon-medium", "label": "Gemini 4 Argon (Medium)" },
|
||||||
"MODEL_PLACEHOLDER_M419": { "modelId": "gemini-4-argon-low", "label": "Gemini 4 Argon (Low)" },
|
"MODEL_PLACEHOLDER_M419": { "modelId": "gemini-4-argon-low", "label": "Gemini 4 Argon (Low)" },
|
||||||
|
|||||||
+209
-47
@@ -632,6 +632,105 @@ function formatElapsedSec(seconds) {
|
|||||||
return `${h}h ${remM}m`;
|
return `${h}h ${remM}m`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 归一化 Orchestrator 系列 ID 显示格式枚举(`'compact'` 精简代号 vs `'full'` 原始完整 ID,默认 `'compact'`)。
|
||||||
|
*
|
||||||
|
* @param {unknown} mode
|
||||||
|
* @returns {'compact'|'full'}
|
||||||
|
*/
|
||||||
|
function normalizeOrchestratorIdDisplayMode(mode) {
|
||||||
|
return String(mode ?? '').trim().toLowerCase() === 'full' ? 'full' : 'compact';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一解析步骤、会话摘要或模型汇总行面向用户的模型显示文本与悬停提示。
|
||||||
|
*
|
||||||
|
* 规则:
|
||||||
|
* - Orchestrator 系列(`Orchestrator (Carbon)`、`Orchestrator (Argon)`、`gemini-flash-worker-agy` / `M669`)
|
||||||
|
* 独立遵循 `orchestratorIdMode`(`'compact'` 显示 `orchestrator-carbon` / `orchestrator-argon` / `worker-agy-hydrogen`;
|
||||||
|
* `'full'` 显示带括号标注的完整上游 ID),不受普通模型“精简代号 / 原始模型 ID”切换影响;
|
||||||
|
* - 其余普通模型继续按 `showUpstreamModel` 与视图选项切换。
|
||||||
|
*
|
||||||
|
* @param {object|null|undefined} target
|
||||||
|
* @param {{ showUpstreamModel?: boolean, orchestratorIdMode?: string }|boolean} [settings]
|
||||||
|
* @param {{ preferLabelInShort?: boolean, fallback?: string }} [options]
|
||||||
|
* @returns {{ text: string, title: string, isOrchestratorSeries: boolean }}
|
||||||
|
*/
|
||||||
|
function resolveModelDisplayInfo(target, settings = {}, options = {}) {
|
||||||
|
const showUpstream =
|
||||||
|
typeof settings === 'boolean' ? settings : Boolean(settings?.showUpstreamModel);
|
||||||
|
const orchestratorMode = normalizeOrchestratorIdDisplayMode(
|
||||||
|
typeof settings === 'object' && settings ? settings.orchestratorIdMode : 'compact'
|
||||||
|
);
|
||||||
|
const preferLabelInShort = Boolean(options?.preferLabelInShort);
|
||||||
|
const fallback = options?.fallback ?? '模型未知';
|
||||||
|
|
||||||
|
if (!target || typeof target !== 'object') {
|
||||||
|
return { text: fallback, title: fallback, isOrchestratorSeries: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
const shortText = String(
|
||||||
|
target.activeModelShort ?? target.modelShort ?? target.shortName ?? ''
|
||||||
|
).trim();
|
||||||
|
const labelText = String(
|
||||||
|
target.activeModelLabel ?? target.modelLabel ?? target.label ?? ''
|
||||||
|
).trim();
|
||||||
|
const upstreamText = String(
|
||||||
|
target.activeModelUpstream ?? target.modelUpstream ?? target.upstreamName ?? ''
|
||||||
|
).trim();
|
||||||
|
const responseText = String(target.responseModel ?? '').trim();
|
||||||
|
const modelKeyText = String(target.modelKey ?? '').trim();
|
||||||
|
|
||||||
|
const isCompaction =
|
||||||
|
Boolean(target.isCompactionStep) ||
|
||||||
|
/·压缩\s*$/.test(shortText) ||
|
||||||
|
/·压缩\s*$/.test(upstreamText) ||
|
||||||
|
/·压缩\s*$/.test(labelText);
|
||||||
|
|
||||||
|
const combined = `${modelKeyText} ${shortText} ${labelText} ${upstreamText} ${responseText}`;
|
||||||
|
const isOrchWorker =
|
||||||
|
/\bMODEL_PLACEHOLDER_M669\b|\b[a-z0-9.-]*worker-agy\b|\bworker-agy-hydrogen\b|\bOrchestrator\s+Worker\b/i.test(
|
||||||
|
combined
|
||||||
|
);
|
||||||
|
const isOrchSeries =
|
||||||
|
isOrchWorker ||
|
||||||
|
/\bgemini-pro-orchestrator(?:-argon)?\b|\borchestrator-(?:carbon|argon)\b|\borch-(?:carbon|argon)(?:·压缩)?(?=\s|$)|Orchestrator\s*\((?:Carbon|Argon)\)|\bMODEL_PLACEHOLDER_M(?:667|681)\b/i.test(
|
||||||
|
combined
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isOrchSeries) {
|
||||||
|
let compactId = 'orchestrator-carbon';
|
||||||
|
let fullId = 'gemini-pro-orchestrator (carbon-4)';
|
||||||
|
if (isOrchWorker) {
|
||||||
|
compactId = 'worker-agy-hydrogen';
|
||||||
|
fullId = 'gemini-flash-worker-agy (hydrogen-4)';
|
||||||
|
} else if (/\bargon\b|\bMODEL_PLACEHOLDER_M681\b|\borch-argon\b/i.test(combined)) {
|
||||||
|
compactId = 'orchestrator-argon';
|
||||||
|
fullId = 'gemini-pro-orchestrator-argon (argon-4)';
|
||||||
|
}
|
||||||
|
const suffix = isCompaction ? '·压缩' : '';
|
||||||
|
const text = `${orchestratorMode === 'full' ? fullId : compactId}${suffix}`;
|
||||||
|
const multiUpstream =
|
||||||
|
Array.isArray(target.upstreamModels) && target.upstreamModels.length > 1
|
||||||
|
? target.upstreamModels.join(' / ')
|
||||||
|
: '';
|
||||||
|
const title = multiUpstream || `${fullId}${suffix}`;
|
||||||
|
return { text, title, isOrchestratorSeries: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
const standardText =
|
||||||
|
(showUpstream
|
||||||
|
? upstreamText || responseText || shortText || labelText
|
||||||
|
: preferLabelInShort
|
||||||
|
? labelText || shortText
|
||||||
|
: shortText || labelText) || fallback;
|
||||||
|
const standardTitle =
|
||||||
|
showUpstream && Array.isArray(target.upstreamModels) && target.upstreamModels.length > 1
|
||||||
|
? target.upstreamModels.join(' / ')
|
||||||
|
: standardText;
|
||||||
|
return { text: standardText, title: standardTitle, isOrchestratorSeries: false };
|
||||||
|
}
|
||||||
|
|
||||||
// --- src/core/httpClient.js ---
|
// --- src/core/httpClient.js ---
|
||||||
/**
|
/**
|
||||||
* @fileoverview Async HTTP client with AbortController cancellation for stale
|
* @fileoverview Async HTTP client with AbortController cancellation for stale
|
||||||
@@ -951,14 +1050,29 @@ function normalizeClientUpdateMode(mode, legacyAutoUpdate) {
|
|||||||
return 'manual';
|
return 'manual';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeClientOrchestratorIdMode(mode) {
|
||||||
|
return String(mode ?? '').trim().toLowerCase() === 'full' ? 'full' : 'compact';
|
||||||
|
}
|
||||||
|
|
||||||
function isEquivalentTelemetry(prev, next) {
|
function isEquivalentTelemetry(prev, next) {
|
||||||
if (!prev || !next) return false;
|
if (!prev || !next) return false;
|
||||||
if (prev === next) return true;
|
if (prev === next) return true;
|
||||||
|
|
||||||
// 1. 比对系统设置项(模型显示策略、周预算模式与额度、插件更新策略、双栖与顶栏槽位配置)
|
// 1. 比对系统设置项(模型显示策略、Orchestrator ID 显示风格、周预算模式与额度、插件更新策略、双栖与顶栏槽位配置)
|
||||||
const pAct = prev.activeConversation;
|
const pAct = prev.activeConversation;
|
||||||
const nAct = next.activeConversation;
|
const nAct = next.activeConversation;
|
||||||
if (prev.settings?.showUpstreamModel !== next.settings?.showUpstreamModel) return false;
|
if (prev.settings?.showUpstreamModel !== next.settings?.showUpstreamModel) return false;
|
||||||
|
const prevOrchIdMode =
|
||||||
|
String(prev.settings?.orchestratorIdMode ?? 'compact').trim().toLowerCase() === 'full'
|
||||||
|
? 'full'
|
||||||
|
: 'compact';
|
||||||
|
const nextOrchIdMode =
|
||||||
|
String(next.settings?.orchestratorIdMode ?? 'compact').trim().toLowerCase() === 'full'
|
||||||
|
? 'full'
|
||||||
|
: 'compact';
|
||||||
|
if (prevOrchIdMode !== nextOrchIdMode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (prev.settings?.weeklyLimitMode !== next.settings?.weeklyLimitMode) return false;
|
if (prev.settings?.weeklyLimitMode !== next.settings?.weeklyLimitMode) return false;
|
||||||
if (prev.settings?.weeklyTokenBudget !== next.settings?.weeklyTokenBudget) return false;
|
if (prev.settings?.weeklyTokenBudget !== next.settings?.weeklyTokenBudget) return false;
|
||||||
if (prev.settings?.weeklyCostBudget !== next.settings?.weeklyCostBudget) return false;
|
if (prev.settings?.weeklyCostBudget !== next.settings?.weeklyCostBudget) return false;
|
||||||
@@ -1470,6 +1584,9 @@ async function saveSettingsPatch(patch) {
|
|||||||
safePatch.weeklyLimitMode =
|
safePatch.weeklyLimitMode =
|
||||||
mode === 'custom_tokens' || mode === 'custom_cost' ? mode : 'official';
|
mode === 'custom_tokens' || mode === 'custom_cost' ? mode : 'official';
|
||||||
}
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'orchestratorIdMode')) {
|
||||||
|
safePatch.orchestratorIdMode = normalizeClientOrchestratorIdMode(safePatch.orchestratorIdMode);
|
||||||
|
}
|
||||||
if (Object.prototype.hasOwnProperty.call(safePatch, 'showTopbarMultiSession')) {
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'showTopbarMultiSession')) {
|
||||||
safePatch.showTopbarMultiSession = Boolean(safePatch.showTopbarMultiSession);
|
safePatch.showTopbarMultiSession = Boolean(safePatch.showTopbarMultiSession);
|
||||||
}
|
}
|
||||||
@@ -4244,12 +4361,10 @@ const LiveOverviewView = defineComponent({
|
|||||||
ensureLiveTicker();
|
ensureLiveTicker();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. 更新 4 格实时测速矩阵(展示当前会话全局汇总指标,遵循模型名称格式设置)
|
// 1. 更新 4 格实时测速矩阵(展示当前会话全局汇总指标,遵循模型名称格式与 Orchestrator ID 格式设置)
|
||||||
const showUpstream = Boolean(data.settings?.showUpstreamModel);
|
const activeModelDisplay = resolveModelDisplayInfo(active, data.settings, {
|
||||||
const activeModelDisplay =
|
fallback: '模型未知',
|
||||||
(showUpstream
|
}).text;
|
||||||
? active.activeModelUpstream || active.activeModelShort
|
|
||||||
: active.activeModelShort) || '模型未知';
|
|
||||||
patchClasses(pulseDot, { 'is-pulsing': Boolean(active.isRunning) });
|
patchClasses(pulseDot, { 'is-pulsing': Boolean(active.isRunning) });
|
||||||
patchText(tpsVal, formatMetric(active.latestTokPerSec, ' tok/s'));
|
patchText(tpsVal, formatMetric(active.latestTokPerSec, ' tok/s'));
|
||||||
const reason = speedReasonText(active.latestSpeedReason);
|
const reason = speedReasonText(active.latestSpeedReason);
|
||||||
@@ -4298,9 +4413,9 @@ const LiveOverviewView = defineComponent({
|
|||||||
|
|
||||||
const allAgentPills = agents.map((ag) => {
|
const allAgentPills = agents.map((ag) => {
|
||||||
const agPct = ag.context?.usedPct ?? 0;
|
const agPct = ag.context?.usedPct ?? 0;
|
||||||
const agModelDisplay =
|
const agModelDisplay = resolveModelDisplayInfo(ag, data.settings, {
|
||||||
(showUpstream ? ag.activeModelUpstream || ag.activeModelShort : ag.activeModelShort) ||
|
fallback: '模型未知',
|
||||||
'模型未知';
|
}).text;
|
||||||
return {
|
return {
|
||||||
key: ag.agentId,
|
key: ag.agentId,
|
||||||
label: `${ag.badgeText || ag.shortLabel} ${agPct}%`,
|
label: `${ag.badgeText || ag.shortLabel} ${agPct}%`,
|
||||||
@@ -4922,7 +5037,9 @@ const ConsumptionView = defineComponent({
|
|||||||
* 增量更新热门模型或数据来源单行的指标文本与 4 段比例条宽度。
|
* 增量更新热门模型或数据来源单行的指标文本与 4 段比例条宽度。
|
||||||
*/
|
*/
|
||||||
function updateBreakdownItemRow(refs, item, grandTotalTokens, showTokensInHeader = true) {
|
function updateBreakdownItemRow(refs, item, grandTotalTokens, showTokensInHeader = true) {
|
||||||
patchText(refs.nameEl, item.label || item.name || item.shortName || '—');
|
const displayLabel = item.label || item.name || item.shortName || '—';
|
||||||
|
patchText(refs.nameEl, displayLabel);
|
||||||
|
patchAttr(refs.nameEl, 'title', item.title || displayLabel);
|
||||||
const total = Number(item.totalTokens || 0);
|
const total = Number(item.totalTokens || 0);
|
||||||
const share = grandTotalTokens > 0 ? +((total / grandTotalTokens) * 100).toFixed(1) : 0;
|
const share = grandTotalTokens > 0 ? +((total / grandTotalTokens) * 100).toFixed(1) : 0;
|
||||||
patchText(refs.pctBadge, `${share.toFixed(1)}%`);
|
patchText(refs.pctBadge, `${share.toFixed(1)}%`);
|
||||||
@@ -5053,8 +5170,11 @@ const ConsumptionView = defineComponent({
|
|||||||
);
|
);
|
||||||
trendChart.update(trendSeries);
|
trendChart.update(trendSeries);
|
||||||
|
|
||||||
// 3. 同步热门模型列表(按总 Token 数降序排列并执行键值增量对账,遵循模型名称显示格式设置)
|
// 3. 同步热门模型列表(按总 Token 数降序排列并执行键值增量对账,遵循模型名称与 Orchestrator ID 格式设置)
|
||||||
const showUpstream = Boolean(slice.showUpstreamModel);
|
const displaySettings = {
|
||||||
|
showUpstreamModel: Boolean(slice.showUpstreamModel),
|
||||||
|
orchestratorIdMode: slice.orchestratorIdMode,
|
||||||
|
};
|
||||||
const models = (slice.modelBreakdown || [])
|
const models = (slice.modelBreakdown || [])
|
||||||
.slice()
|
.slice()
|
||||||
.sort((a, b) => (b.totalTokens || 0) - (a.totalTokens || 0));
|
.sort((a, b) => (b.totalTokens || 0) - (a.totalTokens || 0));
|
||||||
@@ -5062,18 +5182,20 @@ const ConsumptionView = defineComponent({
|
|||||||
|
|
||||||
patchKeyedList(modelsListEl, models, {
|
patchKeyedList(modelsListEl, models, {
|
||||||
keyFn: (m) => m.label || m.shortName,
|
keyFn: (m) => m.label || m.shortName,
|
||||||
sigFn: (m) =>
|
sigFn: (m) => {
|
||||||
`${showUpstream}:${m.label}:${m.upstreamName || ''}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.calls}:${modelsTotalTok}`,
|
const disp = resolveModelDisplayInfo(m, displaySettings, { preferLabelInShort: true });
|
||||||
|
return `${disp.text}:${disp.title}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.calls}:${modelsTotalTok}`;
|
||||||
|
},
|
||||||
createRow: createBreakdownItemRow,
|
createRow: createBreakdownItemRow,
|
||||||
updateRow: (refs, m) =>
|
updateRow: (refs, m) => {
|
||||||
updateBreakdownItemRow(
|
const disp = resolveModelDisplayInfo(m, displaySettings, { preferLabelInShort: true });
|
||||||
|
return updateBreakdownItemRow(
|
||||||
refs,
|
refs,
|
||||||
showUpstream
|
{ ...m, label: disp.text, title: disp.title },
|
||||||
? { ...m, label: m.upstreamName || m.label || m.shortName }
|
|
||||||
: m,
|
|
||||||
modelsTotalTok,
|
modelsTotalTok,
|
||||||
true
|
true
|
||||||
),
|
);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 4. 同步数据来源列表
|
// 4. 同步数据来源列表
|
||||||
@@ -5143,6 +5265,9 @@ const ConsumptionView = defineComponent({
|
|||||||
consumption: st.telemetry?.consumption,
|
consumption: st.telemetry?.consumption,
|
||||||
modelBreakdown: st.telemetry?.modelBreakdown,
|
modelBreakdown: st.telemetry?.modelBreakdown,
|
||||||
showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel),
|
showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel),
|
||||||
|
orchestratorIdMode: normalizeOrchestratorIdDisplayMode(
|
||||||
|
st.telemetry?.settings?.orchestratorIdMode
|
||||||
|
),
|
||||||
}),
|
}),
|
||||||
(slice) => {
|
(slice) => {
|
||||||
latestSlice = slice;
|
latestSlice = slice;
|
||||||
@@ -5364,7 +5489,10 @@ const StepsDetailView = defineComponent({
|
|||||||
(Array.isArray(scopedConv?.modelBreakdown) && scopedConv.modelBreakdown.length > 0
|
(Array.isArray(scopedConv?.modelBreakdown) && scopedConv.modelBreakdown.length > 0
|
||||||
? scopedConv.modelBreakdown
|
? scopedConv.modelBreakdown
|
||||||
: slice.sessionModelBreakdown || slice.modelBreakdown) || [];
|
: slice.sessionModelBreakdown || slice.modelBreakdown) || [];
|
||||||
const showUpstream = Boolean(slice.showUpstreamModel);
|
const displaySettings = {
|
||||||
|
showUpstreamModel: Boolean(slice.showUpstreamModel),
|
||||||
|
orchestratorIdMode: slice.orchestratorIdMode,
|
||||||
|
};
|
||||||
const modelsTabBadge = hasSubagents
|
const modelsTabBadge = hasSubagents
|
||||||
? effectiveScope === 'all'
|
? effectiveScope === 'all'
|
||||||
? '本会话汇总'
|
? '本会话汇总'
|
||||||
@@ -5381,8 +5509,10 @@ const StepsDetailView = defineComponent({
|
|||||||
// 1. 单步测速表增量对账:以 `<agentCascadeId>-<stepIndex>` 为稳定行键,仅在签名变化时刷新单元格
|
// 1. 单步测速表增量对账:以 `<agentCascadeId>-<stepIndex>` 为稳定行键,仅在签名变化时刷新单元格
|
||||||
patchKeyedList(stepsTbody, steps, {
|
patchKeyedList(stepsTbody, steps, {
|
||||||
keyFn: (st) => `${st.agentCascadeId || slice.cascadeId || 'conv'}-${st.stepIndex}`,
|
keyFn: (st) => `${st.agentCascadeId || slice.cascadeId || 'conv'}-${st.stepIndex}`,
|
||||||
sigFn: (st) =>
|
sigFn: (st) => {
|
||||||
`${hasSubagents}:${effectiveScope}:${st.agentId || 'main'}:${st.stepIndex}:${showUpstream ? st.modelUpstream || st.responseModel || st.modelShort : st.modelShort}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}`,
|
const disp = resolveModelDisplayInfo(st, displaySettings, { fallback: '—' });
|
||||||
|
return `${hasSubagents}:${effectiveScope}:${st.agentId || 'main'}:${st.stepIndex}:${disp.text}:${disp.title}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}`;
|
||||||
|
},
|
||||||
createRow: () => {
|
createRow: () => {
|
||||||
const agentBadgeEl = h('span', {
|
const agentBadgeEl = h('span', {
|
||||||
className: 'agent-badge is-clickable',
|
className: 'agent-badge is-clickable',
|
||||||
@@ -5449,12 +5579,9 @@ const StepsDetailView = defineComponent({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
patchText(refs.stepNumText, `#${Number(st.stepIndex)}`);
|
patchText(refs.stepNumText, `#${Number(st.stepIndex)}`);
|
||||||
const modelText =
|
const modelDisplay = resolveModelDisplayInfo(st, displaySettings, { fallback: '—' });
|
||||||
(showUpstream ? st.modelUpstream || st.responseModel : st.modelShort) ||
|
patchText(refs.tdModel, modelDisplay.text);
|
||||||
st.modelShort ||
|
patchAttr(refs.tdModel, 'title', modelDisplay.title);
|
||||||
'—';
|
|
||||||
patchText(refs.tdModel, modelText);
|
|
||||||
patchAttr(refs.tdModel, 'title', modelText);
|
|
||||||
|
|
||||||
patchText(refs.speedMain, formatMetric(st.tokPerSec, ' tok/s'));
|
patchText(refs.speedMain, formatMetric(st.tokPerSec, ' tok/s'));
|
||||||
const reason = speedReasonText(st.selectedSpeedReason);
|
const reason = speedReasonText(st.selectedSpeedReason);
|
||||||
@@ -5477,8 +5604,10 @@ const StepsDetailView = defineComponent({
|
|||||||
// 2. 按模型汇总表增量对账:以模型标识为稳定行键,展示调用次数、加权均速、有效样本比与总费用
|
// 2. 按模型汇总表增量对账:以模型标识为稳定行键,展示调用次数、加权均速、有效样本比与总费用
|
||||||
patchKeyedList(modelsTbody, models, {
|
patchKeyedList(modelsTbody, models, {
|
||||||
keyFn: (m) => m.label || m.shortName,
|
keyFn: (m) => m.label || m.shortName,
|
||||||
sigFn: (m) =>
|
sigFn: (m) => {
|
||||||
`${showUpstream ? m.upstreamName || m.shortName : m.shortName}:${m.calls}:${m.avgTokPerSec}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.speedSummary?.sampleCount}`,
|
const disp = resolveModelDisplayInfo(m, displaySettings, { fallback: '—' });
|
||||||
|
return `${disp.text}:${disp.title}:${m.calls}:${m.avgTokPerSec}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.speedSummary?.sampleCount}`;
|
||||||
|
},
|
||||||
createRow: () => {
|
createRow: () => {
|
||||||
const tdName = h('td', {
|
const tdName = h('td', {
|
||||||
style: 'font-weight: 600; max-width: 165px; overflow: hidden; text-overflow: ellipsis;',
|
style: 'font-weight: 600; max-width: 165px; overflow: hidden; text-overflow: ellipsis;',
|
||||||
@@ -5496,15 +5625,9 @@ const StepsDetailView = defineComponent({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
updateRow: (refs, m) => {
|
updateRow: (refs, m) => {
|
||||||
const nameText = showUpstream
|
const modelDisplay = resolveModelDisplayInfo(m, displaySettings, { fallback: '—' });
|
||||||
? m.upstreamName || m.shortName || m.label
|
patchText(refs.tdName, modelDisplay.text);
|
||||||
: m.shortName || m.label;
|
patchAttr(refs.tdName, 'title', modelDisplay.title);
|
||||||
patchText(refs.tdName, nameText);
|
|
||||||
const fullUpstreamTitle =
|
|
||||||
showUpstream && Array.isArray(m.upstreamModels) && m.upstreamModels.length > 1
|
|
||||||
? m.upstreamModels.join(' / ')
|
|
||||||
: nameText;
|
|
||||||
patchAttr(refs.tdName, 'title', fullUpstreamTitle);
|
|
||||||
patchText(refs.tdCalls, String(Number(m.calls || 0)));
|
patchText(refs.tdCalls, String(Number(m.calls || 0)));
|
||||||
patchText(refs.speedMain, formatMetric(m.avgTokPerSec, ' tok/s'));
|
patchText(refs.speedMain, formatMetric(m.avgTokPerSec, ' tok/s'));
|
||||||
patchText(refs.speedSub, `有效 ${sampleSummary(m.speedSummary)}`);
|
patchText(refs.speedSub, `有效 ${sampleSummary(m.speedSummary)}`);
|
||||||
@@ -5528,6 +5651,9 @@ const StepsDetailView = defineComponent({
|
|||||||
sessionModelBreakdown: st.telemetry?.activeConversation?.modelBreakdown,
|
sessionModelBreakdown: st.telemetry?.activeConversation?.modelBreakdown,
|
||||||
modelBreakdown: st.telemetry?.modelBreakdown,
|
modelBreakdown: st.telemetry?.modelBreakdown,
|
||||||
showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel),
|
showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel),
|
||||||
|
orchestratorIdMode: normalizeOrchestratorIdDisplayMode(
|
||||||
|
st.telemetry?.settings?.orchestratorIdMode
|
||||||
|
),
|
||||||
}),
|
}),
|
||||||
(slice) => {
|
(slice) => {
|
||||||
latestSlice = slice;
|
latestSlice = slice;
|
||||||
@@ -5589,7 +5715,7 @@ const StepsDetailView = defineComponent({
|
|||||||
/**
|
/**
|
||||||
* @fileoverview View 4: SettingsView (系统设置视图).
|
* @fileoverview View 4: SettingsView (系统设置视图).
|
||||||
* 采用定制的 `CustomSelect` 与 `SegmentedControl` 替代所有原生表单控件,分为三个单层细线设置面板:
|
* 采用定制的 `CustomSelect` 与 `SegmentedControl` 替代所有原生表单控件,分为三个单层细线设置面板:
|
||||||
* 1. 常规设置:配置面板挂载方式(双栖挂载 / 仅右侧辅助栏)与模型名称格式(精简代号 / 原始模型 ID);
|
* 1. 常规设置:配置面板挂载方式(双栖挂载 / 仅右侧辅助栏)、模型名称格式(精简代号 / 原始模型 ID)与 Orchestrator 系列 ID 格式;
|
||||||
* 2. 顶部栏定制:控制左侧「实时运行会话」入口开关,以及自由定义右侧精简胶囊三个数值槽位的显示内容与左右顺序;
|
* 2. 顶部栏定制:控制左侧「实时运行会话」入口开关,以及自由定义右侧精简胶囊三个数值槽位的显示内容与左右顺序;
|
||||||
* 3. 版本更新:配置插件自动更新策略、手动同步云端模型价格表,以及检查并执行 Git/ZIP 双模式插件升级。
|
* 3. 版本更新:配置插件自动更新策略、手动同步云端模型价格表,以及检查并执行 Git/ZIP 双模式插件升级。
|
||||||
*/
|
*/
|
||||||
@@ -5601,6 +5727,12 @@ const STEP_MODEL_DISPLAY_OPTIONS = [
|
|||||||
{ value: 'upstream', label: '原始模型 ID (如 gemini-3.8-flash-n)' },
|
{ value: 'upstream', label: '原始模型 ID (如 gemini-3.8-flash-n)' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** Orchestrator 系列模型 ID 显示方式可选项(独立于普通模型名称格式) */
|
||||||
|
const ORCHESTRATOR_ID_DISPLAY_OPTIONS = [
|
||||||
|
{ value: 'compact', label: '精简代号 (如 orchestrator-argon)' },
|
||||||
|
{ value: 'full', label: '原始完整 ID (如 gemini-pro-orchestrator)' },
|
||||||
|
];
|
||||||
|
|
||||||
/** 面板挂载模式可选项(顶部栏 + 侧边栏 vs 仅侧边栏) */
|
/** 面板挂载模式可选项(顶部栏 + 侧边栏 vs 仅侧边栏) */
|
||||||
const WINDOW_MOUNT_OPTIONS = [
|
const WINDOW_MOUNT_OPTIONS = [
|
||||||
{ value: 'dual', label: '双栖挂载 (顶部栏 + 侧边栏)' },
|
{ value: 'dual', label: '双栖挂载 (顶部栏 + 侧边栏)' },
|
||||||
@@ -5653,6 +5785,7 @@ const SettingsView = defineComponent({
|
|||||||
name: 'SettingsView',
|
name: 'SettingsView',
|
||||||
setup({ onCleanup }) {
|
setup({ onCleanup }) {
|
||||||
let draftShowUpstreamModel = false;
|
let draftShowUpstreamModel = false;
|
||||||
|
let draftOrchestratorIdMode = 'compact';
|
||||||
let draftPluginUpdateMode = 'manual';
|
let draftPluginUpdateMode = 'manual';
|
||||||
let draftEnableWindowOverlay = true;
|
let draftEnableWindowOverlay = true;
|
||||||
let draftShowTopbarMulti = true;
|
let draftShowTopbarMulti = true;
|
||||||
@@ -5757,6 +5890,29 @@ const SettingsView = defineComponent({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const orchestratorIdSelect = CustomSelect({
|
||||||
|
modelValue: 'compact',
|
||||||
|
icon: 'layers',
|
||||||
|
options: ORCHESTRATOR_ID_DISPLAY_OPTIONS,
|
||||||
|
onUpdateModelValue: async (val) => {
|
||||||
|
const nextMode = normalizeClientOrchestratorIdMode(val);
|
||||||
|
draftOrchestratorIdMode = nextMode;
|
||||||
|
orchestratorIdSelect.setValue(nextMode);
|
||||||
|
showSaveFeedback('保存中…');
|
||||||
|
try {
|
||||||
|
await saveSettingsPatch({
|
||||||
|
orchestratorIdMode: nextMode,
|
||||||
|
});
|
||||||
|
showSaveFeedback('已保存');
|
||||||
|
} catch {
|
||||||
|
if (latestSettings) {
|
||||||
|
renderSettings(latestSettings);
|
||||||
|
}
|
||||||
|
showSaveFeedback('保存失败');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const generalPanel = h('section', { className: 'panel' }, [
|
const generalPanel = h('section', { className: 'panel' }, [
|
||||||
h('div', { className: 'panel-header' }, [
|
h('div', { className: 'panel-header' }, [
|
||||||
h('span', { className: 'panel-title' }, [
|
h('span', { className: 'panel-title' }, [
|
||||||
@@ -5773,6 +5929,10 @@ const SettingsView = defineComponent({
|
|||||||
h('span', { className: 'form-label', text: '模型名称格式' }),
|
h('span', { className: 'form-label', text: '模型名称格式' }),
|
||||||
stepModelSelect.el,
|
stepModelSelect.el,
|
||||||
]),
|
]),
|
||||||
|
h('div', { className: 'form-row' }, [
|
||||||
|
h('span', { className: 'form-label', text: 'Orchestrator 系列 ID' }),
|
||||||
|
orchestratorIdSelect.el,
|
||||||
|
]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// --- 面板 2:顶部栏定制(实时运行会话开关 + 右侧三槽位指标与顺序自定义) ---
|
// --- 面板 2:顶部栏定制(实时运行会话开关 + 右侧三槽位指标与顺序自定义) ---
|
||||||
@@ -6104,6 +6264,7 @@ const SettingsView = defineComponent({
|
|||||||
function renderSettings(settings) {
|
function renderSettings(settings) {
|
||||||
if (!settings) return;
|
if (!settings) return;
|
||||||
draftShowUpstreamModel = Boolean(settings.showUpstreamModel);
|
draftShowUpstreamModel = Boolean(settings.showUpstreamModel);
|
||||||
|
draftOrchestratorIdMode = normalizeClientOrchestratorIdMode(settings.orchestratorIdMode);
|
||||||
draftPluginUpdateMode = normalizeClientUpdateMode(
|
draftPluginUpdateMode = normalizeClientUpdateMode(
|
||||||
settings.pluginUpdateMode,
|
settings.pluginUpdateMode,
|
||||||
settings.autoUpdatePlugin
|
settings.autoUpdatePlugin
|
||||||
@@ -6114,6 +6275,7 @@ const SettingsView = defineComponent({
|
|||||||
|
|
||||||
windowMountSelect.setValue(draftEnableWindowOverlay ? 'dual' : 'sidebar');
|
windowMountSelect.setValue(draftEnableWindowOverlay ? 'dual' : 'sidebar');
|
||||||
stepModelSelect.setValue(draftShowUpstreamModel ? 'upstream' : 'short');
|
stepModelSelect.setValue(draftShowUpstreamModel ? 'upstream' : 'short');
|
||||||
|
orchestratorIdSelect.setValue(draftOrchestratorIdMode);
|
||||||
autoUpdateSelect.setValue(draftPluginUpdateMode);
|
autoUpdateSelect.setValue(draftPluginUpdateMode);
|
||||||
syncTopbarControls();
|
syncTopbarControls();
|
||||||
viewScrollbar.refresh();
|
viewScrollbar.refresh();
|
||||||
@@ -6195,6 +6357,7 @@ const SettingsView = defineComponent({
|
|||||||
unsubView();
|
unsubView();
|
||||||
windowMountSelect.destroy();
|
windowMountSelect.destroy();
|
||||||
stepModelSelect.destroy();
|
stepModelSelect.destroy();
|
||||||
|
orchestratorIdSelect.destroy();
|
||||||
multiSessionToggle.destroy();
|
multiSessionToggle.destroy();
|
||||||
for (const sel of slotSelects) {
|
for (const sel of slotSelects) {
|
||||||
sel.destroy();
|
sel.destroy();
|
||||||
@@ -6208,6 +6371,7 @@ const SettingsView = defineComponent({
|
|||||||
refs: {
|
refs: {
|
||||||
windowMountSelect,
|
windowMountSelect,
|
||||||
stepModelSelect,
|
stepModelSelect,
|
||||||
|
orchestratorIdSelect,
|
||||||
multiSessionToggle,
|
multiSessionToggle,
|
||||||
slotSelects,
|
slotSelects,
|
||||||
resetTopbarBtn,
|
resetTopbarBtn,
|
||||||
@@ -8291,11 +8455,9 @@ function mountWindowOverlay() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --- 同步悬停三卡片全景概览(与 LiveOverviewView 保持完全一致的数据口径与视觉呈现) ---
|
// --- 同步悬停三卡片全景概览(与 LiveOverviewView 保持完全一致的数据口径与视觉呈现) ---
|
||||||
const showUpstream = Boolean(telemetry.settings?.showUpstreamModel);
|
const activeModelDisplay = resolveModelDisplayInfo(overviewActive, telemetry.settings, {
|
||||||
const activeModelDisplay =
|
fallback: '模型未知',
|
||||||
(showUpstream
|
}).text;
|
||||||
? overviewActive.activeModelUpstream || overviewActive.activeModelShort
|
|
||||||
: overviewActive.activeModelShort) || '模型未知';
|
|
||||||
|
|
||||||
patchClasses(hoverPulseDot, { 'is-pulsing': Boolean(overviewActive.isRunning || isRunning) });
|
patchClasses(hoverPulseDot, { 'is-pulsing': Boolean(overviewActive.isRunning || isRunning) });
|
||||||
patchText(hoverTpsVal, formatMetric(overviewActive.latestTokPerSec, ' tok/s'));
|
patchText(hoverTpsVal, formatMetric(overviewActive.latestTokPerSec, ' tok/s'));
|
||||||
|
|||||||
@@ -95,6 +95,19 @@ export const DEFAULT_TOPBAR_SLOTS = Object.freeze(['context', 'tps', 'quota_auto
|
|||||||
|
|
||||||
export const PLUGIN_UPDATE_MODES = Object.freeze(['off', 'manual', 'auto']);
|
export const PLUGIN_UPDATE_MODES = Object.freeze(['off', 'manual', 'auto']);
|
||||||
|
|
||||||
|
export const ORCHESTRATOR_ID_MODES = Object.freeze(['compact', 'full']);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 归一化 Orchestrator 系列模型 ID 显示风格(`'compact'` 精简代号 vs `'full'` 完整模型 ID,默认 `'compact'`)。
|
||||||
|
*
|
||||||
|
* @param {unknown} mode
|
||||||
|
* @returns {'compact'|'full'}
|
||||||
|
*/
|
||||||
|
export function normalizeOrchestratorIdMode(mode) {
|
||||||
|
const m = String(mode ?? '').trim().toLowerCase();
|
||||||
|
return m === 'full' ? 'full' : 'compact';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 归一化插件更新策略枚举(兼容历史 `autoUpdatePlugin` 布尔开关,默认 `'manual'`)。
|
* 归一化插件更新策略枚举(兼容历史 `autoUpdatePlugin` 布尔开关,默认 `'manual'`)。
|
||||||
*
|
*
|
||||||
@@ -135,6 +148,7 @@ const DEFAULT_SETTINGS = {
|
|||||||
weeklyCostBudget: 100, // 自定义每周美元费用预算默认值 ($100,保留底层兼容)
|
weeklyCostBudget: 100, // 自定义每周美元费用预算默认值 ($100,保留底层兼容)
|
||||||
weeklyLimitMode: 'official', // 'official' | 'custom_tokens' | 'custom_cost'
|
weeklyLimitMode: 'official', // 'official' | 'custom_tokens' | 'custom_cost'
|
||||||
showUpstreamModel: false, // 是否显示上游真实 responseModel 名称
|
showUpstreamModel: false, // 是否显示上游真实 responseModel 名称
|
||||||
|
orchestratorIdMode: 'compact', // 'compact' | 'full'(Orchestrator 系列显示精简 ID 或完整 ID)
|
||||||
pluginUpdateMode: 'manual', // 'off' | 'manual' | 'auto'(默认仅提示新版本,手动更新)
|
pluginUpdateMode: 'manual', // 'off' | 'manual' | 'auto'(默认仅提示新版本,手动更新)
|
||||||
autoUpdatePlugin: false, // 派生自 pluginUpdateMode === 'auto',保留底层兼容
|
autoUpdatePlugin: false, // 派生自 pluginUpdateMode === 'auto',保留底层兼容
|
||||||
enableWindowOverlay: true, // 是否启用双栖模式(自动通过 CDP 在主窗口顶栏挂载胶囊与悬浮面板)
|
enableWindowOverlay: true, // 是否启用双栖模式(自动通过 CDP 在主窗口顶栏挂载胶囊与悬浮面板)
|
||||||
@@ -233,6 +247,7 @@ export function loadSettings() {
|
|||||||
),
|
),
|
||||||
weeklyLimitMode: normalizeWeeklyLimitMode(merged.weeklyLimitMode),
|
weeklyLimitMode: normalizeWeeklyLimitMode(merged.weeklyLimitMode),
|
||||||
showUpstreamModel: merged.showUpstreamModel === true,
|
showUpstreamModel: merged.showUpstreamModel === true,
|
||||||
|
orchestratorIdMode: normalizeOrchestratorIdMode(merged.orchestratorIdMode),
|
||||||
pluginUpdateMode,
|
pluginUpdateMode,
|
||||||
autoUpdatePlugin: pluginUpdateMode === 'auto',
|
autoUpdatePlugin: pluginUpdateMode === 'auto',
|
||||||
enableWindowOverlay: merged.enableWindowOverlay !== false,
|
enableWindowOverlay: merged.enableWindowOverlay !== false,
|
||||||
@@ -263,6 +278,7 @@ export function computeRuntimeCodeVersion() {
|
|||||||
join(HERE, 'styles.css'),
|
join(HERE, 'styles.css'),
|
||||||
join(HERE, 'main.mjs'),
|
join(HERE, 'main.mjs'),
|
||||||
join(HERE, 'speed-metrics.mjs'),
|
join(HERE, 'speed-metrics.mjs'),
|
||||||
|
LOCAL_CATALOG_FILE,
|
||||||
];
|
];
|
||||||
const backendDir = join(HERE, 'backend');
|
const backendDir = join(HERE, 'backend');
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ function inferFamilyFromProviderOrKey(rawModelKey = '', modelId = '', apiProvide
|
|||||||
combined.includes('CARBON') ||
|
combined.includes('CARBON') ||
|
||||||
combined.includes('ARGON') ||
|
combined.includes('ARGON') ||
|
||||||
combined.includes('HYDROGEN') ||
|
combined.includes('HYDROGEN') ||
|
||||||
|
combined.includes('ORCHESTRATOR') ||
|
||||||
combined.includes('HELIX') ||
|
combined.includes('HELIX') ||
|
||||||
combined.includes('FLASH') ||
|
combined.includes('FLASH') ||
|
||||||
combined.includes('GOOGLE')
|
combined.includes('GOOGLE')
|
||||||
@@ -59,29 +60,42 @@ function inferFamilyFromProviderOrKey(rawModelKey = '', modelId = '', apiProvide
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断一组模型标识字段是否指向 Gemini 4 Argon 系列模型(含 M417/M418/M419 枚举)。
|
* 判断一组模型标识字段是否指向 Gemini 4 Argon 系列模型(含 M417/M418/M419 及 M681 Orchestrator (Argon))。
|
||||||
*
|
*
|
||||||
* @param {...string} parts 待检测的标识片段
|
* @param {...string} parts 待检测的标识片段
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export function isArgonModelIdentifier(...parts) {
|
export function isArgonModelIdentifier(...parts) {
|
||||||
return /argon|MODEL_PLACEHOLDER_M41[789]\b/i.test(parts.filter(Boolean).join(' '));
|
const text = parts.filter(Boolean).join(' ');
|
||||||
|
if (
|
||||||
|
/\bhydrogen\b|\bgemini-flash-worker-agy\b|MODEL_PLACEHOLDER_M(?:669|52[5678])\b/i.test(text) &&
|
||||||
|
!/\bargon\b|MODEL_PLACEHOLDER_M(?:41[789]|681)\b/i.test(text)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return /argon|MODEL_PLACEHOLDER_M(?:41[789]|681)\b/i.test(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断一组模型标识字段是否指向 Gemini 4 Carbon 系列模型(含 M429 枚举)。
|
* 判断一组模型标识字段是否指向 Gemini 4 Carbon 系列模型(含 M427/M429/M437/M438 及 M667 Orchestrator (Carbon))。
|
||||||
*
|
*
|
||||||
* @param {...string} parts 待检测的标识片段
|
* @param {...string} parts 待检测的标识片段
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export function isCarbonModelIdentifier(...parts) {
|
export function isCarbonModelIdentifier(...parts) {
|
||||||
return /\bcarbon\b|gemini-4-carbon|MODEL_PLACEHOLDER_M429\b/i.test(
|
const text = parts.filter(Boolean).join(' ');
|
||||||
parts.filter(Boolean).join(' ')
|
if (/\bcarbon\b|gemini-4-carbon|MODEL_PLACEHOLDER_M(?:42[79]|43[78]|667)\b/i.test(text)) {
|
||||||
);
|
return true;
|
||||||
|
}
|
||||||
|
if (/\bhydrogen\b|\bgemini-flash-worker-agy\b|MODEL_PLACEHOLDER_M(?:669|52[5678])\b/i.test(text)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return /\bgemini-pro-orchestrator\b(?!-argon)/i.test(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 剥离模型展示名称末尾的思考档位后缀(如 `(High)`、`(Medium)`、`(Thinking)`),提取基础模型族名。
|
* 剥离模型展示名称末尾的思考档位后缀(如 `(XHigh)`、`(High)`、`(Medium)`、`(Thinking)`),提取基础模型族名。
|
||||||
|
* 保留 `(Carbon)` / `(Argon)` 后缀,以便 `Orchestrator (Carbon)` 与 `Orchestrator (Argon)` 在汇总表中保持分列。
|
||||||
*
|
*
|
||||||
* @param {string} [label='']
|
* @param {string} [label='']
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
@@ -89,7 +103,7 @@ export function isCarbonModelIdentifier(...parts) {
|
|||||||
export function getBaseModelLabel(label = '') {
|
export function getBaseModelLabel(label = '') {
|
||||||
return (
|
return (
|
||||||
String(label || '')
|
String(label || '')
|
||||||
.replace(/\s*\((?:Max|High|Medium|Low|Thinking|Extra Low|Tiered)\)\s*$/i, '')
|
.replace(/\s*\((?:Max|XHigh|High|Medium|Low|Thinking|Extra Low|Tiered)\)\s*$/i, '')
|
||||||
.trim() || String(label || 'Unknown Model')
|
.trim() || String(label || 'Unknown Model')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -121,6 +135,9 @@ export function formatGenericModelSlug(slug = '') {
|
|||||||
codenameMatch[1].charAt(0).toUpperCase() + codenameMatch[1].slice(1).toLowerCase();
|
codenameMatch[1].charAt(0).toUpperCase() + codenameMatch[1].slice(1).toLowerCase();
|
||||||
return `Gemini ${codename}`;
|
return `Gemini ${codename}`;
|
||||||
}
|
}
|
||||||
|
if (/^gemini-flash-worker-agy$/i.test(s)) {
|
||||||
|
return 'Orchestrator Worker (Hydrogen)';
|
||||||
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,8 +173,24 @@ export function resolveModelInfo(
|
|||||||
responseModel && responseModel !== 'unknown' ? String(responseModel).trim() : '';
|
responseModel && responseModel !== 'unknown' ? String(responseModel).trim() : '';
|
||||||
const cleanRawFallback =
|
const cleanRawFallback =
|
||||||
rawModelKey && rawModelKey !== 'unknown' ? rawModelKey : cleanResponseModel;
|
rawModelKey && rawModelKey !== 'unknown' ? rawModelKey : cleanResponseModel;
|
||||||
|
const isWorkerSlot =
|
||||||
|
rawModelKey === 'MODEL_PLACEHOLDER_M669' ||
|
||||||
|
/^gemini-flash-worker-agy$/i.test(cleanResponseModel);
|
||||||
|
const isVagueGenericDisplay = Boolean(
|
||||||
|
modelDisplayName &&
|
||||||
|
(/^gemini\s+(?:flash|pro)(?:\s+worker)?$/i.test(modelDisplayName.trim()) ||
|
||||||
|
(isWorkerSlot && /^gemini\s+4\s+hydrogen$/i.test(modelDisplayName.trim())))
|
||||||
|
);
|
||||||
|
const effectiveDisplayName =
|
||||||
|
modelDisplayName &&
|
||||||
|
((mergedLabel &&
|
||||||
|
(/\borchestrator\b/i.test(modelDisplayName) || isVagueGenericDisplay) &&
|
||||||
|
!/\borchestrator\b/i.test(mergedLabel)) ||
|
||||||
|
(isVagueGenericDisplay && /^gemini-flash-worker-agy$/i.test(cleanResponseModel)))
|
||||||
|
? ''
|
||||||
|
: modelDisplayName;
|
||||||
const derivedDisplay =
|
const derivedDisplay =
|
||||||
modelDisplayName ||
|
effectiveDisplayName ||
|
||||||
mergedLabel ||
|
mergedLabel ||
|
||||||
formatGenericModelSlug(rawModelKey) ||
|
formatGenericModelSlug(rawModelKey) ||
|
||||||
formatGenericModelSlug(cleanResponseModel) ||
|
formatGenericModelSlug(cleanResponseModel) ||
|
||||||
@@ -181,14 +214,22 @@ export function resolveModelInfo(
|
|||||||
(rawModelKey && rawModelKey !== 'unknown' ? rawModelKey : cleanResponseModel) ||
|
(rawModelKey && rawModelKey !== 'unknown' ? rawModelKey : cleanResponseModel) ||
|
||||||
'unknown';
|
'unknown';
|
||||||
|
|
||||||
|
const isOpaqueOrchestratorResp = Boolean(
|
||||||
|
cleanResponseModel && /\borchestrator\b/i.test(cleanResponseModel)
|
||||||
|
);
|
||||||
const explicitPricing =
|
const explicitPricing =
|
||||||
MODEL_PRICING[modelId] ||
|
MODEL_PRICING[modelId] ||
|
||||||
MODEL_PRICING[rawModelKey] ||
|
MODEL_PRICING[rawModelKey] ||
|
||||||
(cleanResponseModel ? MODEL_PRICING[cleanResponseModel] : null) ||
|
(cleanResponseModel && !isOpaqueOrchestratorResp
|
||||||
|
? MODEL_PRICING[cleanResponseModel]
|
||||||
|
: null) ||
|
||||||
MODEL_PRICING[tieredSlug] ||
|
MODEL_PRICING[tieredSlug] ||
|
||||||
MODEL_PRICING[tieredDashedSlug] ||
|
MODEL_PRICING[tieredDashedSlug] ||
|
||||||
MODEL_PRICING[canonicalSlug] ||
|
MODEL_PRICING[canonicalSlug] ||
|
||||||
MODEL_PRICING[dashedSlug];
|
MODEL_PRICING[dashedSlug] ||
|
||||||
|
(cleanResponseModel && isOpaqueOrchestratorResp
|
||||||
|
? MODEL_PRICING[cleanResponseModel]
|
||||||
|
: null);
|
||||||
|
|
||||||
if (explicitPricing) {
|
if (explicitPricing) {
|
||||||
return {
|
return {
|
||||||
@@ -216,6 +257,36 @@ export function resolveModelInfo(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为不透明的 Orchestrator 路由模型 ID 补充底层实际模型代号标注(如 `gemini-pro-orchestrator (carbon-4)`),
|
||||||
|
* 普通透明上游模型 ID(如 `gemini-3.8-flash-n`、`gemini-4-hydrogen`)原样返回。
|
||||||
|
*
|
||||||
|
* @param {string} [rawUpstream='']
|
||||||
|
* @param {ReturnType<typeof resolveModelInfo>|null} [mInfo=null]
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function formatUpstreamModelId(rawUpstream = '', mInfo = null) {
|
||||||
|
const s = String(rawUpstream || '').trim();
|
||||||
|
if (!s || !/(?:orchestrator|-worker-agy\b)/i.test(s) || /\([^)]+\)\s*$/.test(s)) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
const metaText = `${mInfo?.rawModel || ''} ${mInfo?.modelId || ''} ${mInfo?.shortName || ''} ${mInfo?.label || ''} ${s}`;
|
||||||
|
if (
|
||||||
|
/\bhydrogen\b|\bgemini-flash-worker-agy\b|MODEL_PLACEHOLDER_M(?:669|52[5678])\b/i.test(
|
||||||
|
metaText
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return `${s} (hydrogen-4)`;
|
||||||
|
}
|
||||||
|
if (isArgonModelIdentifier(mInfo?.rawModel, mInfo?.modelId, mInfo?.label, s)) {
|
||||||
|
return `${s} (argon-4)`;
|
||||||
|
}
|
||||||
|
if (isCarbonModelIdentifier(mInfo?.rawModel, mInfo?.modelId, mInfo?.label, s)) {
|
||||||
|
return `${s} (carbon-4)`;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算单个步骤的 API 等效美元成本;若模型未定价(`pricing === null`)则返回 `null`。
|
* 计算单个步骤的 API 等效美元成本;若模型未定价(`pricing === null`)则返回 `null`。
|
||||||
* 对负数、NaN 或非有限数值统一安全钳制为 0。
|
* 对负数、NaN 或非有限数值统一安全钳制为 0。
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import { enumerateAndSyncConversations } from './local-scanner.mjs';
|
|||||||
import { callLsRpc, getOfficialQuotaSummary } from './ls-rpc.mjs';
|
import { callLsRpc, getOfficialQuotaSummary } from './ls-rpc.mjs';
|
||||||
import {
|
import {
|
||||||
computeStepCost,
|
computeStepCost,
|
||||||
|
formatUpstreamModelId,
|
||||||
isArgonModelIdentifier,
|
isArgonModelIdentifier,
|
||||||
isCarbonModelIdentifier,
|
isCarbonModelIdentifier,
|
||||||
resolveModelInfo,
|
resolveModelInfo,
|
||||||
@@ -135,7 +136,10 @@ function enrichActiveConversationSteps(
|
|||||||
const rawUpstreamModel =
|
const rawUpstreamModel =
|
||||||
resolvedResponseModel ||
|
resolvedResponseModel ||
|
||||||
(mInfo.modelId && mInfo.modelId !== 'unknown' ? mInfo.modelId : mInfo.shortName);
|
(mInfo.modelId && mInfo.modelId !== 'unknown' ? mInfo.modelId : mInfo.shortName);
|
||||||
const modelUpstream = st.isCompactionStep ? `${rawUpstreamModel}·压缩` : rawUpstreamModel;
|
const annotatedUpstreamModel = formatUpstreamModelId(rawUpstreamModel, mInfo);
|
||||||
|
const modelUpstream = st.isCompactionStep
|
||||||
|
? `${annotatedUpstreamModel}·压缩`
|
||||||
|
: annotatedUpstreamModel;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
viewableDelaySec: _viewableDelaySec,
|
viewableDelaySec: _viewableDelaySec,
|
||||||
@@ -898,10 +902,11 @@ export async function buildTelemetryPayloadInternal(
|
|||||||
? knownUpstreamByModelKey.get(bestMetricStep.modelKey) || ''
|
? knownUpstreamByModelKey.get(bestMetricStep.modelKey) || ''
|
||||||
: '');
|
: '');
|
||||||
modelShort = mInfo.shortName || '';
|
modelShort = mInfo.shortName || '';
|
||||||
modelUpstream =
|
const rawQuickUpstream =
|
||||||
resolvedResp ||
|
resolvedResp ||
|
||||||
(mInfo.modelId && mInfo.modelId !== 'unknown' ? mInfo.modelId : mInfo.shortName) ||
|
(mInfo.modelId && mInfo.modelId !== 'unknown' ? mInfo.modelId : mInfo.shortName) ||
|
||||||
'';
|
'';
|
||||||
|
modelUpstream = formatUpstreamModelId(rawQuickUpstream, mInfo);
|
||||||
latestTokPerSec = roundMetric(speedMetric(bestMetricStep).value);
|
latestTokPerSec = roundMetric(speedMetric(bestMetricStep).value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,11 @@ import {
|
|||||||
} from '../speed-metrics.mjs';
|
} from '../speed-metrics.mjs';
|
||||||
import { roundMetric, trajectoryCache } from './config.mjs';
|
import { roundMetric, trajectoryCache } from './config.mjs';
|
||||||
import { loadExternalDeepStatsCache } from './local-scanner.mjs';
|
import { loadExternalDeepStatsCache } from './local-scanner.mjs';
|
||||||
import { computeStepCost, resolveModelInfo } from './model-pricing.mjs';
|
import {
|
||||||
|
computeStepCost,
|
||||||
|
formatUpstreamModelId,
|
||||||
|
resolveModelInfo,
|
||||||
|
} from './model-pricing.mjs';
|
||||||
|
|
||||||
function safeTok(val) {
|
function safeTok(val) {
|
||||||
const n = Number(val);
|
const n = Number(val);
|
||||||
@@ -260,7 +264,10 @@ function accumulateStepIntoModelMap(perModelStats, st, mInfo, stepCost) {
|
|||||||
perModelStats.set(modelGroupKey, {
|
perModelStats.set(modelGroupKey, {
|
||||||
label: modelGroupKey,
|
label: modelGroupKey,
|
||||||
shortName: mInfo.shortName,
|
shortName: mInfo.shortName,
|
||||||
fallbackModelId: mInfo.modelId && mInfo.modelId !== 'unknown' ? mInfo.modelId : '',
|
fallbackModelId:
|
||||||
|
mInfo.modelId && mInfo.modelId !== 'unknown'
|
||||||
|
? formatUpstreamModelId(mInfo.modelId, mInfo)
|
||||||
|
: '',
|
||||||
upstreamModelCounts: new Map(),
|
upstreamModelCounts: new Map(),
|
||||||
family: mInfo.family,
|
family: mInfo.family,
|
||||||
calls: 0,
|
calls: 0,
|
||||||
@@ -276,9 +283,10 @@ function accumulateStepIntoModelMap(perModelStats, st, mInfo, stepCost) {
|
|||||||
}
|
}
|
||||||
const agg = perModelStats.get(modelGroupKey);
|
const agg = perModelStats.get(modelGroupKey);
|
||||||
if (st.responseModel) {
|
if (st.responseModel) {
|
||||||
|
const formattedResp = formatUpstreamModelId(st.responseModel, mInfo);
|
||||||
agg.upstreamModelCounts.set(
|
agg.upstreamModelCounts.set(
|
||||||
st.responseModel,
|
formattedResp,
|
||||||
(agg.upstreamModelCounts.get(st.responseModel) || 0) + 1
|
(agg.upstreamModelCounts.get(formattedResp) || 0) + 1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
accumulateSpeed(agg.speedAccumulator, st);
|
accumulateSpeed(agg.speedAccumulator, st);
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>用量监控</title>
|
<title>用量监控</title>
|
||||||
<link rel="stylesheet" href="/styles.css?v=1794408541340">
|
<link rel="stylesheet" href="/styles.css?v=1794557701523">
|
||||||
<script src="/preload.js"></script>
|
<script src="/preload.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app-root"></div>
|
<div id="app-root"></div>
|
||||||
<script src="/app.js?v=1794408541340"></script>
|
<script src="/app.js?v=1794557701523"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
computeRuntimeCodeVersion,
|
computeRuntimeCodeVersion,
|
||||||
isPlainObject,
|
isPlainObject,
|
||||||
loadSettings,
|
loadSettings,
|
||||||
|
normalizeOrchestratorIdMode,
|
||||||
normalizePluginUpdateMode,
|
normalizePluginUpdateMode,
|
||||||
normalizeTopbarCapsuleSlots,
|
normalizeTopbarCapsuleSlots,
|
||||||
normalizeWeeklyLimitMode,
|
normalizeWeeklyLimitMode,
|
||||||
@@ -212,6 +213,10 @@ function executeSettingsAction(data) {
|
|||||||
typeof payload.showUpstreamModel === 'boolean'
|
typeof payload.showUpstreamModel === 'boolean'
|
||||||
? payload.showUpstreamModel
|
? payload.showUpstreamModel
|
||||||
: Boolean(current.showUpstreamModel),
|
: Boolean(current.showUpstreamModel),
|
||||||
|
orchestratorIdMode:
|
||||||
|
payload.orchestratorIdMode !== undefined
|
||||||
|
? normalizeOrchestratorIdMode(payload.orchestratorIdMode)
|
||||||
|
: normalizeOrchestratorIdMode(current.orchestratorIdMode),
|
||||||
pluginUpdateMode: nextPluginUpdateMode,
|
pluginUpdateMode: nextPluginUpdateMode,
|
||||||
autoUpdatePlugin: nextPluginUpdateMode === 'auto',
|
autoUpdatePlugin: nextPluginUpdateMode === 'auto',
|
||||||
enableWindowOverlay:
|
enableWindowOverlay:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "usage-monitor-panel",
|
"name": "usage-monitor-panel",
|
||||||
"version": "1.4.4",
|
"version": "1.4.5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "Sidecar backend and web UI for Antigravity Usage & Speed Monitor.",
|
"description": "Sidecar backend and web UI for Antigravity Usage & Speed Monitor.",
|
||||||
|
|||||||
@@ -573,10 +573,24 @@ export function extractContextBreakdown(chat) {
|
|||||||
*/
|
*/
|
||||||
export function extractModelSteps(rawSteps = [], generatorMetadata = []) {
|
export function extractModelSteps(rawSteps = [], generatorMetadata = []) {
|
||||||
const genByStep = new Map();
|
const genByStep = new Map();
|
||||||
|
const orchestratorExecModels = new Set();
|
||||||
|
const collectOrchestratorExecModel = (pc) => {
|
||||||
|
const execModel = pc?.planExecuteConfig?.executionModel;
|
||||||
|
if (
|
||||||
|
typeof execModel === 'string' &&
|
||||||
|
execModel.trim() &&
|
||||||
|
/orchestrator|MODEL_PLACEHOLDER_M(?:667|681)\b/i.test(
|
||||||
|
`${pc?.modelName || ''} ${pc?.planModel || ''}`
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
orchestratorExecModels.add(execModel.trim());
|
||||||
|
}
|
||||||
|
};
|
||||||
let latestBreakdownChat = null;
|
let latestBreakdownChat = null;
|
||||||
let latestBreakdownStepIdx = -1;
|
let latestBreakdownStepIdx = -1;
|
||||||
|
|
||||||
for (const gm of generatorMetadata || []) {
|
for (const gm of generatorMetadata || []) {
|
||||||
|
collectOrchestratorExecModel(gm?.plannerConfig);
|
||||||
if (!gm?.chatModel) {
|
if (!gm?.chatModel) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -605,6 +619,11 @@ export function extractModelSteps(rawSteps = [], generatorMetadata = []) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const stepIndex = m.sourceTrajectoryStepInfo?.stepIndex ?? index;
|
const stepIndex = m.sourceTrajectoryStepInfo?.stepIndex ?? index;
|
||||||
|
if (Array.isArray(m.generatorMetadata)) {
|
||||||
|
for (const g of m.generatorMetadata) {
|
||||||
|
collectOrchestratorExecModel(g?.plannerConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
const inlineChat = Array.isArray(m.generatorMetadata)
|
const inlineChat = Array.isArray(m.generatorMetadata)
|
||||||
? m.generatorMetadata.find((g) => g?.chatModel)
|
? m.generatorMetadata.find((g) => g?.chatModel)
|
||||||
: null;
|
: null;
|
||||||
@@ -708,14 +727,27 @@ export function extractModelSteps(rawSteps = [], generatorMetadata = []) {
|
|||||||
m?.responseModel,
|
m?.responseModel,
|
||||||
].find(isValidModelValue);
|
].find(isValidModelValue);
|
||||||
|
|
||||||
|
const resolvedModelKey = identity ? identity[1].trim() : 'unknown';
|
||||||
|
const rawDisplayName = chat?.modelDisplayName || '';
|
||||||
|
const isGenericWorkerDisplay =
|
||||||
|
!rawDisplayName ||
|
||||||
|
/\borchestrator\b/i.test(rawDisplayName) ||
|
||||||
|
/^gemini\s+(?:flash|pro)(?:\s+worker)?$/i.test(rawDisplayName.trim());
|
||||||
|
const resolvedDisplayName =
|
||||||
|
(orchestratorExecModels.has(resolvedModelKey) ||
|
||||||
|
/^gemini-flash-worker-agy$/i.test(rawResponseModel || '')) &&
|
||||||
|
isGenericWorkerDisplay
|
||||||
|
? 'Orchestrator Worker (Hydrogen)'
|
||||||
|
: rawDisplayName;
|
||||||
|
|
||||||
result.push({
|
result.push({
|
||||||
stepIndex,
|
stepIndex,
|
||||||
isCompactionStep,
|
isCompactionStep,
|
||||||
modelKey: identity ? identity[1].trim() : 'unknown',
|
modelKey: resolvedModelKey,
|
||||||
modelSource: identity?.[0] || 'unavailable',
|
modelSource: identity?.[0] || 'unavailable',
|
||||||
responseModel: rawResponseModel ? rawResponseModel.trim() : '',
|
responseModel: rawResponseModel ? rawResponseModel.trim() : '',
|
||||||
modelIdentityVersion: MODEL_IDENTITY_VERSION,
|
modelIdentityVersion: MODEL_IDENTITY_VERSION,
|
||||||
modelDisplayName: chat?.modelDisplayName || '',
|
modelDisplayName: resolvedDisplayName,
|
||||||
apiProvider: u.apiProvider || chat?.usage?.apiProvider || '',
|
apiProvider: u.apiProvider || chat?.usage?.apiProvider || '',
|
||||||
createdAt: m.createdAt || null,
|
createdAt: m.createdAt || null,
|
||||||
createdAtMs: Math.floor(start),
|
createdAtMs: Math.floor(start),
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
formatMetric,
|
formatMetric,
|
||||||
formatTokens,
|
formatTokens,
|
||||||
formatUsd,
|
formatUsd,
|
||||||
|
resolveModelDisplayInfo,
|
||||||
sampleSummary,
|
sampleSummary,
|
||||||
speedReasonText,
|
speedReasonText,
|
||||||
} from '../../core/formatters.js';
|
} from '../../core/formatters.js';
|
||||||
@@ -1990,11 +1991,9 @@ export function mountWindowOverlay() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --- 同步悬停三卡片全景概览(与 LiveOverviewView 保持完全一致的数据口径与视觉呈现) ---
|
// --- 同步悬停三卡片全景概览(与 LiveOverviewView 保持完全一致的数据口径与视觉呈现) ---
|
||||||
const showUpstream = Boolean(telemetry.settings?.showUpstreamModel);
|
const activeModelDisplay = resolveModelDisplayInfo(overviewActive, telemetry.settings, {
|
||||||
const activeModelDisplay =
|
fallback: '模型未知',
|
||||||
(showUpstream
|
}).text;
|
||||||
? overviewActive.activeModelUpstream || overviewActive.activeModelShort
|
|
||||||
: overviewActive.activeModelShort) || '模型未知';
|
|
||||||
|
|
||||||
patchClasses(hoverPulseDot, { 'is-pulsing': Boolean(overviewActive.isRunning || isRunning) });
|
patchClasses(hoverPulseDot, { 'is-pulsing': Boolean(overviewActive.isRunning || isRunning) });
|
||||||
patchText(hoverTpsVal, formatMetric(overviewActive.latestTokPerSec, ' tok/s'));
|
patchText(hoverTpsVal, formatMetric(overviewActive.latestTokPerSec, ' tok/s'));
|
||||||
|
|||||||
@@ -100,3 +100,102 @@ export function formatElapsedSec(seconds) {
|
|||||||
const remM = m % 60;
|
const remM = m % 60;
|
||||||
return `${h}h ${remM}m`;
|
return `${h}h ${remM}m`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 归一化 Orchestrator 系列 ID 显示格式枚举(`'compact'` 精简代号 vs `'full'` 原始完整 ID,默认 `'compact'`)。
|
||||||
|
*
|
||||||
|
* @param {unknown} mode
|
||||||
|
* @returns {'compact'|'full'}
|
||||||
|
*/
|
||||||
|
export function normalizeOrchestratorIdDisplayMode(mode) {
|
||||||
|
return String(mode ?? '').trim().toLowerCase() === 'full' ? 'full' : 'compact';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一解析步骤、会话摘要或模型汇总行面向用户的模型显示文本与悬停提示。
|
||||||
|
*
|
||||||
|
* 规则:
|
||||||
|
* - Orchestrator 系列(`Orchestrator (Carbon)`、`Orchestrator (Argon)`、`gemini-flash-worker-agy` / `M669`)
|
||||||
|
* 独立遵循 `orchestratorIdMode`(`'compact'` 显示 `orchestrator-carbon` / `orchestrator-argon` / `worker-agy-hydrogen`;
|
||||||
|
* `'full'` 显示带括号标注的完整上游 ID),不受普通模型“精简代号 / 原始模型 ID”切换影响;
|
||||||
|
* - 其余普通模型继续按 `showUpstreamModel` 与视图选项切换。
|
||||||
|
*
|
||||||
|
* @param {object|null|undefined} target
|
||||||
|
* @param {{ showUpstreamModel?: boolean, orchestratorIdMode?: string }|boolean} [settings]
|
||||||
|
* @param {{ preferLabelInShort?: boolean, fallback?: string }} [options]
|
||||||
|
* @returns {{ text: string, title: string, isOrchestratorSeries: boolean }}
|
||||||
|
*/
|
||||||
|
export function resolveModelDisplayInfo(target, settings = {}, options = {}) {
|
||||||
|
const showUpstream =
|
||||||
|
typeof settings === 'boolean' ? settings : Boolean(settings?.showUpstreamModel);
|
||||||
|
const orchestratorMode = normalizeOrchestratorIdDisplayMode(
|
||||||
|
typeof settings === 'object' && settings ? settings.orchestratorIdMode : 'compact'
|
||||||
|
);
|
||||||
|
const preferLabelInShort = Boolean(options?.preferLabelInShort);
|
||||||
|
const fallback = options?.fallback ?? '模型未知';
|
||||||
|
|
||||||
|
if (!target || typeof target !== 'object') {
|
||||||
|
return { text: fallback, title: fallback, isOrchestratorSeries: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
const shortText = String(
|
||||||
|
target.activeModelShort ?? target.modelShort ?? target.shortName ?? ''
|
||||||
|
).trim();
|
||||||
|
const labelText = String(
|
||||||
|
target.activeModelLabel ?? target.modelLabel ?? target.label ?? ''
|
||||||
|
).trim();
|
||||||
|
const upstreamText = String(
|
||||||
|
target.activeModelUpstream ?? target.modelUpstream ?? target.upstreamName ?? ''
|
||||||
|
).trim();
|
||||||
|
const responseText = String(target.responseModel ?? '').trim();
|
||||||
|
const modelKeyText = String(target.modelKey ?? '').trim();
|
||||||
|
|
||||||
|
const isCompaction =
|
||||||
|
Boolean(target.isCompactionStep) ||
|
||||||
|
/·压缩\s*$/.test(shortText) ||
|
||||||
|
/·压缩\s*$/.test(upstreamText) ||
|
||||||
|
/·压缩\s*$/.test(labelText);
|
||||||
|
|
||||||
|
const combined = `${modelKeyText} ${shortText} ${labelText} ${upstreamText} ${responseText}`;
|
||||||
|
const isOrchWorker =
|
||||||
|
/\bMODEL_PLACEHOLDER_M669\b|\b[a-z0-9.-]*worker-agy\b|\bworker-agy-hydrogen\b|\bOrchestrator\s+Worker\b/i.test(
|
||||||
|
combined
|
||||||
|
);
|
||||||
|
const isOrchSeries =
|
||||||
|
isOrchWorker ||
|
||||||
|
/\bgemini-pro-orchestrator(?:-argon)?\b|\borchestrator-(?:carbon|argon)\b|\borch-(?:carbon|argon)(?:·压缩)?(?=\s|$)|Orchestrator\s*\((?:Carbon|Argon)\)|\bMODEL_PLACEHOLDER_M(?:667|681)\b/i.test(
|
||||||
|
combined
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isOrchSeries) {
|
||||||
|
let compactId = 'orchestrator-carbon';
|
||||||
|
let fullId = 'gemini-pro-orchestrator (carbon-4)';
|
||||||
|
if (isOrchWorker) {
|
||||||
|
compactId = 'worker-agy-hydrogen';
|
||||||
|
fullId = 'gemini-flash-worker-agy (hydrogen-4)';
|
||||||
|
} else if (/\bargon\b|\bMODEL_PLACEHOLDER_M681\b|\borch-argon\b/i.test(combined)) {
|
||||||
|
compactId = 'orchestrator-argon';
|
||||||
|
fullId = 'gemini-pro-orchestrator-argon (argon-4)';
|
||||||
|
}
|
||||||
|
const suffix = isCompaction ? '·压缩' : '';
|
||||||
|
const text = `${orchestratorMode === 'full' ? fullId : compactId}${suffix}`;
|
||||||
|
const multiUpstream =
|
||||||
|
Array.isArray(target.upstreamModels) && target.upstreamModels.length > 1
|
||||||
|
? target.upstreamModels.join(' / ')
|
||||||
|
: '';
|
||||||
|
const title = multiUpstream || `${fullId}${suffix}`;
|
||||||
|
return { text, title, isOrchestratorSeries: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
const standardText =
|
||||||
|
(showUpstream
|
||||||
|
? upstreamText || responseText || shortText || labelText
|
||||||
|
: preferLabelInShort
|
||||||
|
? labelText || shortText
|
||||||
|
: shortText || labelText) || fallback;
|
||||||
|
const standardTitle =
|
||||||
|
showUpstream && Array.isArray(target.upstreamModels) && target.upstreamModels.length > 1
|
||||||
|
? target.upstreamModels.join(' / ')
|
||||||
|
: standardText;
|
||||||
|
return { text: standardText, title: standardTitle, isOrchestratorSeries: false };
|
||||||
|
}
|
||||||
|
|||||||
@@ -88,14 +88,29 @@ export function normalizeClientUpdateMode(mode, legacyAutoUpdate) {
|
|||||||
return 'manual';
|
return 'manual';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function normalizeClientOrchestratorIdMode(mode) {
|
||||||
|
return String(mode ?? '').trim().toLowerCase() === 'full' ? 'full' : 'compact';
|
||||||
|
}
|
||||||
|
|
||||||
function isEquivalentTelemetry(prev, next) {
|
function isEquivalentTelemetry(prev, next) {
|
||||||
if (!prev || !next) return false;
|
if (!prev || !next) return false;
|
||||||
if (prev === next) return true;
|
if (prev === next) return true;
|
||||||
|
|
||||||
// 1. 比对系统设置项(模型显示策略、周预算模式与额度、插件更新策略、双栖与顶栏槽位配置)
|
// 1. 比对系统设置项(模型显示策略、Orchestrator ID 显示风格、周预算模式与额度、插件更新策略、双栖与顶栏槽位配置)
|
||||||
const pAct = prev.activeConversation;
|
const pAct = prev.activeConversation;
|
||||||
const nAct = next.activeConversation;
|
const nAct = next.activeConversation;
|
||||||
if (prev.settings?.showUpstreamModel !== next.settings?.showUpstreamModel) return false;
|
if (prev.settings?.showUpstreamModel !== next.settings?.showUpstreamModel) return false;
|
||||||
|
const prevOrchIdMode =
|
||||||
|
String(prev.settings?.orchestratorIdMode ?? 'compact').trim().toLowerCase() === 'full'
|
||||||
|
? 'full'
|
||||||
|
: 'compact';
|
||||||
|
const nextOrchIdMode =
|
||||||
|
String(next.settings?.orchestratorIdMode ?? 'compact').trim().toLowerCase() === 'full'
|
||||||
|
? 'full'
|
||||||
|
: 'compact';
|
||||||
|
if (prevOrchIdMode !== nextOrchIdMode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (prev.settings?.weeklyLimitMode !== next.settings?.weeklyLimitMode) return false;
|
if (prev.settings?.weeklyLimitMode !== next.settings?.weeklyLimitMode) return false;
|
||||||
if (prev.settings?.weeklyTokenBudget !== next.settings?.weeklyTokenBudget) return false;
|
if (prev.settings?.weeklyTokenBudget !== next.settings?.weeklyTokenBudget) return false;
|
||||||
if (prev.settings?.weeklyCostBudget !== next.settings?.weeklyCostBudget) return false;
|
if (prev.settings?.weeklyCostBudget !== next.settings?.weeklyCostBudget) return false;
|
||||||
@@ -607,6 +622,9 @@ export async function saveSettingsPatch(patch) {
|
|||||||
safePatch.weeklyLimitMode =
|
safePatch.weeklyLimitMode =
|
||||||
mode === 'custom_tokens' || mode === 'custom_cost' ? mode : 'official';
|
mode === 'custom_tokens' || mode === 'custom_cost' ? mode : 'official';
|
||||||
}
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'orchestratorIdMode')) {
|
||||||
|
safePatch.orchestratorIdMode = normalizeClientOrchestratorIdMode(safePatch.orchestratorIdMode);
|
||||||
|
}
|
||||||
if (Object.prototype.hasOwnProperty.call(safePatch, 'showTopbarMultiSession')) {
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'showTopbarMultiSession')) {
|
||||||
safePatch.showTopbarMultiSession = Boolean(safePatch.showTopbarMultiSession);
|
safePatch.showTopbarMultiSession = Boolean(safePatch.showTopbarMultiSession);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import {
|
|||||||
formatDateSpanBadge,
|
formatDateSpanBadge,
|
||||||
formatTokensPrecise,
|
formatTokensPrecise,
|
||||||
formatUsd,
|
formatUsd,
|
||||||
|
normalizeOrchestratorIdDisplayMode,
|
||||||
|
resolveModelDisplayInfo,
|
||||||
} from '../core/formatters.js';
|
} from '../core/formatters.js';
|
||||||
import { createSvgIcon } from '../icons/SvgIcon.js';
|
import { createSvgIcon } from '../icons/SvgIcon.js';
|
||||||
import { fetchTelemetry, telemetryStore } from '../store/telemetryStore.js';
|
import { fetchTelemetry, telemetryStore } from '../store/telemetryStore.js';
|
||||||
@@ -411,7 +413,9 @@ export const ConsumptionView = defineComponent({
|
|||||||
* 增量更新热门模型或数据来源单行的指标文本与 4 段比例条宽度。
|
* 增量更新热门模型或数据来源单行的指标文本与 4 段比例条宽度。
|
||||||
*/
|
*/
|
||||||
function updateBreakdownItemRow(refs, item, grandTotalTokens, showTokensInHeader = true) {
|
function updateBreakdownItemRow(refs, item, grandTotalTokens, showTokensInHeader = true) {
|
||||||
patchText(refs.nameEl, item.label || item.name || item.shortName || '—');
|
const displayLabel = item.label || item.name || item.shortName || '—';
|
||||||
|
patchText(refs.nameEl, displayLabel);
|
||||||
|
patchAttr(refs.nameEl, 'title', item.title || displayLabel);
|
||||||
const total = Number(item.totalTokens || 0);
|
const total = Number(item.totalTokens || 0);
|
||||||
const share = grandTotalTokens > 0 ? +((total / grandTotalTokens) * 100).toFixed(1) : 0;
|
const share = grandTotalTokens > 0 ? +((total / grandTotalTokens) * 100).toFixed(1) : 0;
|
||||||
patchText(refs.pctBadge, `${share.toFixed(1)}%`);
|
patchText(refs.pctBadge, `${share.toFixed(1)}%`);
|
||||||
@@ -542,8 +546,11 @@ export const ConsumptionView = defineComponent({
|
|||||||
);
|
);
|
||||||
trendChart.update(trendSeries);
|
trendChart.update(trendSeries);
|
||||||
|
|
||||||
// 3. 同步热门模型列表(按总 Token 数降序排列并执行键值增量对账,遵循模型名称显示格式设置)
|
// 3. 同步热门模型列表(按总 Token 数降序排列并执行键值增量对账,遵循模型名称与 Orchestrator ID 格式设置)
|
||||||
const showUpstream = Boolean(slice.showUpstreamModel);
|
const displaySettings = {
|
||||||
|
showUpstreamModel: Boolean(slice.showUpstreamModel),
|
||||||
|
orchestratorIdMode: slice.orchestratorIdMode,
|
||||||
|
};
|
||||||
const models = (slice.modelBreakdown || [])
|
const models = (slice.modelBreakdown || [])
|
||||||
.slice()
|
.slice()
|
||||||
.sort((a, b) => (b.totalTokens || 0) - (a.totalTokens || 0));
|
.sort((a, b) => (b.totalTokens || 0) - (a.totalTokens || 0));
|
||||||
@@ -551,18 +558,20 @@ export const ConsumptionView = defineComponent({
|
|||||||
|
|
||||||
patchKeyedList(modelsListEl, models, {
|
patchKeyedList(modelsListEl, models, {
|
||||||
keyFn: (m) => m.label || m.shortName,
|
keyFn: (m) => m.label || m.shortName,
|
||||||
sigFn: (m) =>
|
sigFn: (m) => {
|
||||||
`${showUpstream}:${m.label}:${m.upstreamName || ''}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.calls}:${modelsTotalTok}`,
|
const disp = resolveModelDisplayInfo(m, displaySettings, { preferLabelInShort: true });
|
||||||
|
return `${disp.text}:${disp.title}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.calls}:${modelsTotalTok}`;
|
||||||
|
},
|
||||||
createRow: createBreakdownItemRow,
|
createRow: createBreakdownItemRow,
|
||||||
updateRow: (refs, m) =>
|
updateRow: (refs, m) => {
|
||||||
updateBreakdownItemRow(
|
const disp = resolveModelDisplayInfo(m, displaySettings, { preferLabelInShort: true });
|
||||||
|
return updateBreakdownItemRow(
|
||||||
refs,
|
refs,
|
||||||
showUpstream
|
{ ...m, label: disp.text, title: disp.title },
|
||||||
? { ...m, label: m.upstreamName || m.label || m.shortName }
|
|
||||||
: m,
|
|
||||||
modelsTotalTok,
|
modelsTotalTok,
|
||||||
true
|
true
|
||||||
),
|
);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 4. 同步数据来源列表
|
// 4. 同步数据来源列表
|
||||||
@@ -632,6 +641,9 @@ export const ConsumptionView = defineComponent({
|
|||||||
consumption: st.telemetry?.consumption,
|
consumption: st.telemetry?.consumption,
|
||||||
modelBreakdown: st.telemetry?.modelBreakdown,
|
modelBreakdown: st.telemetry?.modelBreakdown,
|
||||||
showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel),
|
showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel),
|
||||||
|
orchestratorIdMode: normalizeOrchestratorIdDisplayMode(
|
||||||
|
st.telemetry?.settings?.orchestratorIdMode
|
||||||
|
),
|
||||||
}),
|
}),
|
||||||
(slice) => {
|
(slice) => {
|
||||||
latestSlice = slice;
|
latestSlice = slice;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
formatMetric,
|
formatMetric,
|
||||||
formatTokens,
|
formatTokens,
|
||||||
formatUsd,
|
formatUsd,
|
||||||
|
resolveModelDisplayInfo,
|
||||||
sampleSummary,
|
sampleSummary,
|
||||||
speedReasonText,
|
speedReasonText,
|
||||||
} from '../core/formatters.js';
|
} from '../core/formatters.js';
|
||||||
@@ -860,12 +861,10 @@ export const LiveOverviewView = defineComponent({
|
|||||||
ensureLiveTicker();
|
ensureLiveTicker();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. 更新 4 格实时测速矩阵(展示当前会话全局汇总指标,遵循模型名称格式设置)
|
// 1. 更新 4 格实时测速矩阵(展示当前会话全局汇总指标,遵循模型名称格式与 Orchestrator ID 格式设置)
|
||||||
const showUpstream = Boolean(data.settings?.showUpstreamModel);
|
const activeModelDisplay = resolveModelDisplayInfo(active, data.settings, {
|
||||||
const activeModelDisplay =
|
fallback: '模型未知',
|
||||||
(showUpstream
|
}).text;
|
||||||
? active.activeModelUpstream || active.activeModelShort
|
|
||||||
: active.activeModelShort) || '模型未知';
|
|
||||||
patchClasses(pulseDot, { 'is-pulsing': Boolean(active.isRunning) });
|
patchClasses(pulseDot, { 'is-pulsing': Boolean(active.isRunning) });
|
||||||
patchText(tpsVal, formatMetric(active.latestTokPerSec, ' tok/s'));
|
patchText(tpsVal, formatMetric(active.latestTokPerSec, ' tok/s'));
|
||||||
const reason = speedReasonText(active.latestSpeedReason);
|
const reason = speedReasonText(active.latestSpeedReason);
|
||||||
@@ -914,9 +913,9 @@ export const LiveOverviewView = defineComponent({
|
|||||||
|
|
||||||
const allAgentPills = agents.map((ag) => {
|
const allAgentPills = agents.map((ag) => {
|
||||||
const agPct = ag.context?.usedPct ?? 0;
|
const agPct = ag.context?.usedPct ?? 0;
|
||||||
const agModelDisplay =
|
const agModelDisplay = resolveModelDisplayInfo(ag, data.settings, {
|
||||||
(showUpstream ? ag.activeModelUpstream || ag.activeModelShort : ag.activeModelShort) ||
|
fallback: '模型未知',
|
||||||
'模型未知';
|
}).text;
|
||||||
return {
|
return {
|
||||||
key: ag.agentId,
|
key: ag.agentId,
|
||||||
label: `${ag.badgeText || ag.shortLabel} ${agPct}%`,
|
label: `${ag.badgeText || ag.shortLabel} ${agPct}%`,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @fileoverview View 4: SettingsView (系统设置视图).
|
* @fileoverview View 4: SettingsView (系统设置视图).
|
||||||
* 采用定制的 `CustomSelect` 与 `SegmentedControl` 替代所有原生表单控件,分为三个单层细线设置面板:
|
* 采用定制的 `CustomSelect` 与 `SegmentedControl` 替代所有原生表单控件,分为三个单层细线设置面板:
|
||||||
* 1. 常规设置:配置面板挂载方式(双栖挂载 / 仅右侧辅助栏)与模型名称格式(精简代号 / 原始模型 ID);
|
* 1. 常规设置:配置面板挂载方式(双栖挂载 / 仅右侧辅助栏)、模型名称格式(精简代号 / 原始模型 ID)与 Orchestrator 系列 ID 格式;
|
||||||
* 2. 顶部栏定制:控制左侧「实时运行会话」入口开关,以及自由定义右侧精简胶囊三个数值槽位的显示内容与左右顺序;
|
* 2. 顶部栏定制:控制左侧「实时运行会话」入口开关,以及自由定义右侧精简胶囊三个数值槽位的显示内容与左右顺序;
|
||||||
* 3. 版本更新:配置插件自动更新策略、手动同步云端模型价格表,以及检查并执行 Git/ZIP 双模式插件升级。
|
* 3. 版本更新:配置插件自动更新策略、手动同步云端模型价格表,以及检查并执行 Git/ZIP 双模式插件升级。
|
||||||
*/
|
*/
|
||||||
@@ -11,6 +11,7 @@ import { h, patchAttr, patchClasses, patchText } from '../core/domPatch.js';
|
|||||||
import { createSvgIcon } from '../icons/SvgIcon.js';
|
import { createSvgIcon } from '../icons/SvgIcon.js';
|
||||||
import {
|
import {
|
||||||
DEFAULT_CLIENT_TOPBAR_SLOTS,
|
DEFAULT_CLIENT_TOPBAR_SLOTS,
|
||||||
|
normalizeClientOrchestratorIdMode,
|
||||||
normalizeClientTopbarSlots,
|
normalizeClientTopbarSlots,
|
||||||
normalizeClientUpdateMode,
|
normalizeClientUpdateMode,
|
||||||
saveSettingsPatch,
|
saveSettingsPatch,
|
||||||
@@ -29,6 +30,12 @@ const STEP_MODEL_DISPLAY_OPTIONS = [
|
|||||||
{ value: 'upstream', label: '原始模型 ID (如 gemini-3.8-flash-n)' },
|
{ value: 'upstream', label: '原始模型 ID (如 gemini-3.8-flash-n)' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** Orchestrator 系列模型 ID 显示方式可选项(独立于普通模型名称格式) */
|
||||||
|
const ORCHESTRATOR_ID_DISPLAY_OPTIONS = [
|
||||||
|
{ value: 'compact', label: '精简代号 (如 orchestrator-argon)' },
|
||||||
|
{ value: 'full', label: '原始完整 ID (如 gemini-pro-orchestrator)' },
|
||||||
|
];
|
||||||
|
|
||||||
/** 面板挂载模式可选项(顶部栏 + 侧边栏 vs 仅侧边栏) */
|
/** 面板挂载模式可选项(顶部栏 + 侧边栏 vs 仅侧边栏) */
|
||||||
const WINDOW_MOUNT_OPTIONS = [
|
const WINDOW_MOUNT_OPTIONS = [
|
||||||
{ value: 'dual', label: '双栖挂载 (顶部栏 + 侧边栏)' },
|
{ value: 'dual', label: '双栖挂载 (顶部栏 + 侧边栏)' },
|
||||||
@@ -81,6 +88,7 @@ export const SettingsView = defineComponent({
|
|||||||
name: 'SettingsView',
|
name: 'SettingsView',
|
||||||
setup({ onCleanup }) {
|
setup({ onCleanup }) {
|
||||||
let draftShowUpstreamModel = false;
|
let draftShowUpstreamModel = false;
|
||||||
|
let draftOrchestratorIdMode = 'compact';
|
||||||
let draftPluginUpdateMode = 'manual';
|
let draftPluginUpdateMode = 'manual';
|
||||||
let draftEnableWindowOverlay = true;
|
let draftEnableWindowOverlay = true;
|
||||||
let draftShowTopbarMulti = true;
|
let draftShowTopbarMulti = true;
|
||||||
@@ -185,6 +193,29 @@ export const SettingsView = defineComponent({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const orchestratorIdSelect = CustomSelect({
|
||||||
|
modelValue: 'compact',
|
||||||
|
icon: 'layers',
|
||||||
|
options: ORCHESTRATOR_ID_DISPLAY_OPTIONS,
|
||||||
|
onUpdateModelValue: async (val) => {
|
||||||
|
const nextMode = normalizeClientOrchestratorIdMode(val);
|
||||||
|
draftOrchestratorIdMode = nextMode;
|
||||||
|
orchestratorIdSelect.setValue(nextMode);
|
||||||
|
showSaveFeedback('保存中…');
|
||||||
|
try {
|
||||||
|
await saveSettingsPatch({
|
||||||
|
orchestratorIdMode: nextMode,
|
||||||
|
});
|
||||||
|
showSaveFeedback('已保存');
|
||||||
|
} catch {
|
||||||
|
if (latestSettings) {
|
||||||
|
renderSettings(latestSettings);
|
||||||
|
}
|
||||||
|
showSaveFeedback('保存失败');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const generalPanel = h('section', { className: 'panel' }, [
|
const generalPanel = h('section', { className: 'panel' }, [
|
||||||
h('div', { className: 'panel-header' }, [
|
h('div', { className: 'panel-header' }, [
|
||||||
h('span', { className: 'panel-title' }, [
|
h('span', { className: 'panel-title' }, [
|
||||||
@@ -201,6 +232,10 @@ export const SettingsView = defineComponent({
|
|||||||
h('span', { className: 'form-label', text: '模型名称格式' }),
|
h('span', { className: 'form-label', text: '模型名称格式' }),
|
||||||
stepModelSelect.el,
|
stepModelSelect.el,
|
||||||
]),
|
]),
|
||||||
|
h('div', { className: 'form-row' }, [
|
||||||
|
h('span', { className: 'form-label', text: 'Orchestrator 系列 ID' }),
|
||||||
|
orchestratorIdSelect.el,
|
||||||
|
]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// --- 面板 2:顶部栏定制(实时运行会话开关 + 右侧三槽位指标与顺序自定义) ---
|
// --- 面板 2:顶部栏定制(实时运行会话开关 + 右侧三槽位指标与顺序自定义) ---
|
||||||
@@ -532,6 +567,7 @@ export const SettingsView = defineComponent({
|
|||||||
function renderSettings(settings) {
|
function renderSettings(settings) {
|
||||||
if (!settings) return;
|
if (!settings) return;
|
||||||
draftShowUpstreamModel = Boolean(settings.showUpstreamModel);
|
draftShowUpstreamModel = Boolean(settings.showUpstreamModel);
|
||||||
|
draftOrchestratorIdMode = normalizeClientOrchestratorIdMode(settings.orchestratorIdMode);
|
||||||
draftPluginUpdateMode = normalizeClientUpdateMode(
|
draftPluginUpdateMode = normalizeClientUpdateMode(
|
||||||
settings.pluginUpdateMode,
|
settings.pluginUpdateMode,
|
||||||
settings.autoUpdatePlugin
|
settings.autoUpdatePlugin
|
||||||
@@ -542,6 +578,7 @@ export const SettingsView = defineComponent({
|
|||||||
|
|
||||||
windowMountSelect.setValue(draftEnableWindowOverlay ? 'dual' : 'sidebar');
|
windowMountSelect.setValue(draftEnableWindowOverlay ? 'dual' : 'sidebar');
|
||||||
stepModelSelect.setValue(draftShowUpstreamModel ? 'upstream' : 'short');
|
stepModelSelect.setValue(draftShowUpstreamModel ? 'upstream' : 'short');
|
||||||
|
orchestratorIdSelect.setValue(draftOrchestratorIdMode);
|
||||||
autoUpdateSelect.setValue(draftPluginUpdateMode);
|
autoUpdateSelect.setValue(draftPluginUpdateMode);
|
||||||
syncTopbarControls();
|
syncTopbarControls();
|
||||||
viewScrollbar.refresh();
|
viewScrollbar.refresh();
|
||||||
@@ -623,6 +660,7 @@ export const SettingsView = defineComponent({
|
|||||||
unsubView();
|
unsubView();
|
||||||
windowMountSelect.destroy();
|
windowMountSelect.destroy();
|
||||||
stepModelSelect.destroy();
|
stepModelSelect.destroy();
|
||||||
|
orchestratorIdSelect.destroy();
|
||||||
multiSessionToggle.destroy();
|
multiSessionToggle.destroy();
|
||||||
for (const sel of slotSelects) {
|
for (const sel of slotSelects) {
|
||||||
sel.destroy();
|
sel.destroy();
|
||||||
@@ -636,6 +674,7 @@ export const SettingsView = defineComponent({
|
|||||||
refs: {
|
refs: {
|
||||||
windowMountSelect,
|
windowMountSelect,
|
||||||
stepModelSelect,
|
stepModelSelect,
|
||||||
|
orchestratorIdSelect,
|
||||||
multiSessionToggle,
|
multiSessionToggle,
|
||||||
slotSelects,
|
slotSelects,
|
||||||
resetTopbarBtn,
|
resetTopbarBtn,
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import {
|
|||||||
formatMetric,
|
formatMetric,
|
||||||
formatTokens,
|
formatTokens,
|
||||||
formatUsd,
|
formatUsd,
|
||||||
|
normalizeOrchestratorIdDisplayMode,
|
||||||
|
resolveModelDisplayInfo,
|
||||||
sampleSummary,
|
sampleSummary,
|
||||||
speedReasonText,
|
speedReasonText,
|
||||||
} from '../core/formatters.js';
|
} from '../core/formatters.js';
|
||||||
@@ -204,7 +206,10 @@ export const StepsDetailView = defineComponent({
|
|||||||
(Array.isArray(scopedConv?.modelBreakdown) && scopedConv.modelBreakdown.length > 0
|
(Array.isArray(scopedConv?.modelBreakdown) && scopedConv.modelBreakdown.length > 0
|
||||||
? scopedConv.modelBreakdown
|
? scopedConv.modelBreakdown
|
||||||
: slice.sessionModelBreakdown || slice.modelBreakdown) || [];
|
: slice.sessionModelBreakdown || slice.modelBreakdown) || [];
|
||||||
const showUpstream = Boolean(slice.showUpstreamModel);
|
const displaySettings = {
|
||||||
|
showUpstreamModel: Boolean(slice.showUpstreamModel),
|
||||||
|
orchestratorIdMode: slice.orchestratorIdMode,
|
||||||
|
};
|
||||||
const modelsTabBadge = hasSubagents
|
const modelsTabBadge = hasSubagents
|
||||||
? effectiveScope === 'all'
|
? effectiveScope === 'all'
|
||||||
? '本会话汇总'
|
? '本会话汇总'
|
||||||
@@ -221,8 +226,10 @@ export const StepsDetailView = defineComponent({
|
|||||||
// 1. 单步测速表增量对账:以 `<agentCascadeId>-<stepIndex>` 为稳定行键,仅在签名变化时刷新单元格
|
// 1. 单步测速表增量对账:以 `<agentCascadeId>-<stepIndex>` 为稳定行键,仅在签名变化时刷新单元格
|
||||||
patchKeyedList(stepsTbody, steps, {
|
patchKeyedList(stepsTbody, steps, {
|
||||||
keyFn: (st) => `${st.agentCascadeId || slice.cascadeId || 'conv'}-${st.stepIndex}`,
|
keyFn: (st) => `${st.agentCascadeId || slice.cascadeId || 'conv'}-${st.stepIndex}`,
|
||||||
sigFn: (st) =>
|
sigFn: (st) => {
|
||||||
`${hasSubagents}:${effectiveScope}:${st.agentId || 'main'}:${st.stepIndex}:${showUpstream ? st.modelUpstream || st.responseModel || st.modelShort : st.modelShort}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}`,
|
const disp = resolveModelDisplayInfo(st, displaySettings, { fallback: '—' });
|
||||||
|
return `${hasSubagents}:${effectiveScope}:${st.agentId || 'main'}:${st.stepIndex}:${disp.text}:${disp.title}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}`;
|
||||||
|
},
|
||||||
createRow: () => {
|
createRow: () => {
|
||||||
const agentBadgeEl = h('span', {
|
const agentBadgeEl = h('span', {
|
||||||
className: 'agent-badge is-clickable',
|
className: 'agent-badge is-clickable',
|
||||||
@@ -289,12 +296,9 @@ export const StepsDetailView = defineComponent({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
patchText(refs.stepNumText, `#${Number(st.stepIndex)}`);
|
patchText(refs.stepNumText, `#${Number(st.stepIndex)}`);
|
||||||
const modelText =
|
const modelDisplay = resolveModelDisplayInfo(st, displaySettings, { fallback: '—' });
|
||||||
(showUpstream ? st.modelUpstream || st.responseModel : st.modelShort) ||
|
patchText(refs.tdModel, modelDisplay.text);
|
||||||
st.modelShort ||
|
patchAttr(refs.tdModel, 'title', modelDisplay.title);
|
||||||
'—';
|
|
||||||
patchText(refs.tdModel, modelText);
|
|
||||||
patchAttr(refs.tdModel, 'title', modelText);
|
|
||||||
|
|
||||||
patchText(refs.speedMain, formatMetric(st.tokPerSec, ' tok/s'));
|
patchText(refs.speedMain, formatMetric(st.tokPerSec, ' tok/s'));
|
||||||
const reason = speedReasonText(st.selectedSpeedReason);
|
const reason = speedReasonText(st.selectedSpeedReason);
|
||||||
@@ -317,8 +321,10 @@ export const StepsDetailView = defineComponent({
|
|||||||
// 2. 按模型汇总表增量对账:以模型标识为稳定行键,展示调用次数、加权均速、有效样本比与总费用
|
// 2. 按模型汇总表增量对账:以模型标识为稳定行键,展示调用次数、加权均速、有效样本比与总费用
|
||||||
patchKeyedList(modelsTbody, models, {
|
patchKeyedList(modelsTbody, models, {
|
||||||
keyFn: (m) => m.label || m.shortName,
|
keyFn: (m) => m.label || m.shortName,
|
||||||
sigFn: (m) =>
|
sigFn: (m) => {
|
||||||
`${showUpstream ? m.upstreamName || m.shortName : m.shortName}:${m.calls}:${m.avgTokPerSec}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.speedSummary?.sampleCount}`,
|
const disp = resolveModelDisplayInfo(m, displaySettings, { fallback: '—' });
|
||||||
|
return `${disp.text}:${disp.title}:${m.calls}:${m.avgTokPerSec}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.speedSummary?.sampleCount}`;
|
||||||
|
},
|
||||||
createRow: () => {
|
createRow: () => {
|
||||||
const tdName = h('td', {
|
const tdName = h('td', {
|
||||||
style: 'font-weight: 600; max-width: 165px; overflow: hidden; text-overflow: ellipsis;',
|
style: 'font-weight: 600; max-width: 165px; overflow: hidden; text-overflow: ellipsis;',
|
||||||
@@ -336,15 +342,9 @@ export const StepsDetailView = defineComponent({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
updateRow: (refs, m) => {
|
updateRow: (refs, m) => {
|
||||||
const nameText = showUpstream
|
const modelDisplay = resolveModelDisplayInfo(m, displaySettings, { fallback: '—' });
|
||||||
? m.upstreamName || m.shortName || m.label
|
patchText(refs.tdName, modelDisplay.text);
|
||||||
: m.shortName || m.label;
|
patchAttr(refs.tdName, 'title', modelDisplay.title);
|
||||||
patchText(refs.tdName, nameText);
|
|
||||||
const fullUpstreamTitle =
|
|
||||||
showUpstream && Array.isArray(m.upstreamModels) && m.upstreamModels.length > 1
|
|
||||||
? m.upstreamModels.join(' / ')
|
|
||||||
: nameText;
|
|
||||||
patchAttr(refs.tdName, 'title', fullUpstreamTitle);
|
|
||||||
patchText(refs.tdCalls, String(Number(m.calls || 0)));
|
patchText(refs.tdCalls, String(Number(m.calls || 0)));
|
||||||
patchText(refs.speedMain, formatMetric(m.avgTokPerSec, ' tok/s'));
|
patchText(refs.speedMain, formatMetric(m.avgTokPerSec, ' tok/s'));
|
||||||
patchText(refs.speedSub, `有效 ${sampleSummary(m.speedSummary)}`);
|
patchText(refs.speedSub, `有效 ${sampleSummary(m.speedSummary)}`);
|
||||||
@@ -368,6 +368,9 @@ export const StepsDetailView = defineComponent({
|
|||||||
sessionModelBreakdown: st.telemetry?.activeConversation?.modelBreakdown,
|
sessionModelBreakdown: st.telemetry?.activeConversation?.modelBreakdown,
|
||||||
modelBreakdown: st.telemetry?.modelBreakdown,
|
modelBreakdown: st.telemetry?.modelBreakdown,
|
||||||
showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel),
|
showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel),
|
||||||
|
orchestratorIdMode: normalizeOrchestratorIdDisplayMode(
|
||||||
|
st.telemetry?.settings?.orchestratorIdMode
|
||||||
|
),
|
||||||
}),
|
}),
|
||||||
(slice) => {
|
(slice) => {
|
||||||
latestSlice = slice;
|
latestSlice = slice;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ test('BUG-01 & INCON-01: Google-proxied Claude/GPT/o-series never misclassify as
|
|||||||
const m20 = h.resolveModelInfo('MODEL_PLACEHOLDER_M20', new Map(), 'API_PROVIDER_GOOGLE_GEMINI');
|
const m20 = h.resolveModelInfo('MODEL_PLACEHOLDER_M20', new Map(), 'API_PROVIDER_GOOGLE_GEMINI');
|
||||||
assert.equal(m20.modelId, 'gemini-3.5-flash');
|
assert.equal(m20.modelId, 'gemini-3.5-flash');
|
||||||
|
|
||||||
// Gemini Hydrogen (3.8 Flash pricing) & Helix (3.5 Flash Lite pricing), shared Gemini pool
|
// Gemini Hydrogen ($1.50/$0.15/$7.50 unified pricing) & Helix (3.5 Flash Lite pricing), shared Gemini pool
|
||||||
const dynHydrogenMap = new Map([
|
const dynHydrogenMap = new Map([
|
||||||
['MODEL_PLACEHOLDER_M480', { modelId: '', label: 'Gemini 4 Hydrogen (High)' }],
|
['MODEL_PLACEHOLDER_M480', { modelId: '', label: 'Gemini 4 Hydrogen (High)' }],
|
||||||
['MODEL_PLACEHOLDER_M481', { modelId: '', label: 'Gemini 4 Hydrogen (Low)' }],
|
['MODEL_PLACEHOLDER_M481', { modelId: '', label: 'Gemini 4 Hydrogen (Low)' }],
|
||||||
@@ -81,18 +81,19 @@ test('BUG-01 & INCON-01: Google-proxied Claude/GPT/o-series never misclassify as
|
|||||||
assert.equal(hydroHigh.shortName, 'hydrogen-4-high');
|
assert.equal(hydroHigh.shortName, 'hydrogen-4-high');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
{ i: hydroHigh.pricing?.input, c: hydroHigh.pricing?.cache, o: hydroHigh.pricing?.output },
|
{ i: hydroHigh.pricing?.input, c: hydroHigh.pricing?.cache, o: hydroHigh.pricing?.output },
|
||||||
{ i: 0.75, c: 0.075, o: 3.75 }
|
{ i: 1.5, c: 0.15, o: 7.5 }
|
||||||
);
|
);
|
||||||
const hydroLow = h.resolveModelInfo('MODEL_PLACEHOLDER_M481', dynHydrogenMap);
|
const hydroLow = h.resolveModelInfo('MODEL_PLACEHOLDER_M481', dynHydrogenMap);
|
||||||
assert.equal(hydroLow.shortName, 'hydrogen-4-low');
|
assert.equal(hydroLow.shortName, 'hydrogen-4-low');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
{ i: hydroLow.pricing?.input, c: hydroLow.pricing?.cache, o: hydroLow.pricing?.output },
|
{ i: hydroLow.pricing?.input, c: hydroLow.pricing?.cache, o: hydroLow.pricing?.output },
|
||||||
{ i: 0.3, c: 0.03, o: 2.5 }
|
{ i: 1.5, c: 0.15, o: 7.5 }
|
||||||
);
|
);
|
||||||
const hydroCodename = h.resolveModelInfo('gemini-hydrogen');
|
const hydroCodename = h.resolveModelInfo('gemini-hydrogen');
|
||||||
assert.equal(hydroCodename.family, 'Gemini');
|
assert.equal(hydroCodename.family, 'Gemini');
|
||||||
assert.equal(hydroCodename.label, 'Gemini Hydrogen');
|
assert.equal(hydroCodename.label, 'Gemini Hydrogen');
|
||||||
assert.equal(hydroCodename.pricing?.input, 0.75);
|
assert.equal(hydroCodename.pricing?.input, 1.5);
|
||||||
|
assert.equal(hydroCodename.pricing?.output, 7.5);
|
||||||
|
|
||||||
const helixInfo = h.resolveModelInfo('MODEL_PLACEHOLDER_M482', dynHydrogenMap);
|
const helixInfo = h.resolveModelInfo('MODEL_PLACEHOLDER_M482', dynHydrogenMap);
|
||||||
assert.equal(helixInfo.family, 'Gemini');
|
assert.equal(helixInfo.family, 'Gemini');
|
||||||
|
|||||||
@@ -144,6 +144,6 @@ export function backendHarness({
|
|||||||
return {ok:true,json:async()=>data};
|
return {ok:true,json:async()=>data};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
vm.runInNewContext(source+'\n globalThis.api={buildTelemetryPayloadInternal,computeStepCost,resolveModelInfo,inferFamilyFromProviderOrKey,isCarbonModelIdentifier,PLACEHOLDER_MAP,normalizeQuotaFraction,classifyOfficialBucketWindow,classifyQuotaPoolIdentity,buildOfficialQuotaPools,resolveTimeWindow,sanitizeCatalogPayload,rebuildActiveCatalog,syncCloudCatalog,getCloudStatus,isValidSemver,compareSemver,performPluginUpdate,resolveMigratedGitRemoteUrl,loadSettings,executeSettingsAction};',ctx);
|
vm.runInNewContext(source+'\n globalThis.api={buildTelemetryPayloadInternal,computeStepCost,resolveModelInfo,inferFamilyFromProviderOrKey,isArgonModelIdentifier,isCarbonModelIdentifier,getBaseModelLabel,formatUpstreamModelId,PLACEHOLDER_MAP,normalizeQuotaFraction,classifyOfficialBucketWindow,classifyQuotaPoolIdentity,buildOfficialQuotaPools,resolveTimeWindow,sanitizeCatalogPayload,rebuildActiveCatalog,syncCloudCatalog,getCloudStatus,isValidSemver,compareSemver,performPluginUpdate,resolveMigratedGitRemoteUrl,loadSettings,executeSettingsAction};',ctx);
|
||||||
return {...ctx.api,state};
|
return {...ctx.api,state};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import vm from 'node:vm';
|
import vm from 'node:vm';
|
||||||
import { extractModelSteps, normalizeCachedStep, MODEL_IDENTITY_VERSION } from '../speed-metrics.mjs';
|
import { extractModelSteps, normalizeCachedStep, MODEL_IDENTITY_VERSION } from '../speed-metrics.mjs';
|
||||||
import { formatUsd } from '../src/core/formatters.js';
|
import { formatUsd, resolveModelDisplayInfo } from '../src/core/formatters.js';
|
||||||
import { backendHarness } from './backend-harness.mjs';
|
import { backendHarness } from './backend-harness.mjs';
|
||||||
|
|
||||||
const FLASH = 'MODEL_PLACEHOLDER_M318', ARGON = 'MODEL_PLACEHOLDER_M418';
|
const FLASH = 'MODEL_PLACEHOLDER_M318', ARGON = 'MODEL_PLACEHOLDER_M418';
|
||||||
@@ -195,3 +195,290 @@ test('frontend considers a model-only correction a real telemetry update', () =>
|
|||||||
const b=structuredClone(a); b.activeConversation.recentSteps[0].modelShort='new-model';
|
const b=structuredClone(a); b.activeConversation.recentSteps[0].modelShort='new-model';
|
||||||
assert.equal(ctx.compare(a,b),false); assert.equal(ctx.compare(a,structuredClone(a)),true);
|
assert.equal(ctx.compare(a,b),false); assert.equal(ctx.compare(a,structuredClone(a)),true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const ORCH_CARBON = 'MODEL_PLACEHOLDER_M667';
|
||||||
|
const ORCH_ARGON = 'MODEL_PLACEHOLDER_M681';
|
||||||
|
const ORCH_EXEC_HYDROGEN = 'MODEL_PLACEHOLDER_M669';
|
||||||
|
|
||||||
|
test('Orchestrator (Carbon) direct/planning and inferred compaction steps resolve to orch-carbon and annotate upstream ID', async () => {
|
||||||
|
const rows = [step(1, ORCH_CARBON), step(2, undefined, true), step(3, ORCH_CARBON)];
|
||||||
|
const raw = {
|
||||||
|
trajectory: {
|
||||||
|
steps: rows,
|
||||||
|
generatorMetadata: [
|
||||||
|
{
|
||||||
|
stepIndices: [1],
|
||||||
|
chatModel: {
|
||||||
|
model: ORCH_CARBON,
|
||||||
|
responseModel: 'gemini-pro-orchestrator',
|
||||||
|
modelDisplayName: 'Orchestrator (Carbon)',
|
||||||
|
},
|
||||||
|
plannerConfig: {
|
||||||
|
planModel: ORCH_CARBON,
|
||||||
|
modelName: 'gemini-pro-orchestrator',
|
||||||
|
planExecuteConfig: { executionModel: ORCH_EXEC_HYDROGEN },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stepIndices: [3],
|
||||||
|
chatModel: {
|
||||||
|
model: ORCH_CARBON,
|
||||||
|
responseModel: 'gemini-pro-orchestrator',
|
||||||
|
modelDisplayName: 'Orchestrator (Carbon)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const p = await payload(rows, { trajectories: { test: raw } });
|
||||||
|
const s1 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 1);
|
||||||
|
const cp = p.activeConversation.recentSteps.find((s) => s.stepIndex === 2);
|
||||||
|
|
||||||
|
assert.equal(s1.modelShort, 'orch-carbon');
|
||||||
|
assert.equal(s1.modelUpstream, 'gemini-pro-orchestrator (carbon-4)');
|
||||||
|
assert.equal(s1.costUsd, 0.0129);
|
||||||
|
assert.equal(cp.modelKey, ORCH_CARBON);
|
||||||
|
assert.equal(cp.modelSource, 'inferred_compaction');
|
||||||
|
assert.equal(cp.modelShort, 'orch-carbon·压缩');
|
||||||
|
assert.equal(cp.modelUpstream, 'gemini-pro-orchestrator (carbon-4)·压缩');
|
||||||
|
assert.equal(p.activeConversation.activeModelShort, 'orch-carbon');
|
||||||
|
assert.equal(p.activeConversation.activeModelUpstream, 'gemini-pro-orchestrator (carbon-4)');
|
||||||
|
assert.equal(p.consumption.account.unpricedCalls, 0);
|
||||||
|
assert.equal(p.modelBreakdown.length, 1);
|
||||||
|
assert.equal(p.modelBreakdown[0].label, 'Orchestrator (Carbon)');
|
||||||
|
assert.equal(p.modelBreakdown[0].upstreamName, 'gemini-pro-orchestrator (carbon-4)');
|
||||||
|
assert.equal(p.modelBreakdown[0].calls, 3);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Orchestrator (Argon) resolves to orch-argon, annotates upstream ID, and is not misclassified as Carbon', async () => {
|
||||||
|
const h = backendHarness({
|
||||||
|
summaries: { test: { stepCount: 1 } },
|
||||||
|
trajectories: {
|
||||||
|
test: {
|
||||||
|
trajectory: {
|
||||||
|
steps: [step(1, ORCH_ARGON)],
|
||||||
|
generatorMetadata: [
|
||||||
|
{
|
||||||
|
stepIndices: [1],
|
||||||
|
chatModel: {
|
||||||
|
model: ORCH_ARGON,
|
||||||
|
responseModel: 'gemini-pro-orchestrator-argon',
|
||||||
|
modelDisplayName: 'Orchestrator (Argon)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const p = await h.buildTelemetryPayloadInternal('test');
|
||||||
|
const s1 = p.activeConversation.recentSteps[0];
|
||||||
|
assert.equal(s1.modelShort, 'orch-argon');
|
||||||
|
assert.equal(s1.modelUpstream, 'gemini-pro-orchestrator-argon (argon-4)');
|
||||||
|
assert.equal(s1.costUsd, 0.0129);
|
||||||
|
assert.equal(p.modelBreakdown[0].label, 'Orchestrator (Argon)');
|
||||||
|
assert.equal(p.modelBreakdown[0].upstreamName, 'gemini-pro-orchestrator-argon (argon-4)');
|
||||||
|
assert.equal(h.isArgonModelIdentifier(ORCH_ARGON, 'gemini-pro-orchestrator-argon', 'Orchestrator (Argon)'), true);
|
||||||
|
assert.equal(h.isCarbonModelIdentifier(ORCH_ARGON, 'gemini-pro-orchestrator-argon', 'Orchestrator (Argon)'), false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('real-world M669 worker steps (responseModel gemini-flash-worker-agy, displayName Gemini Flash) and uncatalogued executionModel resolve to Hydrogen', async () => {
|
||||||
|
const FUTURE_EXEC_PH = 'MODEL_PLACEHOLDER_M799';
|
||||||
|
const rows = [step(1, ORCH_CARBON), step(2, ORCH_EXEC_HYDROGEN), step(3, FUTURE_EXEC_PH)];
|
||||||
|
const raw = {
|
||||||
|
trajectory: {
|
||||||
|
steps: rows,
|
||||||
|
generatorMetadata: [
|
||||||
|
{
|
||||||
|
stepIndices: [1],
|
||||||
|
chatModel: {
|
||||||
|
model: ORCH_CARBON,
|
||||||
|
responseModel: 'gemini-pro-orchestrator',
|
||||||
|
modelDisplayName: 'Orchestrator (Carbon)',
|
||||||
|
},
|
||||||
|
plannerConfig: {
|
||||||
|
planModel: ORCH_CARBON,
|
||||||
|
modelName: 'gemini-pro-orchestrator',
|
||||||
|
planExecuteConfig: { executionModel: FUTURE_EXEC_PH },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stepIndices: [2],
|
||||||
|
chatModel: {
|
||||||
|
model: ORCH_EXEC_HYDROGEN,
|
||||||
|
responseModel: 'gemini-flash-worker-agy',
|
||||||
|
modelDisplayName: 'Gemini Flash',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stepIndices: [3],
|
||||||
|
chatModel: {
|
||||||
|
model: FUTURE_EXEC_PH,
|
||||||
|
responseModel: 'gemini-flash-worker-agy',
|
||||||
|
modelDisplayName: 'Gemini Flash',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const p = await payload(rows, { trajectories: { test: raw } });
|
||||||
|
const s1 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 1);
|
||||||
|
const s2 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 2);
|
||||||
|
const s3 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 3);
|
||||||
|
|
||||||
|
assert.equal(s1.modelShort, 'orch-carbon');
|
||||||
|
assert.equal(s1.modelUpstream, 'gemini-pro-orchestrator (carbon-4)');
|
||||||
|
assert.equal(s1.costUsd, 0.0129);
|
||||||
|
|
||||||
|
assert.equal(s2.modelShort, 'hydrogen-4');
|
||||||
|
assert.equal(s2.modelLabel, 'Orchestrator Worker (Hydrogen)');
|
||||||
|
assert.equal(s2.modelUpstream, 'gemini-flash-worker-agy (hydrogen-4)');
|
||||||
|
assert.equal(s2.costUsd, 0.0103);
|
||||||
|
|
||||||
|
assert.equal(s3.modelShort, 'hydrogen-4');
|
||||||
|
assert.equal(s3.modelLabel, 'Orchestrator Worker (Hydrogen)');
|
||||||
|
assert.equal(s3.modelUpstream, 'gemini-flash-worker-agy (hydrogen-4)');
|
||||||
|
assert.equal(s3.costUsd, 0.0103);
|
||||||
|
|
||||||
|
assert.equal(p.consumption.account.unpricedCalls, 0);
|
||||||
|
const orchRow = p.modelBreakdown.find((m) => m.label === 'Orchestrator (Carbon)');
|
||||||
|
const hydroRow = p.modelBreakdown.find((m) => m.label === 'Orchestrator Worker (Hydrogen)');
|
||||||
|
assert.ok(orchRow && hydroRow, 'modelBreakdown keeps orchestrator planning separate from Hydrogen worker');
|
||||||
|
assert.equal(p.modelBreakdown.some((m) => m.label === 'Gemini Flash'), false);
|
||||||
|
assert.equal(orchRow.calls, 1);
|
||||||
|
assert.equal(hydroRow.calls, 2);
|
||||||
|
assert.equal(hydroRow.upstreamName, 'gemini-flash-worker-agy (hydrogen-4)');
|
||||||
|
|
||||||
|
// Also verify already-cached M669 worker steps carrying vague "Gemini Flash" or transitional "Gemini 4 Hydrogen" resolve cleanly
|
||||||
|
const cachedStep = {
|
||||||
|
...extractModelSteps([step(10, ORCH_EXEC_HYDROGEN)])[0],
|
||||||
|
responseModel: 'gemini-flash-worker-agy',
|
||||||
|
modelDisplayName: 'Gemini Flash',
|
||||||
|
};
|
||||||
|
const cachedTransitionalDirect = {
|
||||||
|
...extractModelSteps([step(11, 'MODEL_PLACEHOLDER_M528')])[0],
|
||||||
|
modelDisplayName: 'Gemini 4 Hydrogen (XHigh)',
|
||||||
|
};
|
||||||
|
const hCached = backendHarness({
|
||||||
|
cache: { test: { signature: 'v13-clean:2:', steps: [cachedStep, cachedTransitionalDirect] } },
|
||||||
|
trajectories: { test: new Error('offline') },
|
||||||
|
});
|
||||||
|
const pCached = await hCached.buildTelemetryPayloadInternal('test');
|
||||||
|
assert.equal(pCached.activeConversation.activeModelShort, 'hydrogen-4-xhigh');
|
||||||
|
assert.equal(
|
||||||
|
pCached.modelBreakdown.find((m) => m.label === 'Orchestrator Worker (Hydrogen)')?.upstreamName,
|
||||||
|
'gemini-flash-worker-agy (hydrogen-4)'
|
||||||
|
);
|
||||||
|
assert.ok(
|
||||||
|
pCached.modelBreakdown.find((m) => m.label === 'Gemini 4 Hydrogen'),
|
||||||
|
'direct Gemini 4 Hydrogen remains in its own breakdown bucket separate from worker-agy'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('new Carbon (M427/M437/M438) and Hydrogen XHigh/High/Medium/Low (M525-M528) placeholders resolve and group cleanly', () => {
|
||||||
|
const { resolveModelInfo, getBaseModelLabel } = backendHarness();
|
||||||
|
|
||||||
|
assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M427').shortName, 'carbon-4-high');
|
||||||
|
assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M437').shortName, 'carbon-4');
|
||||||
|
assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M438').shortName, 'carbon-4-low');
|
||||||
|
|
||||||
|
const xhigh = resolveModelInfo('MODEL_PLACEHOLDER_M528');
|
||||||
|
assert.equal(xhigh.shortName, 'hydrogen-4-xhigh');
|
||||||
|
assert.equal(xhigh.baseLabel, 'Gemini 4 Hydrogen');
|
||||||
|
assert.equal(xhigh.pricing.input, 1.5);
|
||||||
|
assert.equal(xhigh.pricing.cache, 0.15);
|
||||||
|
assert.equal(xhigh.pricing.output, 7.5);
|
||||||
|
assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M525').shortName, 'hydrogen-4-high');
|
||||||
|
assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M526').shortName, 'hydrogen-4');
|
||||||
|
assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M527').shortName, 'hydrogen-4-low');
|
||||||
|
assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M527').pricing.input, 1.5);
|
||||||
|
assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M527').pricing.output, 7.5);
|
||||||
|
|
||||||
|
assert.equal(getBaseModelLabel('Orchestrator (Carbon)'), 'Orchestrator (Carbon)');
|
||||||
|
assert.equal(getBaseModelLabel('Orchestrator (Argon)'), 'Orchestrator (Argon)');
|
||||||
|
assert.equal(getBaseModelLabel('Orchestrator Worker (Hydrogen)'), 'Orchestrator Worker (Hydrogen)');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('orchestratorIdMode defaults to compact, persists via settings action, and controls Orchestrator series independently of showUpstreamModel', () => {
|
||||||
|
const h = backendHarness();
|
||||||
|
assert.equal(h.loadSettings().orchestratorIdMode, 'compact');
|
||||||
|
|
||||||
|
const resFull = h.executeSettingsAction({ orchestratorIdMode: 'full' });
|
||||||
|
assert.equal(resFull.ok, true);
|
||||||
|
assert.equal(resFull.updated.orchestratorIdMode, 'full');
|
||||||
|
|
||||||
|
const resInvalid = h.executeSettingsAction({ orchestratorIdMode: 'unexpected' });
|
||||||
|
assert.equal(resInvalid.updated.orchestratorIdMode, 'compact');
|
||||||
|
|
||||||
|
const orchCarbon = {
|
||||||
|
modelKey: ORCH_CARBON,
|
||||||
|
modelShort: 'orch-carbon',
|
||||||
|
modelLabel: 'Orchestrator (Carbon)',
|
||||||
|
modelUpstream: 'gemini-pro-orchestrator (carbon-4)',
|
||||||
|
responseModel: 'gemini-pro-orchestrator',
|
||||||
|
};
|
||||||
|
const orchArgon = {
|
||||||
|
modelKey: ORCH_ARGON,
|
||||||
|
modelShort: 'orch-argon',
|
||||||
|
modelLabel: 'Orchestrator (Argon)',
|
||||||
|
modelUpstream: 'gemini-pro-orchestrator-argon (argon-4)',
|
||||||
|
responseModel: 'gemini-pro-orchestrator-argon',
|
||||||
|
};
|
||||||
|
const orchWorkerCompaction = {
|
||||||
|
modelKey: ORCH_EXEC_HYDROGEN,
|
||||||
|
modelShort: 'hydrogen-4·压缩',
|
||||||
|
modelLabel: 'Orchestrator Worker (Hydrogen) [自动压缩]',
|
||||||
|
modelUpstream: 'gemini-flash-worker-agy (hydrogen-4)·压缩',
|
||||||
|
responseModel: 'gemini-flash-worker-agy',
|
||||||
|
isCompactionStep: true,
|
||||||
|
};
|
||||||
|
const directHydrogen = {
|
||||||
|
modelKey: 'MODEL_PLACEHOLDER_M528',
|
||||||
|
modelShort: 'hydrogen-4-xhigh',
|
||||||
|
modelLabel: 'Gemini 4 Hydrogen (XHigh)',
|
||||||
|
modelUpstream: 'gemini-4-hydrogen-xhigh',
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const showUpstreamModel of [false, true]) {
|
||||||
|
assert.equal(
|
||||||
|
resolveModelDisplayInfo(orchCarbon, { showUpstreamModel, orchestratorIdMode: 'compact' }).text,
|
||||||
|
'orchestrator-carbon'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
resolveModelDisplayInfo(orchArgon, { showUpstreamModel, orchestratorIdMode: 'compact' }).text,
|
||||||
|
'orchestrator-argon'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
resolveModelDisplayInfo(orchWorkerCompaction, { showUpstreamModel, orchestratorIdMode: 'compact' }).text,
|
||||||
|
'worker-agy-hydrogen·压缩'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
resolveModelDisplayInfo(orchCarbon, { showUpstreamModel, orchestratorIdMode: 'full' }).text,
|
||||||
|
'gemini-pro-orchestrator (carbon-4)'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
resolveModelDisplayInfo(orchArgon, { showUpstreamModel, orchestratorIdMode: 'full' }).text,
|
||||||
|
'gemini-pro-orchestrator-argon (argon-4)'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
resolveModelDisplayInfo(orchWorkerCompaction, { showUpstreamModel, orchestratorIdMode: 'full' }).text,
|
||||||
|
'gemini-flash-worker-agy (hydrogen-4)·压缩'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Non-Orchestrator direct Hydrogen still follows showUpstreamModel regardless of orchestratorIdMode
|
||||||
|
assert.equal(
|
||||||
|
resolveModelDisplayInfo(directHydrogen, { showUpstreamModel: false, orchestratorIdMode: 'compact' }).text,
|
||||||
|
'hydrogen-4-xhigh'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
resolveModelDisplayInfo(directHydrogen, { showUpstreamModel: true, orchestratorIdMode: 'compact' }).text,
|
||||||
|
'gemini-4-hydrogen-xhigh'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
resolveModelDisplayInfo(directHydrogen, { showUpstreamModel: false, orchestratorIdMode: 'full' }, { preferLabelInShort: true }).text,
|
||||||
|
'Gemini 4 Hydrogen (XHigh)'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|||||||
@@ -395,3 +395,91 @@ test('switching accounts within 10s immediately invalidates quotaSummaryCache',
|
|||||||
);
|
);
|
||||||
assert.equal(second.quotas.pools[0].weeklyRemainingPct, 8.7);
|
assert.equal(second.quotas.pools[0].weeklyRemainingPct, 8.7);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Orchestrator quota pool binding follows active phase: Carbon/Argon while planning, Gemini when offloaded to Hydrogen', async () => {
|
||||||
|
const ORCH_CARBON = 'MODEL_PLACEHOLDER_M667';
|
||||||
|
const ORCH_ARGON = 'MODEL_PLACEHOLDER_M681';
|
||||||
|
const ORCH_EXEC_HYDROGEN = 'MODEL_PLACEHOLDER_M669';
|
||||||
|
const geminiReset = new Date(Date.now() + 24 * 3600_000).toISOString();
|
||||||
|
const argonReset = new Date(Date.now() + 48 * 3600_000).toISOString();
|
||||||
|
const carbonReset = new Date(Date.now() + 72 * 3600_000).toISOString();
|
||||||
|
const fiveHourReset = new Date(Date.now() + 2 * 3600_000).toISOString();
|
||||||
|
|
||||||
|
const h = backendHarness({
|
||||||
|
summaries: {
|
||||||
|
orchCarbonPlan: { stepCount: 1 },
|
||||||
|
orchArgonPlan: { stepCount: 1 },
|
||||||
|
orchHydrogenExec: { stepCount: 2 },
|
||||||
|
},
|
||||||
|
trajectories: {
|
||||||
|
orchCarbonPlan: { trajectory: { steps: [makeStep(1, ORCH_CARBON)] } },
|
||||||
|
orchArgonPlan: { trajectory: { steps: [makeStep(1, ORCH_ARGON)] } },
|
||||||
|
orchHydrogenExec: {
|
||||||
|
trajectory: { steps: [makeStep(1, ORCH_CARBON), makeStep(2, ORCH_EXEC_HYDROGEN)] },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
userStatus: {
|
||||||
|
userTier: { id: 'g1-pro-tier', name: 'Google AI Pro' },
|
||||||
|
cascadeModelConfigData: {
|
||||||
|
clientModelConfigs: [
|
||||||
|
{
|
||||||
|
label: 'Orchestrator (Carbon)',
|
||||||
|
modelId: 'gemini-pro-orchestrator',
|
||||||
|
modelOrAlias: { model: ORCH_CARBON },
|
||||||
|
quotaInfo: { remainingFraction: 0.4, resetTime: carbonReset },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Orchestrator (Argon)',
|
||||||
|
modelId: 'gemini-pro-orchestrator-argon',
|
||||||
|
modelOrAlias: { model: ORCH_ARGON },
|
||||||
|
quotaInfo: { remainingFraction: 0.6, resetTime: argonReset },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Gemini 3.8 Flash (High)',
|
||||||
|
modelId: 'gemini-3.8-flash-high',
|
||||||
|
modelOrAlias: { model: FLASH },
|
||||||
|
quotaInfo: { remainingFraction: 0.9, resetTime: geminiReset },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
quotaSummary: {
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
displayName: 'Gemini Models',
|
||||||
|
buckets: [
|
||||||
|
{ bucketId: 'gemini-5h', window: '5h', remainingFraction: 0.95, resetTime: fiveHourReset },
|
||||||
|
{ bucketId: 'gemini-weekly', window: 'weekly', remainingFraction: 0.9, resetTime: geminiReset },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Gemini 4 Argon',
|
||||||
|
buckets: [
|
||||||
|
{ bucketId: 'argon-weekly', window: 'weekly', remainingFraction: 0.6, resetTime: argonReset },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Gemini 4 Carbon',
|
||||||
|
buckets: [
|
||||||
|
{ bucketId: 'carbon-weekly', window: 'weekly', remainingFraction: 0.4, resetTime: carbonReset },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const pCarbon = await h.buildTelemetryPayloadInternal('orchCarbonPlan');
|
||||||
|
assert.equal(pCarbon.quotas.activePool.family, 'Carbon');
|
||||||
|
assert.equal(pCarbon.quotas.weekly.poolFamily, 'Carbon');
|
||||||
|
assert.equal(pCarbon.quotas.weekly.remainingPct, 40);
|
||||||
|
|
||||||
|
const pArgon = await h.buildTelemetryPayloadInternal('orchArgonPlan');
|
||||||
|
assert.equal(pArgon.quotas.activePool.family, 'Argon');
|
||||||
|
assert.equal(pArgon.quotas.weekly.poolFamily, 'Argon');
|
||||||
|
assert.equal(pArgon.quotas.weekly.remainingPct, 60);
|
||||||
|
|
||||||
|
const pExec = await h.buildTelemetryPayloadInternal('orchHydrogenExec');
|
||||||
|
assert.equal(pExec.quotas.activePool.family, 'Gemini');
|
||||||
|
assert.equal(pExec.quotas.weekly.poolFamily, 'Gemini');
|
||||||
|
assert.equal(pExec.quotas.weekly.remainingPct, 90);
|
||||||
|
});
|
||||||
|
|||||||
@@ -654,6 +654,7 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
weeklyTokenBudget: 150000000,
|
weeklyTokenBudget: 150000000,
|
||||||
weeklyCostBudget: 100,
|
weeklyCostBudget: 100,
|
||||||
showUpstreamModel: false,
|
showUpstreamModel: false,
|
||||||
|
orchestratorIdMode: 'compact',
|
||||||
autoUpdatePlugin: false,
|
autoUpdatePlugin: false,
|
||||||
enableWindowOverlay: true,
|
enableWindowOverlay: true,
|
||||||
showTopbarMultiSession: true,
|
showTopbarMultiSession: true,
|
||||||
@@ -1023,14 +1024,15 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
const settingsSelects = settingsPane.querySelectorAll('.custom-select');
|
const settingsSelects = settingsPane.querySelectorAll('.custom-select');
|
||||||
assert.equal(
|
assert.equal(
|
||||||
settingsSelects.length,
|
settingsSelects.length,
|
||||||
6,
|
7,
|
||||||
'SettingsView renders 6 CustomSelect controls (mount, modelFormat, 3 topbar slots, autoUpdate)'
|
'SettingsView renders 7 CustomSelect controls (mount, modelFormat, orchestratorIdFormat, 3 topbar slots, autoUpdate)'
|
||||||
);
|
);
|
||||||
const mountSelectEl = settingsSelects[0];
|
const mountSelectEl = settingsSelects[0];
|
||||||
const modelFormatSelectEl = settingsSelects[1];
|
const modelFormatSelectEl = settingsSelects[1];
|
||||||
const slot0SelectEl = settingsSelects[2];
|
const orchestratorIdSelectEl = settingsSelects[2];
|
||||||
const slot1SelectEl = settingsSelects[3];
|
const slot0SelectEl = settingsSelects[3];
|
||||||
const slot2SelectEl = settingsSelects[4];
|
const slot1SelectEl = settingsSelects[4];
|
||||||
|
const slot2SelectEl = settingsSelects[5];
|
||||||
|
|
||||||
// Toggle windowMountSelect: dual -> sidebar -> dual
|
// Toggle windowMountSelect: dual -> sidebar -> dual
|
||||||
assert.ok(mountSelectEl.querySelector('.select-label').textContent.includes('顶部栏 + 侧边栏'));
|
assert.ok(mountSelectEl.querySelector('.select-label').textContent.includes('顶部栏 + 侧边栏'));
|
||||||
@@ -1060,6 +1062,20 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
assert.equal(mockSettings.showUpstreamModel, false);
|
assert.equal(mockSettings.showUpstreamModel, false);
|
||||||
assert.ok(modelFormatSelectEl.querySelector('.select-label').textContent.includes('精简代号'));
|
assert.ok(modelFormatSelectEl.querySelector('.select-label').textContent.includes('精简代号'));
|
||||||
|
|
||||||
|
// Toggle orchestratorIdSelect: compact -> full -> compact
|
||||||
|
assert.ok(orchestratorIdSelectEl.querySelector('.select-label').textContent.includes('精简代号'));
|
||||||
|
orchestratorIdSelectEl.querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
orchestratorIdSelectEl.querySelectorAll('.select-option')[1].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 30));
|
||||||
|
assert.equal(mockSettings.orchestratorIdMode, 'full');
|
||||||
|
assert.ok(orchestratorIdSelectEl.querySelector('.select-label').textContent.includes('原始完整 ID'));
|
||||||
|
|
||||||
|
orchestratorIdSelectEl.querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
orchestratorIdSelectEl.querySelectorAll('.select-option')[0].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 30));
|
||||||
|
assert.equal(mockSettings.orchestratorIdMode, 'compact');
|
||||||
|
assert.ok(orchestratorIdSelectEl.querySelector('.select-label').textContent.includes('精简代号'));
|
||||||
|
|
||||||
// Toggle topbar multi-session switch: show -> hide -> show
|
// Toggle topbar multi-session switch: show -> hide -> show
|
||||||
const topbarSegBtns = settingsPane.querySelectorAll('.seg-btn');
|
const topbarSegBtns = settingsPane.querySelectorAll('.seg-btn');
|
||||||
assert.equal(topbarSegBtns.length, 2, 'Topbar multi-session toggle has 显示 / 隐藏 buttons');
|
assert.equal(topbarSegBtns.length, 2, 'Topbar multi-session toggle has 显示 / 隐藏 buttons');
|
||||||
@@ -1165,7 +1181,7 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
);
|
);
|
||||||
assert.equal(headerUpdateBtn.hasAttribute('hidden'), false);
|
assert.equal(headerUpdateBtn.hasAttribute('hidden'), false);
|
||||||
|
|
||||||
const updateModeSelectEl = settingsSelects[5];
|
const updateModeSelectEl = settingsSelects[6];
|
||||||
assert.equal(updateModeSelectEl.querySelector('.select-label').textContent, '仅提示新版本,手动更新');
|
assert.equal(updateModeSelectEl.querySelector('.select-label').textContent, '仅提示新版本,手动更新');
|
||||||
updateModeSelectEl.querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
|
updateModeSelectEl.querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
const updateOpts = updateModeSelectEl.querySelectorAll('.select-option');
|
const updateOpts = updateModeSelectEl.querySelectorAll('.select-option');
|
||||||
|
|||||||
Reference in New Issue
Block a user