mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
feat(panel): support upstream responseModel display and infer compaction step model & pricing
This commit is contained in:
+95
-12
@@ -751,6 +751,10 @@ function isEquivalentTelemetry(prev, next) {
|
||||
|
||||
const pAct = prev.activeConversation;
|
||||
const nAct = next.activeConversation;
|
||||
if (prev.settings?.showUpstreamModel !== next.settings?.showUpstreamModel) return false;
|
||||
if (prev.settings?.weeklyLimitMode !== next.settings?.weeklyLimitMode) return false;
|
||||
if (prev.settings?.weeklyTokenBudget !== next.settings?.weeklyTokenBudget) return false;
|
||||
if (prev.settings?.weeklyCostBudget !== next.settings?.weeklyCostBudget) return false;
|
||||
if (pAct?.cascadeId !== nAct?.cascadeId) return false;
|
||||
if (pAct?.stepCount !== nAct?.stepCount) return false;
|
||||
if (pAct?.isRunning !== nAct?.isRunning) return false;
|
||||
@@ -771,6 +775,7 @@ function isEquivalentTelemetry(prev, next) {
|
||||
for (let i = 0; i < (pAct?.recentSteps?.length || 0); i++) {
|
||||
const before = pAct.recentSteps[i], after = nAct.recentSteps[i];
|
||||
if (before.modelKey !== after.modelKey || before.modelShort !== after.modelShort ||
|
||||
before.modelUpstream !== after.modelUpstream || before.responseModel !== after.responseModel ||
|
||||
before.modelSource !== after.modelSource || before.costUsd !== after.costUsd) return false;
|
||||
}
|
||||
|
||||
@@ -810,6 +815,7 @@ function isEquivalentTelemetry(prev, next) {
|
||||
if (
|
||||
pModels[i]?.label !== nModels[i]?.label ||
|
||||
pModels[i]?.shortName !== nModels[i]?.shortName ||
|
||||
pModels[i]?.upstreamName !== nModels[i]?.upstreamName ||
|
||||
pModels[i]?.costUsd !== nModels[i]?.costUsd ||
|
||||
pModels[i]?.unpricedCalls !== nModels[i]?.unpricedCalls ||
|
||||
pModels[i]?.totalTokens !== nModels[i]?.totalTokens ||
|
||||
@@ -3261,6 +3267,7 @@ const StepsDetailView = defineComponent({
|
||||
if (!slice) return;
|
||||
const steps = slice.recentSteps || [];
|
||||
const models = slice.modelBreakdown || [];
|
||||
const showUpstream = Boolean(slice.showUpstreamModel);
|
||||
|
||||
subTabSwitch.setProps({
|
||||
options: [
|
||||
@@ -3272,13 +3279,15 @@ const StepsDetailView = defineComponent({
|
||||
patchKeyedList(stepsTbody, steps, {
|
||||
keyFn: (st) => `${slice.cascadeId || 'conv'}-${st.stepIndex}`,
|
||||
sigFn: (st) =>
|
||||
`${st.stepIndex}:${st.modelShort}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}`,
|
||||
`${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}`,
|
||||
createRow: () => {
|
||||
const stepNumText = h('span');
|
||||
const compIcon = createSvgIcon('bolt', { size: 11, className: 'text-muted' });
|
||||
const tdStep = h('td', {}, [stepNumText, compIcon]);
|
||||
|
||||
const tdModel = h('td');
|
||||
const tdModel = h('td', {
|
||||
style: 'max-width: 140px; overflow: hidden; text-overflow: ellipsis;',
|
||||
});
|
||||
const speedMain = h('strong', {
|
||||
className: 'cell-value accent-speed',
|
||||
style: 'font-size: 11px;',
|
||||
@@ -3313,7 +3322,12 @@ const StepsDetailView = defineComponent({
|
||||
updateRow: (refs, st) => {
|
||||
patchText(refs.stepNumText, `#${Number(st.stepIndex)} `);
|
||||
patchAttr(refs.compIcon, 'hidden', !st.isCompactionStep);
|
||||
patchText(refs.tdModel, st.modelShort || '—');
|
||||
const modelText =
|
||||
(showUpstream ? st.modelUpstream || st.responseModel : st.modelShort) ||
|
||||
st.modelShort ||
|
||||
'—';
|
||||
patchText(refs.tdModel, modelText);
|
||||
patchAttr(refs.tdModel, 'title', modelText);
|
||||
|
||||
patchText(refs.speedMain, formatMetric(st.tokPerSec, ' tok/s'));
|
||||
const reason = speedReasonText(st.selectedSpeedReason);
|
||||
@@ -3336,9 +3350,11 @@ const StepsDetailView = defineComponent({
|
||||
patchKeyedList(modelsTbody, models, {
|
||||
keyFn: (m) => m.label || m.shortName,
|
||||
sigFn: (m) =>
|
||||
`${m.shortName}:${m.calls}:${m.avgTokPerSec}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.speedSummary?.sampleCount}`,
|
||||
`${showUpstream ? m.upstreamName || m.shortName : m.shortName}:${m.calls}:${m.avgTokPerSec}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.speedSummary?.sampleCount}`,
|
||||
createRow: () => {
|
||||
const tdName = h('td', { style: 'font-weight: 600;' });
|
||||
const tdName = h('td', {
|
||||
style: 'font-weight: 600; max-width: 165px; overflow: hidden; text-overflow: ellipsis;',
|
||||
});
|
||||
const tdCalls = h('td');
|
||||
const speedMain = h('div');
|
||||
const speedSub = h('div', { className: 'text-muted', style: 'font-size: 9.5px;' });
|
||||
@@ -3352,7 +3368,15 @@ const StepsDetailView = defineComponent({
|
||||
};
|
||||
},
|
||||
updateRow: (refs, m) => {
|
||||
patchText(refs.tdName, m.shortName || m.label);
|
||||
const nameText = showUpstream
|
||||
? m.upstreamName || m.shortName || m.label
|
||||
: m.shortName || m.label;
|
||||
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.speedMain, formatMetric(m.avgTokPerSec, ' tok/s'));
|
||||
patchText(refs.speedSub, `有效 ${sampleSummary(m.speedSummary)}`);
|
||||
@@ -3371,6 +3395,7 @@ const StepsDetailView = defineComponent({
|
||||
recentSteps: st.telemetry?.activeConversation?.recentSteps,
|
||||
modelBreakdown: st.telemetry?.modelBreakdown,
|
||||
rangeLabel: st.telemetry?.consumption?.selectedRange?.label || '全部时间',
|
||||
showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel),
|
||||
}),
|
||||
(slice) => {
|
||||
latestSlice = slice;
|
||||
@@ -3425,12 +3450,36 @@ const WEEKLY_MODE_OPTIONS = [
|
||||
{ value: 'custom_cost', label: '按自定义每周美元 ($) 预算计算百分比' },
|
||||
];
|
||||
|
||||
const STEP_MODEL_DISPLAY_OPTIONS = [
|
||||
{ value: 'short', label: '本地简称 (如 argon-4-high / flash-3.8-high)' },
|
||||
{ value: 'upstream', label: '上游真实模型名 (如 gemini-4-argon / gemini-3.8-flash-n)' },
|
||||
];
|
||||
|
||||
const SettingsView = defineComponent({
|
||||
name: 'SettingsView',
|
||||
setup({ onCleanup }) {
|
||||
let draftMode = 'official';
|
||||
let draftTokens = 150000000;
|
||||
let draftCost = 100;
|
||||
let draftShowUpstreamModel = false;
|
||||
let statusTimer = null;
|
||||
let lastSyncedSettingsSig = '';
|
||||
|
||||
const saveStatusText = h('span', { className: 'text-muted', style: 'font-size: 11px;', text: '' });
|
||||
|
||||
function showSaveFeedback(text) {
|
||||
if (statusTimer) {
|
||||
clearTimeout(statusTimer);
|
||||
statusTimer = null;
|
||||
}
|
||||
patchText(saveStatusText, text);
|
||||
if (text === '设置已生效') {
|
||||
statusTimer = setTimeout(() => {
|
||||
statusTimer = null;
|
||||
patchText(saveStatusText, '');
|
||||
}, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
const modeSelect = CustomSelect({
|
||||
modelValue: draftMode,
|
||||
@@ -3441,6 +3490,26 @@ const SettingsView = defineComponent({
|
||||
},
|
||||
});
|
||||
|
||||
const stepModelSelect = CustomSelect({
|
||||
modelValue: 'short',
|
||||
icon: 'table',
|
||||
options: STEP_MODEL_DISPLAY_OPTIONS,
|
||||
onUpdateModelValue: async (val) => {
|
||||
draftShowUpstreamModel = val === 'upstream';
|
||||
if (latestSettings) {
|
||||
lastSyncedSettingsSig = settingsSig({
|
||||
...latestSettings,
|
||||
showUpstreamModel: draftShowUpstreamModel,
|
||||
});
|
||||
}
|
||||
showSaveFeedback('正在异步保存...');
|
||||
await saveSettingsPatch({
|
||||
showUpstreamModel: draftShowUpstreamModel,
|
||||
});
|
||||
showSaveFeedback('设置已生效');
|
||||
},
|
||||
});
|
||||
|
||||
const tokenBudgetInput = CustomNumberInput({
|
||||
modelValue: draftTokens,
|
||||
min: 100000,
|
||||
@@ -3461,22 +3530,20 @@ const SettingsView = defineComponent({
|
||||
},
|
||||
});
|
||||
|
||||
const saveStatusText = h('span', { className: 'text-muted', style: 'font-size: 11px;', text: '' });
|
||||
|
||||
const saveBtn = h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
className: 'btn-primary',
|
||||
onClick: async () => {
|
||||
patchText(saveStatusText, '正在异步保存...');
|
||||
showSaveFeedback('正在异步保存...');
|
||||
await saveSettingsPatch({
|
||||
weeklyLimitMode: draftMode,
|
||||
weeklyTokenBudget: draftTokens,
|
||||
weeklyCostBudget: draftCost,
|
||||
showUpstreamModel: draftShowUpstreamModel,
|
||||
});
|
||||
patchText(saveStatusText, '设置已生效');
|
||||
setTimeout(() => patchText(saveStatusText, ''), 1500);
|
||||
showSaveFeedback('设置已生效');
|
||||
},
|
||||
},
|
||||
[createSvgIcon('check', { size: 13 }), h('span', { text: '保存参数设置' })]
|
||||
@@ -3490,6 +3557,10 @@ const SettingsView = defineComponent({
|
||||
]),
|
||||
saveStatusText,
|
||||
]),
|
||||
h('div', { className: 'form-row' }, [
|
||||
h('span', { className: 'form-label', text: '步骤明细模型名称显示' }),
|
||||
stepModelSelect.el,
|
||||
]),
|
||||
h('div', { className: 'form-row' }, [
|
||||
h('span', { className: 'form-label', text: '每周进度条统计维度' }),
|
||||
modeSelect.el,
|
||||
@@ -3512,8 +3583,16 @@ const SettingsView = defineComponent({
|
||||
let latestSettings = null;
|
||||
let isDirty = false;
|
||||
|
||||
function settingsSig(s) {
|
||||
if (!s) return '';
|
||||
return `${s.weeklyLimitMode}:${s.weeklyTokenBudget}:${s.weeklyCostBudget}:${Boolean(s.showUpstreamModel)}`;
|
||||
}
|
||||
|
||||
function renderSettings(settings) {
|
||||
if (!settings) return;
|
||||
const nextSig = settingsSig(settings);
|
||||
if (nextSig === lastSyncedSettingsSig) return;
|
||||
lastSyncedSettingsSig = nextSig;
|
||||
draftMode =
|
||||
settings.weeklyLimitMode === 'custom_tokens' ||
|
||||
settings.weeklyLimitMode === 'custom_cost'
|
||||
@@ -3521,7 +3600,9 @@ const SettingsView = defineComponent({
|
||||
: 'official';
|
||||
draftTokens = Number(settings.weeklyTokenBudget || 150000000);
|
||||
draftCost = Number(settings.weeklyCostBudget || 100);
|
||||
draftShowUpstreamModel = Boolean(settings.showUpstreamModel);
|
||||
modeSelect.setValue(draftMode);
|
||||
stepModelSelect.setValue(draftShowUpstreamModel ? 'upstream' : 'short');
|
||||
tokenBudgetInput.setValue(draftTokens);
|
||||
costBudgetInput.setValue(draftCost);
|
||||
}
|
||||
@@ -3552,16 +3633,18 @@ const SettingsView = defineComponent({
|
||||
);
|
||||
|
||||
onCleanup(() => {
|
||||
if (statusTimer) clearTimeout(statusTimer);
|
||||
unsub();
|
||||
unsubView();
|
||||
modeSelect.destroy();
|
||||
stepModelSelect.destroy();
|
||||
tokenBudgetInput.destroy();
|
||||
costBudgetInput.destroy();
|
||||
});
|
||||
|
||||
return {
|
||||
el: rootEl,
|
||||
refs: { modeSelect, tokenBudgetInput, costBudgetInput },
|
||||
refs: { modeSelect, stepModelSelect, tokenBudgetInput, costBudgetInput },
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>测速与额度监控</title>
|
||||
<link rel="stylesheet" href="/styles.css?v=1792146383111">
|
||||
<link rel="stylesheet" href="/styles.css?v=1792927120596">
|
||||
<script src="/preload.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app-root"></div>
|
||||
<script src="/app.js?v=1792146383111"></script>
|
||||
<script src="/app.js?v=1792927120596"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+64
-14
@@ -4,7 +4,7 @@ import { homedir } from 'node:os';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { Response, SidecarApp } from 'sidecar_sdk';
|
||||
import { extractModelSteps, parseIsoMs, normalizeCachedStep, speedMetric, summarizeSpeed, summarizeTtft, createSpeedAccumulator, accumulateSpeed, finishSpeed } from './speed-metrics.mjs';
|
||||
import { extractModelSteps, inferCompactionStepModels, parseIsoMs, normalizeCachedStep, speedMetric, summarizeSpeed, summarizeTtft, createSpeedAccumulator, accumulateSpeed, finishSpeed } from './speed-metrics.mjs';
|
||||
import { StreamDiagnostics } from './stream-diagnostics.mjs';
|
||||
|
||||
const HERE = dirname(fileURLToPath(import.meta.url));
|
||||
@@ -26,6 +26,7 @@ const DEFAULT_SETTINGS = {
|
||||
weeklyTokenBudget: 150000000, // 150M tokens default custom weekly target
|
||||
weeklyCostBudget: 100, // Default user-configurable local cost target
|
||||
weeklyLimitMode: 'official', // 'official' | 'custom_tokens' | 'custom_cost'
|
||||
showUpstreamModel: false, // Replace step model short names with upstream responseModel
|
||||
};
|
||||
|
||||
// Local API price catalog in USD per 1M tokens (Input, CacheRead, Output).
|
||||
@@ -118,7 +119,7 @@ const PLACEHOLDER_MAP = {
|
||||
const CACHE_SCHEMA_VERSION = 'v10-model-identity';
|
||||
const loadedTrajectoryCache = loadJson(CACHE_FILE, {});
|
||||
let trajectoryCache = Object.fromEntries(Object.entries(loadedTrajectoryCache).map(([id, entry]) => [
|
||||
id, { ...entry, steps: (entry.steps || []).map(normalizeCachedStep) },
|
||||
id, { ...entry, steps: inferCompactionStepModels((entry.steps || []).map(normalizeCachedStep)) },
|
||||
]));
|
||||
let cacheNeedsSave = JSON.stringify(trajectoryCache) !== JSON.stringify(loadedTrajectoryCache);
|
||||
let externalDeepStatsMemo = { sig: '', convos: new Map() };
|
||||
@@ -803,20 +804,21 @@ async function buildTelemetryPayloadInternal(
|
||||
if (!cached || conv.needsInitialLoad) return true;
|
||||
const hasCurrentSchema = String(cached.signature || '').startsWith(`${CACHE_SCHEMA_VERSION}:`);
|
||||
if (!hasCurrentSchema) return true;
|
||||
const lastCachedStep = cached.steps?.[cached.steps.length - 1];
|
||||
const missingBreakdownField =
|
||||
Boolean(lastCachedStep) &&
|
||||
(!Object.prototype.hasOwnProperty.call(lastCachedStep, 'contextBreakdown') ||
|
||||
cached.steps.some((s) => !Object.prototype.hasOwnProperty.call(s, 'responseModel')));
|
||||
if (missingBreakdownField) return true;
|
||||
if (!conv.inSummaries) {
|
||||
return conv.diskMtimeMs > 0 && conv.diskMtimeMs > (cached.diskMtimeMs || cached.lastModifiedMs || 0);
|
||||
}
|
||||
const sig = `${CACHE_SCHEMA_VERSION}:${conv.stepCount}:${conv.lastModifiedTime}`;
|
||||
const isRunning = conv.status === 'CASCADE_RUN_STATUS_RUNNING';
|
||||
const lastCachedStep = cached.steps?.[cached.steps.length - 1];
|
||||
const missingBreakdownField =
|
||||
Boolean(lastCachedStep) &&
|
||||
!Object.prototype.hasOwnProperty.call(lastCachedStep, 'contextBreakdown');
|
||||
return (
|
||||
cached.signature !== sig ||
|
||||
isRunning ||
|
||||
Boolean(cached.wasRunning) ||
|
||||
missingBreakdownField
|
||||
Boolean(cached.wasRunning)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -886,6 +888,22 @@ async function buildTelemetryPayloadInternal(
|
||||
let sessionInputTokens = 0;
|
||||
let sessionCacheReadTokens = 0;
|
||||
|
||||
// Map known modelKey -> latest observed upstream responseModel so in-flight steps
|
||||
// whose generatorMetadata has not arrived yet do not flicker to local catalog modelIds
|
||||
const knownUpstreamByModelKey = new Map();
|
||||
for (const entry of Object.values(trajectoryCache)) {
|
||||
for (const s of entry?.steps || []) {
|
||||
if (s?.modelKey && s.modelKey !== 'unknown' && s.responseModel) {
|
||||
knownUpstreamByModelKey.set(s.modelKey, s.responseModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const s of activeSteps) {
|
||||
if (s?.modelKey && s.modelKey !== 'unknown' && s.responseModel) {
|
||||
knownUpstreamByModelKey.set(s.modelKey, s.responseModel);
|
||||
}
|
||||
}
|
||||
|
||||
const enrichedActiveSteps = activeSteps.map((st) => {
|
||||
const mInfo = resolveModelInfo(st.modelKey, dynamicModelMap, st.apiProvider, st.modelDisplayName);
|
||||
const costUsd = computeStepCost(st, mInfo.pricing);
|
||||
@@ -903,9 +921,18 @@ async function buildTelemetryPayloadInternal(
|
||||
const inCostUsd = mInfo.pricing ? (st.inputTokens / 1_000_000) * mInfo.pricing.input : null;
|
||||
const cacheCostUsd = mInfo.pricing ? (st.cacheReadTokens / 1_000_000) * mInfo.pricing.cache : null;
|
||||
const outCostUsd = mInfo.pricing ? (st.outputTokens / 1_000_000) * mInfo.pricing.output : null;
|
||||
const resolvedResponseModel =
|
||||
st.responseModel ||
|
||||
(st.modelKey && st.modelKey !== 'unknown' ? knownUpstreamByModelKey.get(st.modelKey) || '' : '');
|
||||
const rawUpstreamModel =
|
||||
resolvedResponseModel ||
|
||||
(mInfo.modelId && mInfo.modelId !== 'unknown' ? mInfo.modelId : mInfo.shortName);
|
||||
const modelUpstream = st.isCompactionStep ? `${rawUpstreamModel}·压缩` : rawUpstreamModel;
|
||||
|
||||
return {
|
||||
...st,
|
||||
responseModel: st.responseModel || '',
|
||||
modelUpstream,
|
||||
modelLabel: st.isCompactionStep ? `${mInfo.label} [自动压缩]` : mInfo.label,
|
||||
modelShort: st.isCompactionStep ? `${mInfo.shortName}·压缩` : mInfo.shortName,
|
||||
family: mInfo.family,
|
||||
@@ -1159,6 +1186,8 @@ async function buildTelemetryPayloadInternal(
|
||||
perModelStats.set(modelGroupKey, {
|
||||
label: modelGroupKey,
|
||||
shortName: mInfo.shortName,
|
||||
fallbackModelId: mInfo.modelId && mInfo.modelId !== 'unknown' ? mInfo.modelId : '',
|
||||
upstreamModelCounts: new Map(),
|
||||
family: mInfo.family,
|
||||
calls: 0,
|
||||
inputTokens: 0,
|
||||
@@ -1172,6 +1201,12 @@ async function buildTelemetryPayloadInternal(
|
||||
});
|
||||
}
|
||||
const agg = perModelStats.get(modelGroupKey);
|
||||
if (st.responseModel) {
|
||||
agg.upstreamModelCounts.set(
|
||||
st.responseModel,
|
||||
(agg.upstreamModelCounts.get(st.responseModel) || 0) + 1
|
||||
);
|
||||
}
|
||||
accumulateSpeed(agg.speedAccumulator, st);
|
||||
|
||||
agg.calls += 1;
|
||||
@@ -1421,12 +1456,23 @@ async function buildTelemetryPayloadInternal(
|
||||
},
|
||||
modelBreakdown: Array.from(perModelStats.values())
|
||||
.sort((a, b) => b.calls - a.calls || String(a.label).localeCompare(String(b.label)))
|
||||
.map(({ speedAccumulator, ...m }) => ({
|
||||
...m,
|
||||
costUsd: +m.costUsd.toFixed(3),
|
||||
avgTokPerSec: roundMetric(finishSpeed(speedAccumulator).avgTokPerSec),
|
||||
speedSummary: finishSpeed(speedAccumulator),
|
||||
})),
|
||||
.map(({ speedAccumulator, upstreamModelCounts, fallbackModelId, ...m }) => {
|
||||
const sortedUpstream = Array.from((upstreamModelCounts || new Map()).entries())
|
||||
.sort((a, b) => b[1] - a[1])
|
||||
.map(([name]) => name);
|
||||
const primaryUpstream =
|
||||
sortedUpstream.length > 0
|
||||
? sortedUpstream[0]
|
||||
: fallbackModelId || m.shortName || m.label;
|
||||
return {
|
||||
...m,
|
||||
upstreamName: primaryUpstream,
|
||||
upstreamModels: sortedUpstream,
|
||||
costUsd: +m.costUsd.toFixed(3),
|
||||
avgTokPerSec: roundMetric(finishSpeed(speedAccumulator).avgTokPerSec),
|
||||
speedSummary: finishSpeed(speedAccumulator),
|
||||
};
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1543,6 +1589,10 @@ app.api('/api/settings', (data, req) => {
|
||||
weeklyTokenBudget: Number(data.weeklyTokenBudget || current.weeklyTokenBudget),
|
||||
weeklyCostBudget: Number(data.weeklyCostBudget || current.weeklyCostBudget),
|
||||
weeklyLimitMode: data.weeklyLimitMode || current.weeklyLimitMode,
|
||||
showUpstreamModel:
|
||||
typeof data.showUpstreamModel === 'boolean'
|
||||
? data.showUpstreamModel
|
||||
: Boolean(current.showUpstreamModel),
|
||||
};
|
||||
saveJson(SETTINGS_FILE, updated);
|
||||
return updated;
|
||||
|
||||
@@ -268,20 +268,25 @@ export function extractModelSteps(rawSteps = [], generatorMetadata = []) {
|
||||
const speedReason = timingReason || (isCompactionStep ? 'compaction' : shortOutputSample ? 'short_sample' : null);
|
||||
const context = chat?.chatStartMetadata?.contextWindowMetadata;
|
||||
const contextBreakdown = extractContextBreakdown(chat);
|
||||
// Only use model evidence belonging to this request. A checkpoint can use
|
||||
// a different model from its neighbouring planner steps (or omit it).
|
||||
// Only use model evidence belonging to this request first. If a checkpoint
|
||||
// omits model metadata, inferCompactionStepModels will fall back to the
|
||||
// nearest explicit step in the same trajectory with a compatible provider.
|
||||
const isValidModelValue = (value) =>
|
||||
typeof value === 'string' && value.trim() &&
|
||||
!/^(?:0|unknown|MODEL_(?:UNSPECIFIED|UNKNOWN))$/i.test(value.trim());
|
||||
const modelCandidates = [
|
||||
['usage.model', u.model], ['chat.usage.model', chat?.usage?.model],
|
||||
['chat.model', chat?.model], ['metadata.generatorModel', m.generatorModel],
|
||||
['chat.responseModel', chat?.responseModel],
|
||||
];
|
||||
const identity = modelCandidates.find(([, value]) =>
|
||||
typeof value === 'string' && value.trim() &&
|
||||
!/^(?:0|unknown|MODEL_(?:UNSPECIFIED|UNKNOWN))$/i.test(value.trim()));
|
||||
const identity = modelCandidates.find(([, value]) => isValidModelValue(value));
|
||||
const rawResponseModel = [chat?.responseModel, u?.responseModel, m?.responseModel]
|
||||
.find(isValidModelValue);
|
||||
result.push({
|
||||
stepIndex, isCompactionStep,
|
||||
modelKey: identity ? identity[1].trim() : 'unknown',
|
||||
modelSource: identity?.[0] || 'unavailable',
|
||||
responseModel: rawResponseModel ? rawResponseModel.trim() : '',
|
||||
modelIdentityVersion: MODEL_IDENTITY_VERSION,
|
||||
modelDisplayName: chat?.modelDisplayName || '',
|
||||
apiProvider: u.apiProvider || chat?.usage?.apiProvider || '',
|
||||
@@ -316,7 +321,69 @@ export function extractModelSteps(rawSteps = [], generatorMetadata = []) {
|
||||
lastStep.maxContextBudgetTokens = Number(fallbackCtx.maxContextTokens);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return inferCompactionStepModels(result);
|
||||
}
|
||||
|
||||
export function inferCompactionStepModels(steps) {
|
||||
if (!Array.isArray(steps) || steps.length < 2) return steps;
|
||||
const isExplicitDonor = (step) =>
|
||||
Boolean(
|
||||
step &&
|
||||
step.modelKey &&
|
||||
step.modelKey !== 'unknown' &&
|
||||
step.modelSource !== 'inferred_compaction' &&
|
||||
step.modelSource !== 'legacy_unverified'
|
||||
);
|
||||
const isProviderCompatible = (target, donor) =>
|
||||
!target.apiProvider || !donor.apiProvider || target.apiProvider === donor.apiProvider;
|
||||
|
||||
return steps.map((step, idx) => {
|
||||
if (!step?.isCompactionStep) return step;
|
||||
const needsModel = !step.modelKey || step.modelKey === 'unknown';
|
||||
const needsUpstream = step.modelSource === 'inferred_compaction' && !step.responseModel;
|
||||
if (!needsModel && !needsUpstream) return step;
|
||||
|
||||
let donor = null;
|
||||
for (let j = idx - 1; j >= 0; j--) {
|
||||
if (isExplicitDonor(steps[j]) && isProviderCompatible(step, steps[j])) {
|
||||
donor = steps[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!donor) {
|
||||
for (let j = idx + 1; j < steps.length; j++) {
|
||||
if (isExplicitDonor(steps[j]) && isProviderCompatible(step, steps[j])) {
|
||||
donor = steps[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!donor) {
|
||||
for (let j = idx - 1; j >= 0; j--) {
|
||||
if (isExplicitDonor(steps[j])) {
|
||||
donor = steps[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!donor) {
|
||||
for (let j = idx + 1; j < steps.length; j++) {
|
||||
if (isExplicitDonor(steps[j])) {
|
||||
donor = steps[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!donor) return step;
|
||||
|
||||
return {
|
||||
...step,
|
||||
modelKey: needsModel ? donor.modelKey : step.modelKey,
|
||||
modelSource: needsModel ? 'inferred_compaction' : step.modelSource,
|
||||
responseModel: step.responseModel || donor.responseModel || '',
|
||||
modelDisplayName: step.modelDisplayName || donor.modelDisplayName || '',
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export function normalizeCachedStep(step) {
|
||||
|
||||
@@ -29,6 +29,10 @@ function isEquivalentTelemetry(prev, next) {
|
||||
|
||||
const pAct = prev.activeConversation;
|
||||
const nAct = next.activeConversation;
|
||||
if (prev.settings?.showUpstreamModel !== next.settings?.showUpstreamModel) return false;
|
||||
if (prev.settings?.weeklyLimitMode !== next.settings?.weeklyLimitMode) return false;
|
||||
if (prev.settings?.weeklyTokenBudget !== next.settings?.weeklyTokenBudget) return false;
|
||||
if (prev.settings?.weeklyCostBudget !== next.settings?.weeklyCostBudget) return false;
|
||||
if (pAct?.cascadeId !== nAct?.cascadeId) return false;
|
||||
if (pAct?.stepCount !== nAct?.stepCount) return false;
|
||||
if (pAct?.isRunning !== nAct?.isRunning) return false;
|
||||
@@ -49,6 +53,7 @@ function isEquivalentTelemetry(prev, next) {
|
||||
for (let i = 0; i < (pAct?.recentSteps?.length || 0); i++) {
|
||||
const before = pAct.recentSteps[i], after = nAct.recentSteps[i];
|
||||
if (before.modelKey !== after.modelKey || before.modelShort !== after.modelShort ||
|
||||
before.modelUpstream !== after.modelUpstream || before.responseModel !== after.responseModel ||
|
||||
before.modelSource !== after.modelSource || before.costUsd !== after.costUsd) return false;
|
||||
}
|
||||
|
||||
@@ -88,6 +93,7 @@ function isEquivalentTelemetry(prev, next) {
|
||||
if (
|
||||
pModels[i]?.label !== nModels[i]?.label ||
|
||||
pModels[i]?.shortName !== nModels[i]?.shortName ||
|
||||
pModels[i]?.upstreamName !== nModels[i]?.upstreamName ||
|
||||
pModels[i]?.costUsd !== nModels[i]?.costUsd ||
|
||||
pModels[i]?.unpricedCalls !== nModels[i]?.unpricedCalls ||
|
||||
pModels[i]?.totalTokens !== nModels[i]?.totalTokens ||
|
||||
|
||||
@@ -21,12 +21,36 @@ const WEEKLY_MODE_OPTIONS = [
|
||||
{ value: 'custom_cost', label: '按自定义每周美元 ($) 预算计算百分比' },
|
||||
];
|
||||
|
||||
const STEP_MODEL_DISPLAY_OPTIONS = [
|
||||
{ value: 'short', label: '本地简称 (如 argon-4-high / flash-3.8-high)' },
|
||||
{ value: 'upstream', label: '上游真实模型名 (如 gemini-4-argon / gemini-3.8-flash-n)' },
|
||||
];
|
||||
|
||||
export const SettingsView = defineComponent({
|
||||
name: 'SettingsView',
|
||||
setup({ onCleanup }) {
|
||||
let draftMode = 'official';
|
||||
let draftTokens = 150000000;
|
||||
let draftCost = 100;
|
||||
let draftShowUpstreamModel = false;
|
||||
let statusTimer = null;
|
||||
let lastSyncedSettingsSig = '';
|
||||
|
||||
const saveStatusText = h('span', { className: 'text-muted', style: 'font-size: 11px;', text: '' });
|
||||
|
||||
function showSaveFeedback(text) {
|
||||
if (statusTimer) {
|
||||
clearTimeout(statusTimer);
|
||||
statusTimer = null;
|
||||
}
|
||||
patchText(saveStatusText, text);
|
||||
if (text === '设置已生效') {
|
||||
statusTimer = setTimeout(() => {
|
||||
statusTimer = null;
|
||||
patchText(saveStatusText, '');
|
||||
}, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
const modeSelect = CustomSelect({
|
||||
modelValue: draftMode,
|
||||
@@ -37,6 +61,26 @@ export const SettingsView = defineComponent({
|
||||
},
|
||||
});
|
||||
|
||||
const stepModelSelect = CustomSelect({
|
||||
modelValue: 'short',
|
||||
icon: 'table',
|
||||
options: STEP_MODEL_DISPLAY_OPTIONS,
|
||||
onUpdateModelValue: async (val) => {
|
||||
draftShowUpstreamModel = val === 'upstream';
|
||||
if (latestSettings) {
|
||||
lastSyncedSettingsSig = settingsSig({
|
||||
...latestSettings,
|
||||
showUpstreamModel: draftShowUpstreamModel,
|
||||
});
|
||||
}
|
||||
showSaveFeedback('正在异步保存...');
|
||||
await saveSettingsPatch({
|
||||
showUpstreamModel: draftShowUpstreamModel,
|
||||
});
|
||||
showSaveFeedback('设置已生效');
|
||||
},
|
||||
});
|
||||
|
||||
const tokenBudgetInput = CustomNumberInput({
|
||||
modelValue: draftTokens,
|
||||
min: 100000,
|
||||
@@ -57,22 +101,20 @@ export const SettingsView = defineComponent({
|
||||
},
|
||||
});
|
||||
|
||||
const saveStatusText = h('span', { className: 'text-muted', style: 'font-size: 11px;', text: '' });
|
||||
|
||||
const saveBtn = h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
className: 'btn-primary',
|
||||
onClick: async () => {
|
||||
patchText(saveStatusText, '正在异步保存...');
|
||||
showSaveFeedback('正在异步保存...');
|
||||
await saveSettingsPatch({
|
||||
weeklyLimitMode: draftMode,
|
||||
weeklyTokenBudget: draftTokens,
|
||||
weeklyCostBudget: draftCost,
|
||||
showUpstreamModel: draftShowUpstreamModel,
|
||||
});
|
||||
patchText(saveStatusText, '设置已生效');
|
||||
setTimeout(() => patchText(saveStatusText, ''), 1500);
|
||||
showSaveFeedback('设置已生效');
|
||||
},
|
||||
},
|
||||
[createSvgIcon('check', { size: 13 }), h('span', { text: '保存参数设置' })]
|
||||
@@ -86,6 +128,10 @@ export const SettingsView = defineComponent({
|
||||
]),
|
||||
saveStatusText,
|
||||
]),
|
||||
h('div', { className: 'form-row' }, [
|
||||
h('span', { className: 'form-label', text: '步骤明细模型名称显示' }),
|
||||
stepModelSelect.el,
|
||||
]),
|
||||
h('div', { className: 'form-row' }, [
|
||||
h('span', { className: 'form-label', text: '每周进度条统计维度' }),
|
||||
modeSelect.el,
|
||||
@@ -108,8 +154,16 @@ export const SettingsView = defineComponent({
|
||||
let latestSettings = null;
|
||||
let isDirty = false;
|
||||
|
||||
function settingsSig(s) {
|
||||
if (!s) return '';
|
||||
return `${s.weeklyLimitMode}:${s.weeklyTokenBudget}:${s.weeklyCostBudget}:${Boolean(s.showUpstreamModel)}`;
|
||||
}
|
||||
|
||||
function renderSettings(settings) {
|
||||
if (!settings) return;
|
||||
const nextSig = settingsSig(settings);
|
||||
if (nextSig === lastSyncedSettingsSig) return;
|
||||
lastSyncedSettingsSig = nextSig;
|
||||
draftMode =
|
||||
settings.weeklyLimitMode === 'custom_tokens' ||
|
||||
settings.weeklyLimitMode === 'custom_cost'
|
||||
@@ -117,7 +171,9 @@ export const SettingsView = defineComponent({
|
||||
: 'official';
|
||||
draftTokens = Number(settings.weeklyTokenBudget || 150000000);
|
||||
draftCost = Number(settings.weeklyCostBudget || 100);
|
||||
draftShowUpstreamModel = Boolean(settings.showUpstreamModel);
|
||||
modeSelect.setValue(draftMode);
|
||||
stepModelSelect.setValue(draftShowUpstreamModel ? 'upstream' : 'short');
|
||||
tokenBudgetInput.setValue(draftTokens);
|
||||
costBudgetInput.setValue(draftCost);
|
||||
}
|
||||
@@ -148,16 +204,18 @@ export const SettingsView = defineComponent({
|
||||
);
|
||||
|
||||
onCleanup(() => {
|
||||
if (statusTimer) clearTimeout(statusTimer);
|
||||
unsub();
|
||||
unsubView();
|
||||
modeSelect.destroy();
|
||||
stepModelSelect.destroy();
|
||||
tokenBudgetInput.destroy();
|
||||
costBudgetInput.destroy();
|
||||
});
|
||||
|
||||
return {
|
||||
el: rootEl,
|
||||
refs: { modeSelect, tokenBudgetInput, costBudgetInput },
|
||||
refs: { modeSelect, stepModelSelect, tokenBudgetInput, costBudgetInput },
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -123,6 +123,7 @@ export const StepsDetailView = defineComponent({
|
||||
if (!slice) return;
|
||||
const steps = slice.recentSteps || [];
|
||||
const models = slice.modelBreakdown || [];
|
||||
const showUpstream = Boolean(slice.showUpstreamModel);
|
||||
|
||||
subTabSwitch.setProps({
|
||||
options: [
|
||||
@@ -134,13 +135,15 @@ export const StepsDetailView = defineComponent({
|
||||
patchKeyedList(stepsTbody, steps, {
|
||||
keyFn: (st) => `${slice.cascadeId || 'conv'}-${st.stepIndex}`,
|
||||
sigFn: (st) =>
|
||||
`${st.stepIndex}:${st.modelShort}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}`,
|
||||
`${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}`,
|
||||
createRow: () => {
|
||||
const stepNumText = h('span');
|
||||
const compIcon = createSvgIcon('bolt', { size: 11, className: 'text-muted' });
|
||||
const tdStep = h('td', {}, [stepNumText, compIcon]);
|
||||
|
||||
const tdModel = h('td');
|
||||
const tdModel = h('td', {
|
||||
style: 'max-width: 140px; overflow: hidden; text-overflow: ellipsis;',
|
||||
});
|
||||
const speedMain = h('strong', {
|
||||
className: 'cell-value accent-speed',
|
||||
style: 'font-size: 11px;',
|
||||
@@ -175,7 +178,12 @@ export const StepsDetailView = defineComponent({
|
||||
updateRow: (refs, st) => {
|
||||
patchText(refs.stepNumText, `#${Number(st.stepIndex)} `);
|
||||
patchAttr(refs.compIcon, 'hidden', !st.isCompactionStep);
|
||||
patchText(refs.tdModel, st.modelShort || '—');
|
||||
const modelText =
|
||||
(showUpstream ? st.modelUpstream || st.responseModel : st.modelShort) ||
|
||||
st.modelShort ||
|
||||
'—';
|
||||
patchText(refs.tdModel, modelText);
|
||||
patchAttr(refs.tdModel, 'title', modelText);
|
||||
|
||||
patchText(refs.speedMain, formatMetric(st.tokPerSec, ' tok/s'));
|
||||
const reason = speedReasonText(st.selectedSpeedReason);
|
||||
@@ -198,9 +206,11 @@ export const StepsDetailView = defineComponent({
|
||||
patchKeyedList(modelsTbody, models, {
|
||||
keyFn: (m) => m.label || m.shortName,
|
||||
sigFn: (m) =>
|
||||
`${m.shortName}:${m.calls}:${m.avgTokPerSec}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.speedSummary?.sampleCount}`,
|
||||
`${showUpstream ? m.upstreamName || m.shortName : m.shortName}:${m.calls}:${m.avgTokPerSec}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.speedSummary?.sampleCount}`,
|
||||
createRow: () => {
|
||||
const tdName = h('td', { style: 'font-weight: 600;' });
|
||||
const tdName = h('td', {
|
||||
style: 'font-weight: 600; max-width: 165px; overflow: hidden; text-overflow: ellipsis;',
|
||||
});
|
||||
const tdCalls = h('td');
|
||||
const speedMain = h('div');
|
||||
const speedSub = h('div', { className: 'text-muted', style: 'font-size: 9.5px;' });
|
||||
@@ -214,7 +224,15 @@ export const StepsDetailView = defineComponent({
|
||||
};
|
||||
},
|
||||
updateRow: (refs, m) => {
|
||||
patchText(refs.tdName, m.shortName || m.label);
|
||||
const nameText = showUpstream
|
||||
? m.upstreamName || m.shortName || m.label
|
||||
: m.shortName || m.label;
|
||||
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.speedMain, formatMetric(m.avgTokPerSec, ' tok/s'));
|
||||
patchText(refs.speedSub, `有效 ${sampleSummary(m.speedSummary)}`);
|
||||
@@ -233,6 +251,7 @@ export const StepsDetailView = defineComponent({
|
||||
recentSteps: st.telemetry?.activeConversation?.recentSteps,
|
||||
modelBreakdown: st.telemetry?.modelBreakdown,
|
||||
rangeLabel: st.telemetry?.consumption?.selectedRange?.label || '全部时间',
|
||||
showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel),
|
||||
}),
|
||||
(slice) => {
|
||||
latestSlice = slice;
|
||||
|
||||
@@ -22,19 +22,46 @@ async function payload(steps, options = {}) {
|
||||
trajectories: { test: { trajectory: { steps } } }, ...options }).buildTelemetryPayloadInternal('test');
|
||||
}
|
||||
|
||||
test('missing checkpoint identity stays unknown between Flash steps; its token totals survive', async () => {
|
||||
test('missing checkpoint identity infers model and pricing from neighbouring steps', async () => {
|
||||
const rows = [step(209, FLASH), step(211, undefined, true), step(212, FLASH)];
|
||||
const raw = {
|
||||
trajectory: {
|
||||
steps: rows,
|
||||
generatorMetadata: [
|
||||
{ stepIndices: [209], chatModel: { model: FLASH, responseModel: 'gemini-3.8-flash-n' } },
|
||||
{ stepIndices: [212], chatModel: { model: FLASH, responseModel: 'gemini-3.8-flash-n' } },
|
||||
],
|
||||
},
|
||||
};
|
||||
const p = await payload(rows, { trajectories: { test: raw } });
|
||||
const cp = p.activeConversation.recentSteps.find(s => s.stepIndex === 211);
|
||||
assert.equal(cp.modelKey, FLASH);
|
||||
assert.equal(cp.modelSource, 'inferred_compaction');
|
||||
assert.equal(cp.modelShort, 'flash-3.8-high·压缩');
|
||||
assert.equal(cp.responseModel, 'gemini-3.8-flash-n');
|
||||
assert.equal(cp.modelUpstream, 'gemini-3.8-flash-n·压缩');
|
||||
assert.equal(cp.costUsd, 0.0052);
|
||||
assert.equal(cp.inCostUsd, 0.0008);
|
||||
assert.equal(cp.contextTokens, 11000);
|
||||
assert.equal(cp.tokPerSec, 100);
|
||||
assert.equal(p.activeConversation.speedSummary.sampleCount, 2);
|
||||
assert.equal(p.consumption.account.totalTokens, 33000);
|
||||
assert.equal(p.consumption.account.unpricedCalls, 0);
|
||||
assert.equal(p.modelBreakdown.find(m => m.shortName === 'flash-3.8-high').calls, 3);
|
||||
assert(!p.modelBreakdown.some(m => /argon/i.test(m.label)));
|
||||
});
|
||||
|
||||
test('isolated checkpoint without known neighbours stays unknown; its token totals survive', async () => {
|
||||
const rows = [step(211, undefined, true)];
|
||||
const p = await payload(rows);
|
||||
const cp = p.activeConversation.recentSteps.find(s => s.stepIndex === 211);
|
||||
assert.equal(cp.modelKey, 'unknown'); assert.equal(cp.modelShort, '模型未知·压缩');
|
||||
assert.equal(cp.costUsd, null); assert.equal(cp.inCostUsd, null);
|
||||
assert.equal(cp.contextTokens, 11000); assert.equal(cp.tokPerSec, 100);
|
||||
assert.equal(p.activeConversation.speedSummary.sampleCount, 2);
|
||||
assert.equal(p.consumption.account.totalTokens, 33000);
|
||||
assert.equal(p.activeConversation.speedSummary.sampleCount, 0);
|
||||
assert.equal(p.consumption.account.totalTokens, 11000);
|
||||
assert.equal(p.consumption.account.unpricedCalls, 1);
|
||||
assert.equal(p.modelBreakdown.find(m => m.label === '模型未知').unpricedCalls, 1);
|
||||
assert.equal(p.modelBreakdown.find(m => m.shortName === 'flash-3.8-high').calls, 2);
|
||||
assert(!p.modelBreakdown.some(m => /argon/i.test(m.label)));
|
||||
assert.equal(p.consumption.trendSeries.reduce((n,s) => n+(s.unpricedCalls || 0),0), 1);
|
||||
assert.equal(p.consumption.sourcesBreakdown[0].unpricedCalls, 1);
|
||||
assert.equal(p.consumption.monthlySeries.reduce((n,s) => n+(s.unpricedCalls || 0),0), 1);
|
||||
@@ -88,6 +115,21 @@ test('response model and display name are preserved when enum model is absent',
|
||||
assert.equal(p.activeConversation.activeModelShort,'flash-3.8-high');
|
||||
});
|
||||
|
||||
test('upstream responseModel is preserved alongside placeholder modelKey for StepsDetailView', async () => {
|
||||
const row = step(211, FLASH);
|
||||
const raw = {trajectory: { steps: [row], generatorMetadata: [{stepIndices:[211],chatModel:{
|
||||
model: FLASH,
|
||||
responseModel: 'gemini-3.8-flash-n',
|
||||
}}]}};
|
||||
const p = await payload([], {trajectories: {test:raw}});
|
||||
const st = p.activeConversation.recentSteps[0];
|
||||
assert.equal(st.modelKey, FLASH);
|
||||
assert.equal(st.modelShort, 'flash-3.8-high');
|
||||
assert.equal(st.responseModel, 'gemini-3.8-flash-n');
|
||||
assert.equal(st.modelUpstream, 'gemini-3.8-flash-n');
|
||||
assert.equal(p.modelBreakdown[0].upstreamName, 'gemini-3.8-flash-n');
|
||||
});
|
||||
|
||||
test('server model catalog overrides static placeholder mapping', () => {
|
||||
const {resolveModelInfo} = backendHarness();
|
||||
const result = resolveModelInfo(ARGON, new Map([[ARGON, {modelId:'gemini-3.8-flash-high', label:'Gemini 3.8 Flash (High)'}]]));
|
||||
|
||||
Reference in New Issue
Block a user