mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
feat(panel): add conversation turn rail, prompt preview, and decoupled step toggles
- Track user input turn boundaries and prompt previews in extractModelSteps while stripping compaction summary headers - Align interleaved main and subagent steps onto unified rootTurnIndex in telemetry-builder and scope lazy cache refresh to the active session family - Render dynamic left-edge turn rail and viewport-clamped prompt tooltip in StepsDetailView across arbitrary custom column orders - Decouple [主]/[子] agent badges from step index and add independent switches for Turn Rail and Agent Badge under Preferences -> Structure Co-authored-by: Swei <sweilo@qq.com>
This commit is contained in:
+329
-21
@@ -521,10 +521,12 @@ const I18N_MESSAGES_ZH_CN = Object.freeze({
|
|||||||
'steps.modelSplitFoot': '入 {inTok} · 缓 {cacheTok} · 思 {thinkTok} · 正 {respTok}',
|
'steps.modelSplitFoot': '入 {inTok} · 缓 {cacheTok} · 思 {thinkTok} · 正 {respTok}',
|
||||||
'steps.fitActiveCardTitle': '{title}(已纳入上方趋势拟合,按住 Ctrl/Shift 点击可多选对比)',
|
'steps.fitActiveCardTitle': '{title}(已纳入上方趋势拟合,按住 Ctrl/Shift 点击可多选对比)',
|
||||||
'steps.fitInactiveCardTitle': '点击在上方拟合图查看 {text}(按住 Ctrl/Shift 点击可多选同图对比)',
|
'steps.fitInactiveCardTitle': '点击在上方拟合图查看 {text}(按住 Ctrl/Shift 点击可多选同图对比)',
|
||||||
|
'steps.turnMediaOnly': '[图片/附件提问]',
|
||||||
|
'steps.turnMediaSuffix': '[附图]',
|
||||||
|
|
||||||
// Step Table Columns (Headers & Option Labels)
|
// Step Table Columns (Headers & Option Labels)
|
||||||
'stepCol.step.th': '步序',
|
'stepCol.step.th': '步序',
|
||||||
'stepCol.step.opt': '步序与代理',
|
'stepCol.step.opt': '调用步序 (#)',
|
||||||
'stepCol.time.th': '时间',
|
'stepCol.time.th': '时间',
|
||||||
'stepCol.time.opt': '调用时间 (HH:mm:ss)',
|
'stepCol.time.opt': '调用时间 (HH:mm:ss)',
|
||||||
'stepCol.model.th': '模型',
|
'stepCol.model.th': '模型',
|
||||||
@@ -687,6 +689,8 @@ const I18N_MESSAGES_ZH_CN = Object.freeze({
|
|||||||
'settings.str.addOverviewMetric': '添加指标 ({count}/{max})',
|
'settings.str.addOverviewMetric': '添加指标 ({count}/{max})',
|
||||||
'settings.str.stepsSection': '调用明细字段',
|
'settings.str.stepsSection': '调用明细字段',
|
||||||
'settings.str.stepsBadge': '{count} 列',
|
'settings.str.stepsBadge': '{count} 列',
|
||||||
|
'settings.str.stepTurnRailToggle': '对话轮次导轨',
|
||||||
|
'settings.str.stepAgentBadgeToggle': '主/子代理标识',
|
||||||
'settings.str.stepsColsLabel': '「按步查看」显示列 (左 → 右,至少 2 列)',
|
'settings.str.stepsColsLabel': '「按步查看」显示列 (左 → 右,至少 2 列)',
|
||||||
'settings.str.addStepCol': '添加字段 ({count}/{max})',
|
'settings.str.addStepCol': '添加字段 ({count}/{max})',
|
||||||
'settings.slot.moveUp': '前移',
|
'settings.slot.moveUp': '前移',
|
||||||
@@ -995,10 +999,12 @@ const I18N_MESSAGES_EN_US = Object.freeze({
|
|||||||
'steps.modelSplitFoot': 'In {inTok} · Cache {cacheTok} · Think {thinkTok} · Out {respTok}',
|
'steps.modelSplitFoot': 'In {inTok} · Cache {cacheTok} · Think {thinkTok} · Out {respTok}',
|
||||||
'steps.fitActiveCardTitle': '{title} (Active in Trend Fit; Ctrl/Shift-click to compare)',
|
'steps.fitActiveCardTitle': '{title} (Active in Trend Fit; Ctrl/Shift-click to compare)',
|
||||||
'steps.fitInactiveCardTitle': 'Click to inspect {text} in Trend Fit (Ctrl/Shift-click to compare)',
|
'steps.fitInactiveCardTitle': 'Click to inspect {text} in Trend Fit (Ctrl/Shift-click to compare)',
|
||||||
|
'steps.turnMediaOnly': '[Media Attachment]',
|
||||||
|
'steps.turnMediaSuffix': '[Media]',
|
||||||
|
|
||||||
// Step Table Columns (Headers & Option Labels)
|
// Step Table Columns (Headers & Option Labels)
|
||||||
'stepCol.step.th': 'Step',
|
'stepCol.step.th': 'Step',
|
||||||
'stepCol.step.opt': 'Step & Agent',
|
'stepCol.step.opt': 'Step Number (#)',
|
||||||
'stepCol.time.th': 'Time',
|
'stepCol.time.th': 'Time',
|
||||||
'stepCol.time.opt': 'Timestamp (HH:mm:ss)',
|
'stepCol.time.opt': 'Timestamp (HH:mm:ss)',
|
||||||
'stepCol.model.th': 'Model',
|
'stepCol.model.th': 'Model',
|
||||||
@@ -1161,6 +1167,8 @@ const I18N_MESSAGES_EN_US = Object.freeze({
|
|||||||
'settings.str.addOverviewMetric': 'Add Metric ({count}/{max})',
|
'settings.str.addOverviewMetric': 'Add Metric ({count}/{max})',
|
||||||
'settings.str.stepsSection': 'Step Table Columns',
|
'settings.str.stepsSection': 'Step Table Columns',
|
||||||
'settings.str.stepsBadge': '{count} cols',
|
'settings.str.stepsBadge': '{count} cols',
|
||||||
|
'settings.str.stepTurnRailToggle': 'Turn Rail & Preview',
|
||||||
|
'settings.str.stepAgentBadgeToggle': 'Main/Sub Agent Badge',
|
||||||
'settings.str.stepsColsLabel': '"Steps" Visible Columns (Left → Right, min 2)',
|
'settings.str.stepsColsLabel': '"Steps" Visible Columns (Left → Right, min 2)',
|
||||||
'settings.str.addStepCol': 'Add Column ({count}/{max})',
|
'settings.str.addStepCol': 'Add Column ({count}/{max})',
|
||||||
'settings.slot.moveUp': 'Move earlier',
|
'settings.slot.moveUp': 'Move earlier',
|
||||||
@@ -2649,6 +2657,12 @@ function isEquivalentTelemetry(prev, next) {
|
|||||||
if ((pSet?.showTopbarMultiSession !== false) !== (nSet?.showTopbarMultiSession !== false)) {
|
if ((pSet?.showTopbarMultiSession !== false) !== (nSet?.showTopbarMultiSession !== false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if ((pSet?.showStepTurnRail !== false) !== (nSet?.showStepTurnRail !== false)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((pSet?.showStepAgentBadge !== false) !== (nSet?.showStepAgentBadge !== false)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!sameArr(pSet?.topbarCapsuleSlots, nSet?.topbarCapsuleSlots)) return false;
|
if (!sameArr(pSet?.topbarCapsuleSlots, nSet?.topbarCapsuleSlots)) return false;
|
||||||
if (!sameArr(pSet?.hoverModules, nSet?.hoverModules)) return false;
|
if (!sameArr(pSet?.hoverModules, nSet?.hoverModules)) return false;
|
||||||
if (!sameArr(pSet?.overviewModules, nSet?.overviewModules)) return false;
|
if (!sameArr(pSet?.overviewModules, nSet?.overviewModules)) return false;
|
||||||
@@ -2815,7 +2829,13 @@ function isEquivalentTelemetry(prev, next) {
|
|||||||
bs?.cacheReadTokens !== as?.cacheReadTokens ||
|
bs?.cacheReadTokens !== as?.cacheReadTokens ||
|
||||||
bs?.contextTokens !== as?.contextTokens ||
|
bs?.contextTokens !== as?.contextTokens ||
|
||||||
bs?.cacheHitPct !== as?.cacheHitPct ||
|
bs?.cacheHitPct !== as?.cacheHitPct ||
|
||||||
bs?.selectedSpeedReason !== as?.selectedSpeedReason
|
bs?.selectedSpeedReason !== as?.selectedSpeedReason ||
|
||||||
|
bs?.turnIndex !== as?.turnIndex ||
|
||||||
|
bs?.rootTurnIndex !== as?.rootTurnIndex ||
|
||||||
|
bs?.isTurnStart !== as?.isTurnStart ||
|
||||||
|
bs?.isRootTurnStart !== as?.isRootTurnStart ||
|
||||||
|
bs?.turnPrompt !== as?.turnPrompt ||
|
||||||
|
bs?.rootTurnPrompt !== as?.rootTurnPrompt
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2862,7 +2882,13 @@ function isEquivalentTelemetry(prev, next) {
|
|||||||
before.cacheReadTokens !== after.cacheReadTokens ||
|
before.cacheReadTokens !== after.cacheReadTokens ||
|
||||||
before.contextTokens !== after.contextTokens ||
|
before.contextTokens !== after.contextTokens ||
|
||||||
before.cacheHitPct !== after.cacheHitPct ||
|
before.cacheHitPct !== after.cacheHitPct ||
|
||||||
before.selectedSpeedReason !== after.selectedSpeedReason
|
before.selectedSpeedReason !== after.selectedSpeedReason ||
|
||||||
|
before.turnIndex !== after.turnIndex ||
|
||||||
|
before.rootTurnIndex !== after.rootTurnIndex ||
|
||||||
|
before.isTurnStart !== after.isTurnStart ||
|
||||||
|
before.isRootTurnStart !== after.isRootTurnStart ||
|
||||||
|
before.turnPrompt !== after.turnPrompt ||
|
||||||
|
before.rootTurnPrompt !== after.rootTurnPrompt
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3206,6 +3232,12 @@ async function saveSettingsPatch(patch) {
|
|||||||
if (Object.prototype.hasOwnProperty.call(safePatch, 'showTopbarMultiSession')) {
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'showTopbarMultiSession')) {
|
||||||
safePatch.showTopbarMultiSession = Boolean(safePatch.showTopbarMultiSession);
|
safePatch.showTopbarMultiSession = Boolean(safePatch.showTopbarMultiSession);
|
||||||
}
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'showStepTurnRail')) {
|
||||||
|
safePatch.showStepTurnRail = Boolean(safePatch.showStepTurnRail);
|
||||||
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'showStepAgentBadge')) {
|
||||||
|
safePatch.showStepAgentBadge = Boolean(safePatch.showStepAgentBadge);
|
||||||
|
}
|
||||||
if (Object.prototype.hasOwnProperty.call(safePatch, 'topbarCapsuleSlots')) {
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'topbarCapsuleSlots')) {
|
||||||
safePatch.topbarCapsuleSlots = normalizeClientTopbarSlots(safePatch.topbarCapsuleSlots);
|
safePatch.topbarCapsuleSlots = normalizeClientTopbarSlots(safePatch.topbarCapsuleSlots);
|
||||||
}
|
}
|
||||||
@@ -9985,7 +10017,7 @@ const STEP_COLUMN_REGISTRY = Object.freeze({
|
|||||||
thLabel: () => t('stepCol.step.th'),
|
thLabel: () => t('stepCol.step.th'),
|
||||||
optLabel: () => t('stepCol.step.opt'),
|
optLabel: () => t('stepCol.step.opt'),
|
||||||
sigPart: (st, ctx) =>
|
sigPart: (st, ctx) =>
|
||||||
`${ctx.hasSubagents}:${ctx.scopeSigKey}:${st.agentId || 'main'}:${st.stepIndex}:${st.agentBadge || ''}:${st.agentLabel || ''}`,
|
`${Boolean(ctx.showAgentBadge)}:${ctx.scopeSigKey}:${st.agentId || 'main'}:${st.stepIndex}:${st.agentBadge || ''}:${st.agentLabel || ''}`,
|
||||||
createCell: () => {
|
createCell: () => {
|
||||||
const agentBadgeEl = h('span', {
|
const agentBadgeEl = h('span', {
|
||||||
className: 'agent-badge is-clickable',
|
className: 'agent-badge is-clickable',
|
||||||
@@ -9997,9 +10029,9 @@ const STEP_COLUMN_REGISTRY = Object.freeze({
|
|||||||
return { td, refs: { agentBadgeEl, stepNumText } };
|
return { td, refs: { agentBadgeEl, stepNumText } };
|
||||||
},
|
},
|
||||||
updateCell: (refs, st, ctx) => {
|
updateCell: (refs, st, ctx) => {
|
||||||
const { hasSubagents, effectiveScopes, onSelectAgentScopes } = ctx;
|
const { showAgentBadge, effectiveScopes, onSelectAgentScopes } = ctx;
|
||||||
patchAttr(refs.agentBadgeEl, 'hidden', !hasSubagents);
|
patchAttr(refs.agentBadgeEl, 'hidden', !showAgentBadge);
|
||||||
if (hasSubagents) {
|
if (showAgentBadge) {
|
||||||
const badgeCls = getAgentBadgeClass(st.agentIndex || 0, !st.isSubagent);
|
const badgeCls = getAgentBadgeClass(st.agentIndex || 0, !st.isSubagent);
|
||||||
patchAttr(refs.agentBadgeEl, 'class', `agent-badge is-clickable ${badgeCls}`);
|
patchAttr(refs.agentBadgeEl, 'class', `agent-badge is-clickable ${badgeCls}`);
|
||||||
const badgeText = isEnglishLocale()
|
const badgeText = isEnglishLocale()
|
||||||
@@ -10039,6 +10071,8 @@ const STEP_COLUMN_REGISTRY = Object.freeze({
|
|||||||
onSelectAgentScopes(isSoleTarget ? ['all'] : [targetScope]);
|
onSelectAgentScopes(isSoleTarget ? ['all'] : [targetScope]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
refs.agentBadgeEl.onclick = null;
|
||||||
}
|
}
|
||||||
patchText(refs.stepNumText, `#${Number(st.stepIndex)}`);
|
patchText(refs.stepNumText, `#${Number(st.stepIndex)}`);
|
||||||
},
|
},
|
||||||
@@ -11278,6 +11312,8 @@ const SettingsStructureTab = defineComponent({
|
|||||||
let draftHoverModules = [...DEFAULT_CLIENT_HOVER_MODULES];
|
let draftHoverModules = [...DEFAULT_CLIENT_HOVER_MODULES];
|
||||||
let draftOverviewModules = [...DEFAULT_CLIENT_OVERVIEW_MODULES];
|
let draftOverviewModules = [...DEFAULT_CLIENT_OVERVIEW_MODULES];
|
||||||
let draftOverviewMetrics = [...DEFAULT_CLIENT_OVERVIEW_METRICS];
|
let draftOverviewMetrics = [...DEFAULT_CLIENT_OVERVIEW_METRICS];
|
||||||
|
let draftShowStepTurnRail = true;
|
||||||
|
let draftShowStepAgentBadge = true;
|
||||||
let draftStepColumns = [...DEFAULT_CLIENT_STEP_COLUMNS];
|
let draftStepColumns = [...DEFAULT_CLIENT_STEP_COLUMNS];
|
||||||
let latestSettings = null;
|
let latestSettings = null;
|
||||||
|
|
||||||
@@ -11572,12 +11608,46 @@ const SettingsStructureTab = defineComponent({
|
|||||||
overviewSection.refs.setResetDisabled(isDefault);
|
overviewSection.refs.setResetDisabled(isDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Section 4: 调用明细字段 (Step Table Columns 2..12) ---
|
// --- Section 4: 调用明细字段 (Turn Rail + Agent Badge Toggles + Step Table Columns 2..12) ---
|
||||||
|
const stepTurnRailLabelEl = h('span', {
|
||||||
|
className: 'form-label',
|
||||||
|
text: t('settings.str.stepTurnRailToggle'),
|
||||||
|
});
|
||||||
|
const stepAgentBadgeLabelEl = h('span', {
|
||||||
|
className: 'form-label',
|
||||||
|
text: t('settings.str.stepAgentBadgeToggle'),
|
||||||
|
});
|
||||||
const stepColsLabelEl = h('span', {
|
const stepColsLabelEl = h('span', {
|
||||||
className: 'form-label',
|
className: 'form-label',
|
||||||
text: t('settings.str.stepsColsLabel'),
|
text: t('settings.str.stepsColsLabel'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const stepTurnRailToggle = SegmentedControl({
|
||||||
|
ariaLabel: t('settings.str.stepTurnRailToggle'),
|
||||||
|
modelValue: 'show',
|
||||||
|
options: getMultiToggleOptions(),
|
||||||
|
onUpdateModelValue: (val) => {
|
||||||
|
draftShowStepTurnRail = val !== 'hide';
|
||||||
|
syncStepsSectionMeta();
|
||||||
|
void persistStructurePatch(stepsSection, {
|
||||||
|
showStepTurnRail: draftShowStepTurnRail,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const stepAgentBadgeToggle = SegmentedControl({
|
||||||
|
ariaLabel: t('settings.str.stepAgentBadgeToggle'),
|
||||||
|
modelValue: 'show',
|
||||||
|
options: getMultiToggleOptions(),
|
||||||
|
onUpdateModelValue: (val) => {
|
||||||
|
draftShowStepAgentBadge = val !== 'hide';
|
||||||
|
syncStepsSectionMeta();
|
||||||
|
void persistStructurePatch(stepsSection, {
|
||||||
|
showStepAgentBadge: draftShowStepAgentBadge,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const stepColumnsList = EditableSlotList({
|
const stepColumnsList = EditableSlotList({
|
||||||
items: draftStepColumns,
|
items: draftStepColumns,
|
||||||
options: getStepColumnOptions(),
|
options: getStepColumnOptions(),
|
||||||
@@ -11601,26 +11671,55 @@ const SettingsStructureTab = defineComponent({
|
|||||||
defaultExpanded: false,
|
defaultExpanded: false,
|
||||||
onToggle: () => props.onLayoutChange?.(),
|
onToggle: () => props.onLayoutChange?.(),
|
||||||
onReset: () => {
|
onReset: () => {
|
||||||
|
draftShowStepTurnRail = true;
|
||||||
|
draftShowStepAgentBadge = true;
|
||||||
draftStepColumns = [...DEFAULT_CLIENT_STEP_COLUMNS];
|
draftStepColumns = [...DEFAULT_CLIENT_STEP_COLUMNS];
|
||||||
syncStepsSectionMeta();
|
syncStepsSectionMeta();
|
||||||
props.onLayoutChange?.();
|
props.onLayoutChange?.();
|
||||||
void persistStructurePatch(
|
void persistStructurePatch(
|
||||||
stepsSection,
|
stepsSection,
|
||||||
{ stepTableColumns: [...DEFAULT_CLIENT_STEP_COLUMNS] },
|
{
|
||||||
|
showStepTurnRail: true,
|
||||||
|
showStepAgentBadge: true,
|
||||||
|
stepTableColumns: [...DEFAULT_CLIENT_STEP_COLUMNS],
|
||||||
|
},
|
||||||
'settings.resetDone'
|
'settings.resetDone'
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
children: [h('div', { className: 'form-row' }, [stepColsLabelEl, stepColumnsList.el])],
|
children: [
|
||||||
|
h('div', { className: 'settings-inline-row' }, [
|
||||||
|
stepTurnRailLabelEl,
|
||||||
|
stepTurnRailToggle.el,
|
||||||
|
]),
|
||||||
|
h('div', { className: 'settings-inline-row' }, [
|
||||||
|
stepAgentBadgeLabelEl,
|
||||||
|
stepAgentBadgeToggle.el,
|
||||||
|
]),
|
||||||
|
h('div', { className: 'settings-divider' }),
|
||||||
|
h('div', { className: 'form-row' }, [stepColsLabelEl, stepColumnsList.el]),
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
function syncStepsSectionMeta() {
|
function syncStepsSectionMeta() {
|
||||||
|
stepTurnRailToggle.setProps({
|
||||||
|
modelValue: draftShowStepTurnRail ? 'show' : 'hide',
|
||||||
|
options: getMultiToggleOptions(),
|
||||||
|
});
|
||||||
|
stepAgentBadgeToggle.setProps({
|
||||||
|
modelValue: draftShowStepAgentBadge ? 'show' : 'hide',
|
||||||
|
options: getMultiToggleOptions(),
|
||||||
|
});
|
||||||
stepColumnsList.refs.setProps({
|
stepColumnsList.refs.setProps({
|
||||||
items: draftStepColumns,
|
items: draftStepColumns,
|
||||||
options: getStepColumnOptions(),
|
options: getStepColumnOptions(),
|
||||||
addBtnTextFn: (count, max) => t('settings.str.addStepCol', { count, max }),
|
addBtnTextFn: (count, max) => t('settings.str.addStepCol', { count, max }),
|
||||||
});
|
});
|
||||||
stepsSection.refs.setBadge(t('settings.str.stepsBadge', { count: draftStepColumns.length }));
|
stepsSection.refs.setBadge(t('settings.str.stepsBadge', { count: draftStepColumns.length }));
|
||||||
stepsSection.refs.setResetDisabled(isSameList(draftStepColumns, DEFAULT_CLIENT_STEP_COLUMNS));
|
const isDefault =
|
||||||
|
draftShowStepTurnRail === true &&
|
||||||
|
draftShowStepAgentBadge === true &&
|
||||||
|
isSameList(draftStepColumns, DEFAULT_CLIENT_STEP_COLUMNS);
|
||||||
|
stepsSection.refs.setResetDisabled(isDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
const rootEl = h('div', { className: 'settings-tab-stack' }, [
|
const rootEl = h('div', { className: 'settings-tab-stack' }, [
|
||||||
@@ -11642,6 +11741,8 @@ const SettingsStructureTab = defineComponent({
|
|||||||
draftHoverModules = normalizeClientHoverModules(settings.hoverModules);
|
draftHoverModules = normalizeClientHoverModules(settings.hoverModules);
|
||||||
draftOverviewModules = normalizeClientOverviewModules(settings.overviewModules);
|
draftOverviewModules = normalizeClientOverviewModules(settings.overviewModules);
|
||||||
draftOverviewMetrics = normalizeClientOverviewMetrics(settings.overviewMetrics);
|
draftOverviewMetrics = normalizeClientOverviewMetrics(settings.overviewMetrics);
|
||||||
|
draftShowStepTurnRail = settings.showStepTurnRail !== false;
|
||||||
|
draftShowStepAgentBadge = settings.showStepAgentBadge !== false;
|
||||||
draftStepColumns = normalizeClientStepColumns(settings.stepTableColumns);
|
draftStepColumns = normalizeClientStepColumns(settings.stepTableColumns);
|
||||||
|
|
||||||
syncMountSectionMeta();
|
syncMountSectionMeta();
|
||||||
@@ -11669,6 +11770,8 @@ const SettingsStructureTab = defineComponent({
|
|||||||
|
|
||||||
stepsSection.refs.setTitle(t('settings.str.stepsSection'));
|
stepsSection.refs.setTitle(t('settings.str.stepsSection'));
|
||||||
stepsSection.refs.setResetLabel(t('settings.resetBtn'));
|
stepsSection.refs.setResetLabel(t('settings.resetBtn'));
|
||||||
|
patchText(stepTurnRailLabelEl, t('settings.str.stepTurnRailToggle'));
|
||||||
|
patchText(stepAgentBadgeLabelEl, t('settings.str.stepAgentBadgeToggle'));
|
||||||
patchText(stepColsLabelEl, t('settings.str.stepsColsLabel'));
|
patchText(stepColsLabelEl, t('settings.str.stepsColsLabel'));
|
||||||
|
|
||||||
syncMountSectionMeta();
|
syncMountSectionMeta();
|
||||||
@@ -11689,6 +11792,8 @@ const SettingsStructureTab = defineComponent({
|
|||||||
hoverModulesList.destroy();
|
hoverModulesList.destroy();
|
||||||
overviewModulesList.destroy();
|
overviewModulesList.destroy();
|
||||||
overviewMetricsList.destroy();
|
overviewMetricsList.destroy();
|
||||||
|
stepTurnRailToggle.destroy();
|
||||||
|
stepAgentBadgeToggle.destroy();
|
||||||
stepColumnsList.destroy();
|
stepColumnsList.destroy();
|
||||||
mountSection.destroy();
|
mountSection.destroy();
|
||||||
hoverSection.destroy();
|
hoverSection.destroy();
|
||||||
@@ -11705,6 +11810,8 @@ const SettingsStructureTab = defineComponent({
|
|||||||
hoverModulesList,
|
hoverModulesList,
|
||||||
overviewModulesList,
|
overviewModulesList,
|
||||||
overviewMetricsList,
|
overviewMetricsList,
|
||||||
|
stepTurnRailToggle,
|
||||||
|
stepAgentBadgeToggle,
|
||||||
stepColumnsList,
|
stepColumnsList,
|
||||||
mountSection,
|
mountSection,
|
||||||
hoverSection,
|
hoverSection,
|
||||||
@@ -13790,6 +13897,16 @@ function getFitMetricSwitchOptions() {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatTurnPromptText(rawPrompt) {
|
||||||
|
const text = String(rawPrompt || '').trim();
|
||||||
|
if (!text || !isEnglishLocale()) return text;
|
||||||
|
if (text === '[图片/附件提问]') return t('steps.turnMediaOnly');
|
||||||
|
if (text.endsWith(' [附图]')) {
|
||||||
|
return `${text.slice(0, -5)} ${t('steps.turnMediaSuffix')}`;
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
const StepsDetailView = defineComponent({
|
const StepsDetailView = defineComponent({
|
||||||
name: 'StepsDetailView',
|
name: 'StepsDetailView',
|
||||||
setup({ onCleanup }) {
|
setup({ onCleanup }) {
|
||||||
@@ -13881,17 +13998,57 @@ const StepsDetailView = defineComponent({
|
|||||||
|
|
||||||
syncTableHeaderColumns(DEFAULT_STEP_COLUMN_KEYS);
|
syncTableHeaderColumns(DEFAULT_STEP_COLUMN_KEYS);
|
||||||
|
|
||||||
const stepsTablePane = h('div', { className: 'table-viewport is-step-table' }, [
|
const stepsTableEl = h('table', { className: 'data-table steps-data-table' }, [
|
||||||
h('table', { className: 'data-table' }, [
|
|
||||||
h('thead', {}, [stepsTheadRow]),
|
h('thead', {}, [stepsTheadRow]),
|
||||||
stepsTbody,
|
stepsTbody,
|
||||||
]),
|
|
||||||
]);
|
]);
|
||||||
|
const stepsTablePane = h('div', { className: 'table-viewport is-step-table' }, [stepsTableEl]);
|
||||||
const stepsScroll = CustomScrollbar({
|
const stepsScroll = CustomScrollbar({
|
||||||
contentEl: stepsTablePane,
|
contentEl: stepsTablePane,
|
||||||
className: 'table-scroll-host',
|
className: 'table-scroll-host',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const turnTipEl = h('div', {
|
||||||
|
className: 'turn-prompt-tip',
|
||||||
|
role: 'tooltip',
|
||||||
|
hidden: true,
|
||||||
|
});
|
||||||
|
const hideTurnTip = () => patchAttr(turnTipEl, 'hidden', true);
|
||||||
|
|
||||||
|
function showTurnTip(anchorCell, promptText) {
|
||||||
|
const text = String(promptText || '').trim();
|
||||||
|
if (!anchorCell || !text) {
|
||||||
|
hideTurnTip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
patchText(turnTipEl, text);
|
||||||
|
patchAttr(turnTipEl, 'hidden', false);
|
||||||
|
if (
|
||||||
|
typeof panelEl.getBoundingClientRect === 'function' &&
|
||||||
|
typeof anchorCell.getBoundingClientRect === 'function'
|
||||||
|
) {
|
||||||
|
const panelRect = panelEl.getBoundingClientRect();
|
||||||
|
const cellRect = anchorCell.getBoundingClientRect();
|
||||||
|
if (panelRect.width > 0 && panelRect.height > 0) {
|
||||||
|
const tipH = turnTipEl.offsetHeight || 36;
|
||||||
|
const tipW = turnTipEl.offsetWidth || 180;
|
||||||
|
const placeAbove =
|
||||||
|
panelRect.bottom - cellRect.bottom < tipH + 10 &&
|
||||||
|
cellRect.top - panelRect.top > tipH + 6;
|
||||||
|
const topPx = placeAbove
|
||||||
|
? Math.max(4, Math.round(cellRect.top - panelRect.top - tipH - 4))
|
||||||
|
: Math.round(cellRect.bottom - panelRect.top + 4);
|
||||||
|
const maxLeft = Math.max(6, Math.round(panelRect.width - tipW - 8));
|
||||||
|
const leftPx = Math.min(
|
||||||
|
maxLeft,
|
||||||
|
Math.max(6, Math.round(cellRect.left - panelRect.left + 4))
|
||||||
|
);
|
||||||
|
turnTipEl.style.top = `${topPx}px`;
|
||||||
|
turnTipEl.style.left = `${leftPx}px`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- 子视图 2:总汇总分析面板 ---
|
// --- 子视图 2:总汇总分析面板 ---
|
||||||
let selectedLineMetric = 'totalTokens';
|
let selectedLineMetric = 'totalTokens';
|
||||||
let selectedFitMetric = 'tps';
|
let selectedFitMetric = 'tps';
|
||||||
@@ -14021,7 +14178,7 @@ const StepsDetailView = defineComponent({
|
|||||||
'section',
|
'section',
|
||||||
{
|
{
|
||||||
className: 'panel',
|
className: 'panel',
|
||||||
style: 'flex: 1; min-height: 0; display: flex; flex-direction: column;',
|
style: 'flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative;',
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
h('div', { className: 'panel-header steps-panel-header' }, [
|
h('div', { className: 'panel-header steps-panel-header' }, [
|
||||||
@@ -14037,8 +14194,11 @@ const StepsDetailView = defineComponent({
|
|||||||
]),
|
]),
|
||||||
stepsScroll.el,
|
stepsScroll.el,
|
||||||
modelsScroll.el,
|
modelsScroll.el,
|
||||||
|
turnTipEl,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
stepsTablePane.addEventListener('scroll', hideTurnTip);
|
||||||
|
stepsTbody.addEventListener('mouseleave', hideTurnTip);
|
||||||
|
|
||||||
const rootEl = h('div', { className: 'view-pane' }, [panelEl]);
|
const rootEl = h('div', { className: 'view-pane' }, [panelEl]);
|
||||||
|
|
||||||
@@ -14114,42 +14274,111 @@ const StepsDetailView = defineComponent({
|
|||||||
function renderStepTable(tableSteps, cascadeId, colKeys, locale, {
|
function renderStepTable(tableSteps, cascadeId, colKeys, locale, {
|
||||||
effectiveScopes,
|
effectiveScopes,
|
||||||
hasSubagents,
|
hasSubagents,
|
||||||
|
isMergedMultiAgents,
|
||||||
|
showStepTurnRail,
|
||||||
|
showStepAgentBadge,
|
||||||
displaySettings,
|
displaySettings,
|
||||||
}) {
|
}) {
|
||||||
const colOrderSig = colKeys.join(',');
|
const colOrderSig = colKeys.join(',');
|
||||||
const wantedSet = new Set(colKeys);
|
const wantedSet = new Set(colKeys);
|
||||||
syncTableHeaderColumns(colKeys);
|
syncTableHeaderColumns(colKeys);
|
||||||
|
|
||||||
|
const showAgentBadge = Boolean(hasSubagents && showStepAgentBadge);
|
||||||
const cellCtx = {
|
const cellCtx = {
|
||||||
hasSubagents,
|
hasSubagents,
|
||||||
|
showAgentBadge,
|
||||||
effectiveScopes,
|
effectiveScopes,
|
||||||
scopeSigKey: effectiveScopes.join(','),
|
scopeSigKey: effectiveScopes.join(','),
|
||||||
displaySettings,
|
displaySettings,
|
||||||
onSelectAgentScopes: applyAgentScopesSelection,
|
onSelectAgentScopes: applyAgentScopesSelection,
|
||||||
};
|
};
|
||||||
|
|
||||||
patchKeyedList(stepsTbody, tableSteps, {
|
const useRootTurn = Boolean(hasSubagents && isMergedMultiAgents);
|
||||||
keyFn: (st) => `${st.agentCascadeId || cascadeId || 'conv'}-${st.stepIndex}`,
|
const getStepTurnIdx = (st) =>
|
||||||
sigFn: (st) => {
|
useRootTurn ? (st?.rootTurnIndex ?? st?.turnIndex) : st?.turnIndex;
|
||||||
|
const getStepIsStart = (st) =>
|
||||||
|
Boolean(useRootTurn ? (st?.isRootTurnStart ?? st?.isTurnStart) : st?.isTurnStart);
|
||||||
|
const getStepIsLatest = (st) =>
|
||||||
|
Boolean(useRootTurn ? (st?.isRootLatestTurn ?? st?.isLatestTurn) : st?.isLatestTurn);
|
||||||
|
const getStepPrompt = (st) =>
|
||||||
|
(useRootTurn ? (st?.rootTurnPrompt ?? st?.turnPrompt) : st?.turnPrompt) || '';
|
||||||
|
const turnKeyOf = (st) => {
|
||||||
|
if (!showStepTurnRail) return '';
|
||||||
|
const tIdx = getStepTurnIdx(st);
|
||||||
|
if (!Number.isInteger(tIdx) || tIdx <= 0) return '';
|
||||||
|
return useRootTurn ? `root:${tIdx}` : `${st?.agentId || 'main'}:${tIdx}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const decoratedSteps = tableSteps.map((st, idx) => {
|
||||||
|
const tKey = turnKeyOf(st);
|
||||||
|
const hasTurn = Boolean(tKey);
|
||||||
|
const hasUp = Boolean(hasTurn && idx > 0 && turnKeyOf(tableSteps[idx - 1]) === tKey);
|
||||||
|
const hasDown = Boolean(
|
||||||
|
hasTurn && idx + 1 < tableSteps.length && turnKeyOf(tableSteps[idx + 1]) === tKey
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
st,
|
||||||
|
rowKey: `${st.agentCascadeId || cascadeId || 'conv'}-${st.stepIndex}`,
|
||||||
|
hasTurn,
|
||||||
|
hasUp,
|
||||||
|
hasDown,
|
||||||
|
isStart: Boolean(hasTurn && (getStepIsStart(st) || !hasDown)),
|
||||||
|
isLatest: hasTurn && getStepIsLatest(st),
|
||||||
|
prompt: hasTurn ? formatTurnPromptText(getStepPrompt(st)) : '',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const railActive = Boolean(showStepTurnRail && decoratedSteps.some((d) => d.hasTurn));
|
||||||
|
if (!railActive) {
|
||||||
|
hideTurnTip();
|
||||||
|
}
|
||||||
|
patchClasses(stepsTableEl, { 'has-turn-rail': railActive });
|
||||||
|
|
||||||
|
patchKeyedList(stepsTbody, decoratedSteps, {
|
||||||
|
keyFn: (item) => item.rowKey,
|
||||||
|
sigFn: (item) => {
|
||||||
|
const { st } = item;
|
||||||
const parts = colKeys
|
const parts = colKeys
|
||||||
.map((colKey) => STEP_COLUMN_REGISTRY[colKey].sigPart(st, cellCtx))
|
.map((colKey) => STEP_COLUMN_REGISTRY[colKey].sigPart(st, cellCtx))
|
||||||
.join('|');
|
.join('|');
|
||||||
return `${locale}:${colOrderSig}:${parts}`;
|
return `${locale}:${colOrderSig}:${railActive}:${item.hasTurn}:${item.hasUp}:${item.hasDown}:${item.isStart}:${item.isLatest}:${item.prompt}:${parts}`;
|
||||||
},
|
},
|
||||||
createRow: () => {
|
createRow: () => {
|
||||||
const tr = h('tr');
|
const tr = h('tr');
|
||||||
|
const railLineEl = h('span', { className: 'turn-rail-line', hidden: true });
|
||||||
|
const railDotEl = h('span', { className: 'turn-rail-dot', hidden: true });
|
||||||
|
const railEl = h(
|
||||||
|
'span',
|
||||||
|
{ className: 'turn-rail', 'aria-hidden': 'true', hidden: true },
|
||||||
|
[railLineEl, railDotEl]
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
el: tr,
|
el: tr,
|
||||||
refs: {
|
refs: {
|
||||||
cellMap: new Map(),
|
cellMap: new Map(),
|
||||||
colOrderSig: '',
|
colOrderSig: '',
|
||||||
|
railEl,
|
||||||
|
railLineEl,
|
||||||
|
railDotEl,
|
||||||
|
hoverTd: null,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
updateRow: (refs, st, _idx, tr) => {
|
updateRow: (refs, item, _idx, tr) => {
|
||||||
|
const { st, hasTurn, hasUp, hasDown, isStart, isLatest, prompt } = item;
|
||||||
|
|
||||||
if (refs.colOrderSig !== colOrderSig) {
|
if (refs.colOrderSig !== colOrderSig) {
|
||||||
|
if (refs.hoverTd) {
|
||||||
|
refs.hoverTd.onmouseenter = null;
|
||||||
|
refs.hoverTd.onmousemove = null;
|
||||||
|
refs.hoverTd.onmouseleave = null;
|
||||||
|
refs.hoverTd = null;
|
||||||
|
}
|
||||||
for (const [oldColKey, entry] of refs.cellMap) {
|
for (const [oldColKey, entry] of refs.cellMap) {
|
||||||
if (!wantedSet.has(oldColKey)) {
|
if (!wantedSet.has(oldColKey)) {
|
||||||
|
if (refs.railEl.parentNode === entry.td) {
|
||||||
|
entry.td.removeChild(refs.railEl);
|
||||||
|
}
|
||||||
tr.removeChild(entry.td);
|
tr.removeChild(entry.td);
|
||||||
refs.cellMap.delete(oldColKey);
|
refs.cellMap.delete(oldColKey);
|
||||||
}
|
}
|
||||||
@@ -14172,6 +14401,74 @@ const StepsDetailView = defineComponent({
|
|||||||
const cellEntry = refs.cellMap.get(colKey);
|
const cellEntry = refs.cellMap.get(colKey);
|
||||||
STEP_COLUMN_REGISTRY[colKey].updateCell(cellEntry.refs, st, cellCtx);
|
STEP_COLUMN_REGISTRY[colKey].updateCell(cellEntry.refs, st, cellCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const firstColKey = colKeys[0];
|
||||||
|
const firstTd = firstColKey ? refs.cellMap.get(firstColKey)?.td || null : null;
|
||||||
|
if (firstTd && refs.railEl.parentNode !== firstTd) {
|
||||||
|
firstTd.insertBefore(refs.railEl, firstTd.firstChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
const showRowRail = Boolean(railActive && hasTurn && firstTd);
|
||||||
|
patchAttr(refs.railEl, 'hidden', !showRowRail);
|
||||||
|
if (showRowRail) {
|
||||||
|
patchClasses(refs.railEl, {
|
||||||
|
'is-latest': isLatest,
|
||||||
|
'has-up': hasUp,
|
||||||
|
'has-down': hasDown,
|
||||||
|
});
|
||||||
|
patchAttr(refs.railLineEl, 'hidden', !hasUp && !hasDown);
|
||||||
|
const showOrigin = isStart;
|
||||||
|
const showCap = !showOrigin && !hasUp && hasDown;
|
||||||
|
patchAttr(refs.railDotEl, 'hidden', !showOrigin && !showCap);
|
||||||
|
patchClasses(refs.railDotEl, {
|
||||||
|
'is-origin': showOrigin,
|
||||||
|
'is-cap': showCap,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const stepEntry = refs.cellMap.get('step') || null;
|
||||||
|
const targetHoverTd = stepEntry ? stepEntry.td : firstTd;
|
||||||
|
if (refs.hoverTd && refs.hoverTd !== targetHoverTd) {
|
||||||
|
refs.hoverTd.onmouseenter = null;
|
||||||
|
refs.hoverTd.onmousemove = null;
|
||||||
|
refs.hoverTd.onmouseleave = null;
|
||||||
|
}
|
||||||
|
refs.hoverTd = targetHoverTd;
|
||||||
|
|
||||||
|
if (targetHoverTd) {
|
||||||
|
if (stepEntry) {
|
||||||
|
const badgeEl = stepEntry.refs.agentBadgeEl;
|
||||||
|
targetHoverTd.onmouseenter = (ev) => {
|
||||||
|
if (!showRowRail || !prompt || ev?.target === badgeEl) {
|
||||||
|
hideTurnTip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showTurnTip(targetHoverTd, prompt);
|
||||||
|
};
|
||||||
|
targetHoverTd.onmousemove = (ev) => {
|
||||||
|
if (!showRowRail || !prompt || ev?.target === badgeEl) {
|
||||||
|
hideTurnTip();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
targetHoverTd.onmouseleave = hideTurnTip;
|
||||||
|
} else {
|
||||||
|
targetHoverTd.onmouseenter = null;
|
||||||
|
targetHoverTd.onmousemove = (ev) => {
|
||||||
|
if (!showRowRail || !prompt) {
|
||||||
|
hideTurnTip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const rect = targetHoverTd.getBoundingClientRect?.();
|
||||||
|
const relX = rect ? (ev?.clientX ?? 0) - rect.left : 0;
|
||||||
|
if (relX <= 18) {
|
||||||
|
showTurnTip(targetHoverTd, prompt);
|
||||||
|
} else {
|
||||||
|
hideTurnTip();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
targetHoverTd.onmouseleave = hideTurnTip;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -14402,6 +14699,9 @@ const StepsDetailView = defineComponent({
|
|||||||
renderStepTable(tableSteps, slice.cascadeId, colKeys, locale, {
|
renderStepTable(tableSteps, slice.cascadeId, colKeys, locale, {
|
||||||
effectiveScopes,
|
effectiveScopes,
|
||||||
hasSubagents,
|
hasSubagents,
|
||||||
|
isMergedMultiAgents,
|
||||||
|
showStepTurnRail: slice.showStepTurnRail !== false,
|
||||||
|
showStepAgentBadge: slice.showStepAgentBadge !== false,
|
||||||
displaySettings,
|
displaySettings,
|
||||||
});
|
});
|
||||||
stepsScroll.refresh();
|
stepsScroll.refresh();
|
||||||
@@ -14698,6 +14998,7 @@ const StepsDetailView = defineComponent({
|
|||||||
const unsubUi = uiStore.subscribe(
|
const unsubUi = uiStore.subscribe(
|
||||||
(st) => st.stepsSubTab,
|
(st) => st.stepsSubTab,
|
||||||
(tab) => {
|
(tab) => {
|
||||||
|
hideTurnTip();
|
||||||
subTabSwitch.setValue(tab);
|
subTabSwitch.setValue(tab);
|
||||||
patchAttr(stepsScroll.el, 'hidden', tab !== 'steps');
|
patchAttr(stepsScroll.el, 'hidden', tab !== 'steps');
|
||||||
patchAttr(modelsScroll.el, 'hidden', tab !== 'models');
|
patchAttr(modelsScroll.el, 'hidden', tab !== 'models');
|
||||||
@@ -14721,6 +15022,8 @@ const StepsDetailView = defineComponent({
|
|||||||
orchestratorIdMode: normalizeOrchestratorIdDisplayMode(
|
orchestratorIdMode: normalizeOrchestratorIdDisplayMode(
|
||||||
st.telemetry?.settings?.orchestratorIdMode
|
st.telemetry?.settings?.orchestratorIdMode
|
||||||
),
|
),
|
||||||
|
showStepTurnRail: st.telemetry?.settings?.showStepTurnRail !== false,
|
||||||
|
showStepAgentBadge: st.telemetry?.settings?.showStepAgentBadge !== false,
|
||||||
stepTableColumns: st.telemetry?.settings?.stepTableColumns,
|
stepTableColumns: st.telemetry?.settings?.stepTableColumns,
|
||||||
}),
|
}),
|
||||||
(slice) => {
|
(slice) => {
|
||||||
@@ -14755,6 +15058,7 @@ const StepsDetailView = defineComponent({
|
|||||||
prevScope = uiSlice.selectedAgentScope;
|
prevScope = uiSlice.selectedAgentScope;
|
||||||
prevActiveView = uiSlice.activeView;
|
prevActiveView = uiSlice.activeView;
|
||||||
if (uiSlice.activeView !== 'steps') {
|
if (uiSlice.activeView !== 'steps') {
|
||||||
|
hideTurnTip();
|
||||||
fitPinnedWhileVisible = false;
|
fitPinnedWhileVisible = false;
|
||||||
if (scopeChanged) isDirty = true;
|
if (scopeChanged) isDirty = true;
|
||||||
return;
|
return;
|
||||||
@@ -14779,6 +15083,8 @@ const StepsDetailView = defineComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
onCleanup(() => {
|
onCleanup(() => {
|
||||||
|
stepsTablePane.removeEventListener('scroll', hideTurnTip);
|
||||||
|
stepsTbody.removeEventListener('mouseleave', hideTurnTip);
|
||||||
unsubUi();
|
unsubUi();
|
||||||
unsubTelemetry();
|
unsubTelemetry();
|
||||||
unsubView();
|
unsubView();
|
||||||
@@ -14799,8 +15105,10 @@ const StepsDetailView = defineComponent({
|
|||||||
return {
|
return {
|
||||||
el: rootEl,
|
el: rootEl,
|
||||||
refs: {
|
refs: {
|
||||||
|
stepsTableEl,
|
||||||
stepsTheadRow,
|
stepsTheadRow,
|
||||||
stepsTbody,
|
stepsTbody,
|
||||||
|
turnTipEl,
|
||||||
modelsListEl,
|
modelsListEl,
|
||||||
inlineScopeSelect,
|
inlineScopeSelect,
|
||||||
stepsModelSelect,
|
stepsModelSelect,
|
||||||
|
|||||||
@@ -878,6 +878,7 @@ export async function enumerateAndSyncConversations({
|
|||||||
wasRunning: isRunning,
|
wasRunning: isRunning,
|
||||||
contextLimitTelemetry: true,
|
contextLimitTelemetry: true,
|
||||||
speedClearedTelemetry: true,
|
speedClearedTelemetry: true,
|
||||||
|
turnRailTelemetry: true,
|
||||||
steps,
|
steps,
|
||||||
subagentRefs,
|
subagentRefs,
|
||||||
};
|
};
|
||||||
@@ -900,6 +901,7 @@ export async function enumerateAndSyncConversations({
|
|||||||
Boolean(prev.wasRunning) !== isRunning ||
|
Boolean(prev.wasRunning) !== isRunning ||
|
||||||
!prev.contextLimitTelemetry ||
|
!prev.contextLimitTelemetry ||
|
||||||
!prev.speedClearedTelemetry ||
|
!prev.speedClearedTelemetry ||
|
||||||
|
!prev.turnRailTelemetry ||
|
||||||
metaChanged ||
|
metaChanged ||
|
||||||
JSON.stringify(prev.steps) !== JSON.stringify(steps);
|
JSON.stringify(prev.steps) !== JSON.stringify(steps);
|
||||||
|
|
||||||
@@ -948,13 +950,28 @@ export async function enumerateAndSyncConversations({
|
|||||||
const selectedRootId = rawConversations.find(
|
const selectedRootId = rawConversations.find(
|
||||||
(c) => c.cascadeId.toLowerCase() === contextTelemetryCascadeId
|
(c) => c.cascadeId.toLowerCase() === contextTelemetryCascadeId
|
||||||
)?.rootConversationId || contextTelemetryCascadeId;
|
)?.rootConversationId || contextTelemetryCascadeId;
|
||||||
|
function hasMissingTurnRailFields(cached) {
|
||||||
|
const steps = cached?.steps || [];
|
||||||
|
const lastCachedStep = steps[steps.length - 1];
|
||||||
|
if (!lastCachedStep) return false;
|
||||||
|
return !Object.prototype.hasOwnProperty.call(lastCachedStep, 'turnIndex');
|
||||||
|
}
|
||||||
|
|
||||||
let remainingTimingRefreshes = LEGACY_MIGRATION_BATCH_SIZE;
|
let remainingTimingRefreshes = LEGACY_MIGRATION_BATCH_SIZE;
|
||||||
const toFetch = rawConversations.filter((conv) => {
|
const toFetch = rawConversations.filter((conv) => {
|
||||||
const sig = buildConvSig(conv);
|
const sig = buildConvSig(conv);
|
||||||
if (isFetchInCooldown(conv, sig)) return false;
|
if (isFetchInCooldown(conv, sig)) return false;
|
||||||
const cached = trajectoryCache[conv.cascadeId];
|
const cached = trajectoryCache[conv.cascadeId];
|
||||||
if (!cached || conv.needsInitialLoad) return true;
|
if (!cached || conv.needsInitialLoad) return true;
|
||||||
if (!cached.contextLimitTelemetry && conv.cascadeId.toLowerCase() === contextTelemetryCascadeId) return true;
|
const lowerCid = conv.cascadeId.toLowerCase();
|
||||||
|
const isSelectedFamily =
|
||||||
|
lowerCid === contextTelemetryCascadeId ||
|
||||||
|
lowerCid === selectedRootId ||
|
||||||
|
Boolean(conv.rootConversationId && conv.rootConversationId.toLowerCase() === selectedRootId);
|
||||||
|
if (!cached.contextLimitTelemetry && lowerCid === contextTelemetryCascadeId) return true;
|
||||||
|
if ((!cached.turnRailTelemetry || hasMissingTurnRailFields(cached)) && isSelectedFamily) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const hasCurrentSchema = String(cached.signature || '').startsWith(
|
const hasCurrentSchema = String(cached.signature || '').startsWith(
|
||||||
`${CACHE_SCHEMA_VERSION}:`
|
`${CACHE_SCHEMA_VERSION}:`
|
||||||
);
|
);
|
||||||
@@ -1064,10 +1081,13 @@ export async function enumerateAndSyncConversations({
|
|||||||
|
|
||||||
const targetCacheKey = subConv.cascadeId;
|
const targetCacheKey = subConv.cascadeId;
|
||||||
const existingSubCache = trajectoryCache[targetCacheKey];
|
const existingSubCache = trajectoryCache[targetCacheKey];
|
||||||
|
const isSelectedSubFamily = rootId === selectedRootId;
|
||||||
const hasValidSubCache =
|
const hasValidSubCache =
|
||||||
existingSubCache &&
|
existingSubCache &&
|
||||||
String(existingSubCache.signature || '').startsWith(`${CACHE_SCHEMA_VERSION}:`) &&
|
String(existingSubCache.signature || '').startsWith(`${CACHE_SCHEMA_VERSION}:`) &&
|
||||||
!hasMissingStepFields(existingSubCache);
|
!hasMissingStepFields(existingSubCache) &&
|
||||||
|
(!isSelectedSubFamily ||
|
||||||
|
(Boolean(existingSubCache.turnRailTelemetry) && !hasMissingTurnRailFields(existingSubCache)));
|
||||||
|
|
||||||
if (hasValidSubCache) {
|
if (hasValidSubCache) {
|
||||||
let subMetaUpdated = false;
|
let subMetaUpdated = false;
|
||||||
|
|||||||
@@ -360,6 +360,8 @@ export const DEFAULT_SETTINGS_SCHEMA = Object.freeze({
|
|||||||
hoverModules: DEFAULT_HOVER_MODULES,
|
hoverModules: DEFAULT_HOVER_MODULES,
|
||||||
overviewModules: DEFAULT_OVERVIEW_MODULES,
|
overviewModules: DEFAULT_OVERVIEW_MODULES,
|
||||||
overviewMetrics: DEFAULT_OVERVIEW_METRICS,
|
overviewMetrics: DEFAULT_OVERVIEW_METRICS,
|
||||||
|
showStepTurnRail: true,
|
||||||
|
showStepAgentBadge: true,
|
||||||
stepTableColumns: DEFAULT_STEP_TABLE_COLUMNS,
|
stepTableColumns: DEFAULT_STEP_TABLE_COLUMNS,
|
||||||
modelContextWindows: Object.freeze({}),
|
modelContextWindows: Object.freeze({}),
|
||||||
});
|
});
|
||||||
@@ -386,6 +388,8 @@ export function createDefaultSettingsObject() {
|
|||||||
hoverModules: [...DEFAULT_HOVER_MODULES],
|
hoverModules: [...DEFAULT_HOVER_MODULES],
|
||||||
overviewModules: [...DEFAULT_OVERVIEW_MODULES],
|
overviewModules: [...DEFAULT_OVERVIEW_MODULES],
|
||||||
overviewMetrics: [...DEFAULT_OVERVIEW_METRICS],
|
overviewMetrics: [...DEFAULT_OVERVIEW_METRICS],
|
||||||
|
showStepTurnRail: DEFAULT_SETTINGS_SCHEMA.showStepTurnRail,
|
||||||
|
showStepAgentBadge: DEFAULT_SETTINGS_SCHEMA.showStepAgentBadge,
|
||||||
stepTableColumns: [...DEFAULT_STEP_TABLE_COLUMNS],
|
stepTableColumns: [...DEFAULT_STEP_TABLE_COLUMNS],
|
||||||
modelContextWindows: {},
|
modelContextWindows: {},
|
||||||
};
|
};
|
||||||
@@ -430,6 +434,8 @@ export function normalizeFullSettings(rawInput) {
|
|||||||
hoverModules: normalizeHoverModules(safeRaw.hoverModules),
|
hoverModules: normalizeHoverModules(safeRaw.hoverModules),
|
||||||
overviewModules: normalizeOverviewModules(safeRaw.overviewModules),
|
overviewModules: normalizeOverviewModules(safeRaw.overviewModules),
|
||||||
overviewMetrics: normalizeOverviewMetrics(safeRaw.overviewMetrics),
|
overviewMetrics: normalizeOverviewMetrics(safeRaw.overviewMetrics),
|
||||||
|
showStepTurnRail: safeRaw.showStepTurnRail !== false,
|
||||||
|
showStepAgentBadge: safeRaw.showStepAgentBadge !== false,
|
||||||
stepTableColumns: normalizeStepTableColumns(safeRaw.stepTableColumns),
|
stepTableColumns: normalizeStepTableColumns(safeRaw.stepTableColumns),
|
||||||
modelContextWindows: normalizeModelContextWindows(safeRaw.modelContextWindows),
|
modelContextWindows: normalizeModelContextWindows(safeRaw.modelContextWindows),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -169,6 +169,31 @@ function enrichActiveConversationSteps(
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 关联每轮用户提问摘要与最新轮次标识,供步骤表极简导轨与气泡展示
|
||||||
|
let maxTurnIndex = 0;
|
||||||
|
const promptByTurn = new Map();
|
||||||
|
for (const st of enrichedActiveSteps) {
|
||||||
|
const tIdx = st.turnIndex;
|
||||||
|
if (!Number.isInteger(tIdx) || tIdx <= 0) continue;
|
||||||
|
if (tIdx > maxTurnIndex) maxTurnIndex = tIdx;
|
||||||
|
if (st.turnPrompt && (st.isTurnStart || !promptByTurn.has(tIdx))) {
|
||||||
|
promptByTurn.set(tIdx, st.turnPrompt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const st of enrichedActiveSteps) {
|
||||||
|
const tIdx = st.turnIndex;
|
||||||
|
if (!Number.isInteger(tIdx) || tIdx <= 0) {
|
||||||
|
st.turnIndex = null;
|
||||||
|
st.isTurnStart = false;
|
||||||
|
st.isLatestTurn = false;
|
||||||
|
st.turnPrompt = '';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
st.isTurnStart = Boolean(st.isTurnStart);
|
||||||
|
st.isLatestTurn = tIdx === maxTurnIndex;
|
||||||
|
st.turnPrompt = promptByTurn.get(tIdx) || '';
|
||||||
|
}
|
||||||
|
|
||||||
const latestEnriched =
|
const latestEnriched =
|
||||||
enrichedActiveSteps.length > 0 ? enrichedActiveSteps[enrichedActiveSteps.length - 1] : null;
|
enrichedActiveSteps.length > 0 ? enrichedActiveSteps[enrichedActiveSteps.length - 1] : null;
|
||||||
const sessionAvgTokPerSec = roundMetric(sessionSpeed.avgTokPerSec);
|
const sessionAvgTokPerSec = roundMetric(sessionSpeed.avgTokPerSec);
|
||||||
@@ -526,6 +551,54 @@ export async function buildTelemetryPayloadInternal(
|
|||||||
(a.agentIndex || 0) - (b.agentIndex || 0) ||
|
(a.agentIndex || 0) - (b.agentIndex || 0) ||
|
||||||
(a.stepIndex || 0) - (b.stepIndex || 0)
|
(a.stepIndex || 0) - (b.stepIndex || 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 在多代理汇总视图下,将并行交错的子代理步骤按时间归入对应的主会话用户轮次,避免导轨被交错步骤切碎
|
||||||
|
const mainTurnByIdx = new Map();
|
||||||
|
let maxRootTurn = 0;
|
||||||
|
for (const mSt of enrichedActiveSteps) {
|
||||||
|
const tIdx = mSt.turnIndex;
|
||||||
|
if (!Number.isInteger(tIdx) || tIdx <= 0) continue;
|
||||||
|
if (tIdx > maxRootTurn) maxRootTurn = tIdx;
|
||||||
|
if (!mainTurnByIdx.has(tIdx) || mSt.isTurnStart) {
|
||||||
|
mainTurnByIdx.set(tIdx, {
|
||||||
|
turnIndex: tIdx,
|
||||||
|
startMs: mSt.createdAtMs || 0,
|
||||||
|
prompt: mSt.turnPrompt || '',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const mainTurns = Array.from(mainTurnByIdx.values()).sort(
|
||||||
|
(a, b) => a.turnIndex - b.turnIndex
|
||||||
|
);
|
||||||
|
if (mainTurns.length > 0) {
|
||||||
|
const seenRootStarts = new Set();
|
||||||
|
for (const st of allCombinedEnrichedSteps) {
|
||||||
|
let matched = null;
|
||||||
|
if (!st.isSubagent && Number.isInteger(st.turnIndex) && st.turnIndex > 0) {
|
||||||
|
matched = mainTurnByIdx.get(st.turnIndex) || null;
|
||||||
|
} else {
|
||||||
|
const ts = st.createdAtMs || 0;
|
||||||
|
for (let k = mainTurns.length - 1; k >= 0; k--) {
|
||||||
|
if (ts >= mainTurns[k].startMs) {
|
||||||
|
matched = mainTurns[k];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!matched) matched = mainTurns[0];
|
||||||
|
}
|
||||||
|
if (matched) {
|
||||||
|
st.rootTurnIndex = matched.turnIndex;
|
||||||
|
st.isRootLatestTurn = matched.turnIndex === maxRootTurn;
|
||||||
|
st.rootTurnPrompt = matched.prompt || '';
|
||||||
|
if (!seenRootStarts.has(matched.turnIndex)) {
|
||||||
|
seenRootStarts.add(matched.turnIndex);
|
||||||
|
st.isRootTurnStart = true;
|
||||||
|
} else {
|
||||||
|
st.isRootTurnStart = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const combinedSpeed = summarizeSpeed(allCombinedRawSteps);
|
const combinedSpeed = summarizeSpeed(allCombinedRawSteps);
|
||||||
const combinedTtft = summarizeTtft(allCombinedRawSteps);
|
const combinedTtft = summarizeTtft(allCombinedRawSteps);
|
||||||
const combinedAvgTokPerSec = roundMetric(combinedSpeed.avgTokPerSec);
|
const combinedAvgTokPerSec = roundMetric(combinedSpeed.avgTokPerSec);
|
||||||
|
|||||||
@@ -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=1794722545161">
|
<link rel="stylesheet" href="/styles.css?v=1794728792446">
|
||||||
<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=1794722545161"></script>
|
<script src="/app.js?v=1794728792446"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -610,14 +610,91 @@ export function extractModelSteps(rawSteps = [], generatorMetadata = []) {
|
|||||||
|
|
||||||
const result = [];
|
const result = [];
|
||||||
let lastCompactionStepIdx = -1;
|
let lastCompactionStepIdx = -1;
|
||||||
|
let turnCounter = 0;
|
||||||
|
let activeTurnIndex = null;
|
||||||
|
let pendingTurnPrompts = [];
|
||||||
|
let hasUnconsumedTurn = false;
|
||||||
|
|
||||||
|
const isUserTurnBoundary = (step) => {
|
||||||
|
if (!step || typeof step !== 'object') return false;
|
||||||
|
const t = String(step.type || '').trim().toUpperCase();
|
||||||
|
if (t === 'CORTEX_STEP_TYPE_USER_INPUT' || t === 'USER_INPUT') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return Boolean(step.userInput && typeof step.userInput === 'object');
|
||||||
|
};
|
||||||
|
|
||||||
|
const extractUserTurnPrompt = (step) => {
|
||||||
|
const ui = step?.userInput;
|
||||||
|
let raw = '';
|
||||||
|
if (typeof ui?.userResponse === 'string' && ui.userResponse.trim()) {
|
||||||
|
raw = ui.userResponse;
|
||||||
|
} else if (Array.isArray(ui?.items)) {
|
||||||
|
raw = ui.items
|
||||||
|
.map((it) => (typeof it?.text === 'string' ? it.text : ''))
|
||||||
|
.filter(Boolean)
|
||||||
|
.join('\n');
|
||||||
|
} else if (typeof step?.content === 'string' && step.content.trim()) {
|
||||||
|
const withoutSummary = step.content
|
||||||
|
.replace(/<CONTEXT_SUMMARY>[\s\S]*?<\/CONTEXT_SUMMARY>/gi, '')
|
||||||
|
.replace(/<SYSTEM_MESSAGE>[\s\S]*$/i, '');
|
||||||
|
const reqMatches = [...withoutSummary.matchAll(/<USER_REQUEST>([\s\S]*?)<\/USER_REQUEST>/gi)];
|
||||||
|
raw =
|
||||||
|
reqMatches.length > 0
|
||||||
|
? reqMatches[reqMatches.length - 1][1]
|
||||||
|
: withoutSummary.replace(/<ADDITIONAL_METADATA>[\s\S]*$/i, '');
|
||||||
|
}
|
||||||
|
const cleaned = String(raw || '')
|
||||||
|
.split(/\r?\n/)
|
||||||
|
.map((l) => l.replace(/\s+/g, ' ').trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
.join('\n');
|
||||||
|
const mediaArr = Array.isArray(ui?.media)
|
||||||
|
? ui.media
|
||||||
|
: Array.isArray(step?.media)
|
||||||
|
? step.media
|
||||||
|
: [];
|
||||||
|
const hasMedia = mediaArr.length > 0;
|
||||||
|
if (!cleaned) {
|
||||||
|
return hasMedia ? '[图片/附件提问]' : '';
|
||||||
|
}
|
||||||
|
const withMedia = hasMedia ? `${cleaned} [附图]` : cleaned;
|
||||||
|
return withMedia.length > 180 ? `${withMedia.slice(0, 179)}…` : withMedia;
|
||||||
|
};
|
||||||
|
|
||||||
rawSteps.forEach((s, index) => {
|
rawSteps.forEach((s, index) => {
|
||||||
|
if (isUserTurnBoundary(s)) {
|
||||||
|
const promptText = extractUserTurnPrompt(s);
|
||||||
|
if (!hasUnconsumedTurn) {
|
||||||
|
hasUnconsumedTurn = true;
|
||||||
|
pendingTurnPrompts = promptText ? [promptText] : [];
|
||||||
|
} else if (
|
||||||
|
promptText &&
|
||||||
|
pendingTurnPrompts[pendingTurnPrompts.length - 1] !== promptText
|
||||||
|
) {
|
||||||
|
pendingTurnPrompts.push(promptText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const m = s?.metadata;
|
const m = s?.metadata;
|
||||||
const u = m?.modelUsage || m?.retryInfos?.[0]?.usage;
|
const u = m?.modelUsage || m?.retryInfos?.[0]?.usage;
|
||||||
if (!u) {
|
if (!u) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let stepIsTurnStart = false;
|
||||||
|
let stepTurnPrompt = '';
|
||||||
|
if (hasUnconsumedTurn) {
|
||||||
|
turnCounter += 1;
|
||||||
|
activeTurnIndex = turnCounter;
|
||||||
|
stepIsTurnStart = true;
|
||||||
|
const joinedPrompt = pendingTurnPrompts.join('\n').trim();
|
||||||
|
stepTurnPrompt =
|
||||||
|
joinedPrompt.length > 180 ? `${joinedPrompt.slice(0, 179)}…` : joinedPrompt;
|
||||||
|
hasUnconsumedTurn = false;
|
||||||
|
pendingTurnPrompts = [];
|
||||||
|
}
|
||||||
|
|
||||||
const stepIndex = m.sourceTrajectoryStepInfo?.stepIndex ?? index;
|
const stepIndex = m.sourceTrajectoryStepInfo?.stepIndex ?? index;
|
||||||
if (Array.isArray(m.generatorMetadata)) {
|
if (Array.isArray(m.generatorMetadata)) {
|
||||||
for (const g of m.generatorMetadata) {
|
for (const g of m.generatorMetadata) {
|
||||||
@@ -781,6 +858,9 @@ export function extractModelSteps(rawSteps = [], generatorMetadata = []) {
|
|||||||
speedSampleEligible:
|
speedSampleEligible:
|
||||||
totalTokPerSec !== null && !shortOutputSample && !isCompactionStep,
|
totalTokPerSec !== null && !shortOutputSample && !isCompactionStep,
|
||||||
speedReason,
|
speedReason,
|
||||||
|
turnIndex: activeTurnIndex,
|
||||||
|
isTurnStart: stepIsTurnStart,
|
||||||
|
...(stepIsTurnStart && stepTurnPrompt ? { turnPrompt: stepTurnPrompt } : {}),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -257,10 +257,12 @@ export const I18N_MESSAGES_EN_US = Object.freeze({
|
|||||||
'steps.modelSplitFoot': 'In {inTok} · Cache {cacheTok} · Think {thinkTok} · Out {respTok}',
|
'steps.modelSplitFoot': 'In {inTok} · Cache {cacheTok} · Think {thinkTok} · Out {respTok}',
|
||||||
'steps.fitActiveCardTitle': '{title} (Active in Trend Fit; Ctrl/Shift-click to compare)',
|
'steps.fitActiveCardTitle': '{title} (Active in Trend Fit; Ctrl/Shift-click to compare)',
|
||||||
'steps.fitInactiveCardTitle': 'Click to inspect {text} in Trend Fit (Ctrl/Shift-click to compare)',
|
'steps.fitInactiveCardTitle': 'Click to inspect {text} in Trend Fit (Ctrl/Shift-click to compare)',
|
||||||
|
'steps.turnMediaOnly': '[Media Attachment]',
|
||||||
|
'steps.turnMediaSuffix': '[Media]',
|
||||||
|
|
||||||
// Step Table Columns (Headers & Option Labels)
|
// Step Table Columns (Headers & Option Labels)
|
||||||
'stepCol.step.th': 'Step',
|
'stepCol.step.th': 'Step',
|
||||||
'stepCol.step.opt': 'Step & Agent',
|
'stepCol.step.opt': 'Step Number (#)',
|
||||||
'stepCol.time.th': 'Time',
|
'stepCol.time.th': 'Time',
|
||||||
'stepCol.time.opt': 'Timestamp (HH:mm:ss)',
|
'stepCol.time.opt': 'Timestamp (HH:mm:ss)',
|
||||||
'stepCol.model.th': 'Model',
|
'stepCol.model.th': 'Model',
|
||||||
@@ -423,6 +425,8 @@ export const I18N_MESSAGES_EN_US = Object.freeze({
|
|||||||
'settings.str.addOverviewMetric': 'Add Metric ({count}/{max})',
|
'settings.str.addOverviewMetric': 'Add Metric ({count}/{max})',
|
||||||
'settings.str.stepsSection': 'Step Table Columns',
|
'settings.str.stepsSection': 'Step Table Columns',
|
||||||
'settings.str.stepsBadge': '{count} cols',
|
'settings.str.stepsBadge': '{count} cols',
|
||||||
|
'settings.str.stepTurnRailToggle': 'Turn Rail & Preview',
|
||||||
|
'settings.str.stepAgentBadgeToggle': 'Main/Sub Agent Badge',
|
||||||
'settings.str.stepsColsLabel': '"Steps" Visible Columns (Left → Right, min 2)',
|
'settings.str.stepsColsLabel': '"Steps" Visible Columns (Left → Right, min 2)',
|
||||||
'settings.str.addStepCol': 'Add Column ({count}/{max})',
|
'settings.str.addStepCol': 'Add Column ({count}/{max})',
|
||||||
'settings.slot.moveUp': 'Move earlier',
|
'settings.slot.moveUp': 'Move earlier',
|
||||||
|
|||||||
@@ -257,10 +257,12 @@ export const I18N_MESSAGES_ZH_CN = Object.freeze({
|
|||||||
'steps.modelSplitFoot': '入 {inTok} · 缓 {cacheTok} · 思 {thinkTok} · 正 {respTok}',
|
'steps.modelSplitFoot': '入 {inTok} · 缓 {cacheTok} · 思 {thinkTok} · 正 {respTok}',
|
||||||
'steps.fitActiveCardTitle': '{title}(已纳入上方趋势拟合,按住 Ctrl/Shift 点击可多选对比)',
|
'steps.fitActiveCardTitle': '{title}(已纳入上方趋势拟合,按住 Ctrl/Shift 点击可多选对比)',
|
||||||
'steps.fitInactiveCardTitle': '点击在上方拟合图查看 {text}(按住 Ctrl/Shift 点击可多选同图对比)',
|
'steps.fitInactiveCardTitle': '点击在上方拟合图查看 {text}(按住 Ctrl/Shift 点击可多选同图对比)',
|
||||||
|
'steps.turnMediaOnly': '[图片/附件提问]',
|
||||||
|
'steps.turnMediaSuffix': '[附图]',
|
||||||
|
|
||||||
// Step Table Columns (Headers & Option Labels)
|
// Step Table Columns (Headers & Option Labels)
|
||||||
'stepCol.step.th': '步序',
|
'stepCol.step.th': '步序',
|
||||||
'stepCol.step.opt': '步序与代理',
|
'stepCol.step.opt': '调用步序 (#)',
|
||||||
'stepCol.time.th': '时间',
|
'stepCol.time.th': '时间',
|
||||||
'stepCol.time.opt': '调用时间 (HH:mm:ss)',
|
'stepCol.time.opt': '调用时间 (HH:mm:ss)',
|
||||||
'stepCol.model.th': '模型',
|
'stepCol.model.th': '模型',
|
||||||
@@ -423,6 +425,8 @@ export const I18N_MESSAGES_ZH_CN = Object.freeze({
|
|||||||
'settings.str.addOverviewMetric': '添加指标 ({count}/{max})',
|
'settings.str.addOverviewMetric': '添加指标 ({count}/{max})',
|
||||||
'settings.str.stepsSection': '调用明细字段',
|
'settings.str.stepsSection': '调用明细字段',
|
||||||
'settings.str.stepsBadge': '{count} 列',
|
'settings.str.stepsBadge': '{count} 列',
|
||||||
|
'settings.str.stepTurnRailToggle': '对话轮次导轨',
|
||||||
|
'settings.str.stepAgentBadgeToggle': '主/子代理标识',
|
||||||
'settings.str.stepsColsLabel': '「按步查看」显示列 (左 → 右,至少 2 列)',
|
'settings.str.stepsColsLabel': '「按步查看」显示列 (左 → 右,至少 2 列)',
|
||||||
'settings.str.addStepCol': '添加字段 ({count}/{max})',
|
'settings.str.addStepCol': '添加字段 ({count}/{max})',
|
||||||
'settings.slot.moveUp': '前移',
|
'settings.slot.moveUp': '前移',
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export const STEP_COLUMN_REGISTRY = Object.freeze({
|
|||||||
thLabel: () => t('stepCol.step.th'),
|
thLabel: () => t('stepCol.step.th'),
|
||||||
optLabel: () => t('stepCol.step.opt'),
|
optLabel: () => t('stepCol.step.opt'),
|
||||||
sigPart: (st, ctx) =>
|
sigPart: (st, ctx) =>
|
||||||
`${ctx.hasSubagents}:${ctx.scopeSigKey}:${st.agentId || 'main'}:${st.stepIndex}:${st.agentBadge || ''}:${st.agentLabel || ''}`,
|
`${Boolean(ctx.showAgentBadge)}:${ctx.scopeSigKey}:${st.agentId || 'main'}:${st.stepIndex}:${st.agentBadge || ''}:${st.agentLabel || ''}`,
|
||||||
createCell: () => {
|
createCell: () => {
|
||||||
const agentBadgeEl = h('span', {
|
const agentBadgeEl = h('span', {
|
||||||
className: 'agent-badge is-clickable',
|
className: 'agent-badge is-clickable',
|
||||||
@@ -75,9 +75,9 @@ export const STEP_COLUMN_REGISTRY = Object.freeze({
|
|||||||
return { td, refs: { agentBadgeEl, stepNumText } };
|
return { td, refs: { agentBadgeEl, stepNumText } };
|
||||||
},
|
},
|
||||||
updateCell: (refs, st, ctx) => {
|
updateCell: (refs, st, ctx) => {
|
||||||
const { hasSubagents, effectiveScopes, onSelectAgentScopes } = ctx;
|
const { showAgentBadge, effectiveScopes, onSelectAgentScopes } = ctx;
|
||||||
patchAttr(refs.agentBadgeEl, 'hidden', !hasSubagents);
|
patchAttr(refs.agentBadgeEl, 'hidden', !showAgentBadge);
|
||||||
if (hasSubagents) {
|
if (showAgentBadge) {
|
||||||
const badgeCls = getAgentBadgeClass(st.agentIndex || 0, !st.isSubagent);
|
const badgeCls = getAgentBadgeClass(st.agentIndex || 0, !st.isSubagent);
|
||||||
patchAttr(refs.agentBadgeEl, 'class', `agent-badge is-clickable ${badgeCls}`);
|
patchAttr(refs.agentBadgeEl, 'class', `agent-badge is-clickable ${badgeCls}`);
|
||||||
const badgeText = isEnglishLocale()
|
const badgeText = isEnglishLocale()
|
||||||
@@ -117,6 +117,8 @@ export const STEP_COLUMN_REGISTRY = Object.freeze({
|
|||||||
onSelectAgentScopes(isSoleTarget ? ['all'] : [targetScope]);
|
onSelectAgentScopes(isSoleTarget ? ['all'] : [targetScope]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
refs.agentBadgeEl.onclick = null;
|
||||||
}
|
}
|
||||||
patchText(refs.stepNumText, `#${Number(st.stepIndex)}`);
|
patchText(refs.stepNumText, `#${Number(st.stepIndex)}`);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -381,6 +381,12 @@ function isEquivalentTelemetry(prev, next) {
|
|||||||
if ((pSet?.showTopbarMultiSession !== false) !== (nSet?.showTopbarMultiSession !== false)) {
|
if ((pSet?.showTopbarMultiSession !== false) !== (nSet?.showTopbarMultiSession !== false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if ((pSet?.showStepTurnRail !== false) !== (nSet?.showStepTurnRail !== false)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((pSet?.showStepAgentBadge !== false) !== (nSet?.showStepAgentBadge !== false)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!sameArr(pSet?.topbarCapsuleSlots, nSet?.topbarCapsuleSlots)) return false;
|
if (!sameArr(pSet?.topbarCapsuleSlots, nSet?.topbarCapsuleSlots)) return false;
|
||||||
if (!sameArr(pSet?.hoverModules, nSet?.hoverModules)) return false;
|
if (!sameArr(pSet?.hoverModules, nSet?.hoverModules)) return false;
|
||||||
if (!sameArr(pSet?.overviewModules, nSet?.overviewModules)) return false;
|
if (!sameArr(pSet?.overviewModules, nSet?.overviewModules)) return false;
|
||||||
@@ -547,7 +553,13 @@ function isEquivalentTelemetry(prev, next) {
|
|||||||
bs?.cacheReadTokens !== as?.cacheReadTokens ||
|
bs?.cacheReadTokens !== as?.cacheReadTokens ||
|
||||||
bs?.contextTokens !== as?.contextTokens ||
|
bs?.contextTokens !== as?.contextTokens ||
|
||||||
bs?.cacheHitPct !== as?.cacheHitPct ||
|
bs?.cacheHitPct !== as?.cacheHitPct ||
|
||||||
bs?.selectedSpeedReason !== as?.selectedSpeedReason
|
bs?.selectedSpeedReason !== as?.selectedSpeedReason ||
|
||||||
|
bs?.turnIndex !== as?.turnIndex ||
|
||||||
|
bs?.rootTurnIndex !== as?.rootTurnIndex ||
|
||||||
|
bs?.isTurnStart !== as?.isTurnStart ||
|
||||||
|
bs?.isRootTurnStart !== as?.isRootTurnStart ||
|
||||||
|
bs?.turnPrompt !== as?.turnPrompt ||
|
||||||
|
bs?.rootTurnPrompt !== as?.rootTurnPrompt
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -594,7 +606,13 @@ function isEquivalentTelemetry(prev, next) {
|
|||||||
before.cacheReadTokens !== after.cacheReadTokens ||
|
before.cacheReadTokens !== after.cacheReadTokens ||
|
||||||
before.contextTokens !== after.contextTokens ||
|
before.contextTokens !== after.contextTokens ||
|
||||||
before.cacheHitPct !== after.cacheHitPct ||
|
before.cacheHitPct !== after.cacheHitPct ||
|
||||||
before.selectedSpeedReason !== after.selectedSpeedReason
|
before.selectedSpeedReason !== after.selectedSpeedReason ||
|
||||||
|
before.turnIndex !== after.turnIndex ||
|
||||||
|
before.rootTurnIndex !== after.rootTurnIndex ||
|
||||||
|
before.isTurnStart !== after.isTurnStart ||
|
||||||
|
before.isRootTurnStart !== after.isRootTurnStart ||
|
||||||
|
before.turnPrompt !== after.turnPrompt ||
|
||||||
|
before.rootTurnPrompt !== after.rootTurnPrompt
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -938,6 +956,12 @@ export async function saveSettingsPatch(patch) {
|
|||||||
if (Object.prototype.hasOwnProperty.call(safePatch, 'showTopbarMultiSession')) {
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'showTopbarMultiSession')) {
|
||||||
safePatch.showTopbarMultiSession = Boolean(safePatch.showTopbarMultiSession);
|
safePatch.showTopbarMultiSession = Boolean(safePatch.showTopbarMultiSession);
|
||||||
}
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'showStepTurnRail')) {
|
||||||
|
safePatch.showStepTurnRail = Boolean(safePatch.showStepTurnRail);
|
||||||
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'showStepAgentBadge')) {
|
||||||
|
safePatch.showStepAgentBadge = Boolean(safePatch.showStepAgentBadge);
|
||||||
|
}
|
||||||
if (Object.prototype.hasOwnProperty.call(safePatch, 'topbarCapsuleSlots')) {
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'topbarCapsuleSlots')) {
|
||||||
safePatch.topbarCapsuleSlots = normalizeClientTopbarSlots(safePatch.topbarCapsuleSlots);
|
safePatch.topbarCapsuleSlots = normalizeClientTopbarSlots(safePatch.topbarCapsuleSlots);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,115 @@
|
|||||||
background: var(--surface-subtle);
|
background: var(--surface-subtle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- 2.5 极简对话轮次导轨与起点圆点 (Minimalist Turn Rail & Prompt Preview) --- */
|
||||||
|
.steps-data-table.has-turn-rail th:first-child,
|
||||||
|
.steps-data-table.has-turn-rail td:first-child {
|
||||||
|
padding-left: 17px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps-data-table td:first-child {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail {
|
||||||
|
--rail-line: color-mix(in srgb, var(--text-secondary) 28%, var(--border-hairline));
|
||||||
|
--rail-dot: color-mix(in srgb, var(--accent-primary) 52%, var(--text-secondary));
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: -1px;
|
||||||
|
left: 5px;
|
||||||
|
width: 8px;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail.is-latest {
|
||||||
|
--rail-line: color-mix(in srgb, var(--accent-primary) 62%, var(--surface-panel));
|
||||||
|
--rail-dot: var(--accent-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps-data-table tbody tr:hover .turn-rail {
|
||||||
|
--rail-line: color-mix(in srgb, var(--accent-primary) 78%, var(--surface-panel));
|
||||||
|
--rail-dot: var(--accent-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail-line {
|
||||||
|
position: absolute;
|
||||||
|
left: 3.25px;
|
||||||
|
width: 1.5px;
|
||||||
|
background: var(--rail-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail.has-up.has-down .turn-rail-line {
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail.has-up:not(.has-down) .turn-rail-line {
|
||||||
|
top: 0;
|
||||||
|
bottom: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail.has-down:not(.has-up) .turn-rail-line {
|
||||||
|
top: 50%;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail-dot {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 4px;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
border-radius: var(--radius-pill);
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail-dot.is-cap {
|
||||||
|
width: 3.5px;
|
||||||
|
height: 3.5px;
|
||||||
|
background: var(--rail-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail-dot.is-origin {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
background: var(--surface-panel);
|
||||||
|
border: 1.5px solid var(--rail-dot);
|
||||||
|
box-shadow: 0 0 0 1px var(--surface-panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail.is-latest .turn-rail-dot.is-origin {
|
||||||
|
background: var(--rail-dot);
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail[hidden],
|
||||||
|
.turn-rail-line[hidden],
|
||||||
|
.turn-rail-dot[hidden],
|
||||||
|
.turn-prompt-tip[hidden] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 极简紧凑提问文本悬停预览气泡 */
|
||||||
|
.turn-prompt-tip {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 45;
|
||||||
|
max-width: min(286px, calc(100% - 16px));
|
||||||
|
padding: 5px 8px;
|
||||||
|
font-size: var(--fs-sm);
|
||||||
|
line-height: 1.42;
|
||||||
|
color: var(--text-primary);
|
||||||
|
background: var(--surface-panel);
|
||||||
|
border: 1px solid var(--border-strong);
|
||||||
|
border-radius: var(--radius-xs);
|
||||||
|
box-shadow: var(--shadow-popover);
|
||||||
|
white-space: pre-line;
|
||||||
|
word-break: break-word;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 3;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
animation: anim-popover-in var(--dur-instant) var(--ease-fast);
|
||||||
|
}
|
||||||
|
|
||||||
/* --- 3. 按模型汇总分析视图:双趋势图与极简模型总览 (Models Analytics Pane) --- */
|
/* --- 3. 按模型汇总分析视图:双趋势图与极简模型总览 (Models Analytics Pane) --- */
|
||||||
.models-analytics-pane {
|
.models-analytics-pane {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import {
|
|||||||
resolveModelDisplayInfo,
|
resolveModelDisplayInfo,
|
||||||
} from '../core/formatters.js';
|
} from '../core/formatters.js';
|
||||||
import { createSvgIcon } from '../icons/SvgIcon.js';
|
import { createSvgIcon } from '../icons/SvgIcon.js';
|
||||||
import { getEffectiveLocale, i18nStore, t } from '../i18n/index.js';
|
import { getEffectiveLocale, i18nStore, isEnglishLocale, t } from '../i18n/index.js';
|
||||||
import {
|
import {
|
||||||
DEFAULT_STEP_COLUMN_KEYS,
|
DEFAULT_STEP_COLUMN_KEYS,
|
||||||
STEP_COLUMN_REGISTRY,
|
STEP_COLUMN_REGISTRY,
|
||||||
@@ -191,6 +191,16 @@ function getFitMetricSwitchOptions() {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatTurnPromptText(rawPrompt) {
|
||||||
|
const text = String(rawPrompt || '').trim();
|
||||||
|
if (!text || !isEnglishLocale()) return text;
|
||||||
|
if (text === '[图片/附件提问]') return t('steps.turnMediaOnly');
|
||||||
|
if (text.endsWith(' [附图]')) {
|
||||||
|
return `${text.slice(0, -5)} ${t('steps.turnMediaSuffix')}`;
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
export const StepsDetailView = defineComponent({
|
export const StepsDetailView = defineComponent({
|
||||||
name: 'StepsDetailView',
|
name: 'StepsDetailView',
|
||||||
setup({ onCleanup }) {
|
setup({ onCleanup }) {
|
||||||
@@ -282,17 +292,57 @@ export const StepsDetailView = defineComponent({
|
|||||||
|
|
||||||
syncTableHeaderColumns(DEFAULT_STEP_COLUMN_KEYS);
|
syncTableHeaderColumns(DEFAULT_STEP_COLUMN_KEYS);
|
||||||
|
|
||||||
const stepsTablePane = h('div', { className: 'table-viewport is-step-table' }, [
|
const stepsTableEl = h('table', { className: 'data-table steps-data-table' }, [
|
||||||
h('table', { className: 'data-table' }, [
|
|
||||||
h('thead', {}, [stepsTheadRow]),
|
h('thead', {}, [stepsTheadRow]),
|
||||||
stepsTbody,
|
stepsTbody,
|
||||||
]),
|
|
||||||
]);
|
]);
|
||||||
|
const stepsTablePane = h('div', { className: 'table-viewport is-step-table' }, [stepsTableEl]);
|
||||||
const stepsScroll = CustomScrollbar({
|
const stepsScroll = CustomScrollbar({
|
||||||
contentEl: stepsTablePane,
|
contentEl: stepsTablePane,
|
||||||
className: 'table-scroll-host',
|
className: 'table-scroll-host',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const turnTipEl = h('div', {
|
||||||
|
className: 'turn-prompt-tip',
|
||||||
|
role: 'tooltip',
|
||||||
|
hidden: true,
|
||||||
|
});
|
||||||
|
const hideTurnTip = () => patchAttr(turnTipEl, 'hidden', true);
|
||||||
|
|
||||||
|
function showTurnTip(anchorCell, promptText) {
|
||||||
|
const text = String(promptText || '').trim();
|
||||||
|
if (!anchorCell || !text) {
|
||||||
|
hideTurnTip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
patchText(turnTipEl, text);
|
||||||
|
patchAttr(turnTipEl, 'hidden', false);
|
||||||
|
if (
|
||||||
|
typeof panelEl.getBoundingClientRect === 'function' &&
|
||||||
|
typeof anchorCell.getBoundingClientRect === 'function'
|
||||||
|
) {
|
||||||
|
const panelRect = panelEl.getBoundingClientRect();
|
||||||
|
const cellRect = anchorCell.getBoundingClientRect();
|
||||||
|
if (panelRect.width > 0 && panelRect.height > 0) {
|
||||||
|
const tipH = turnTipEl.offsetHeight || 36;
|
||||||
|
const tipW = turnTipEl.offsetWidth || 180;
|
||||||
|
const placeAbove =
|
||||||
|
panelRect.bottom - cellRect.bottom < tipH + 10 &&
|
||||||
|
cellRect.top - panelRect.top > tipH + 6;
|
||||||
|
const topPx = placeAbove
|
||||||
|
? Math.max(4, Math.round(cellRect.top - panelRect.top - tipH - 4))
|
||||||
|
: Math.round(cellRect.bottom - panelRect.top + 4);
|
||||||
|
const maxLeft = Math.max(6, Math.round(panelRect.width - tipW - 8));
|
||||||
|
const leftPx = Math.min(
|
||||||
|
maxLeft,
|
||||||
|
Math.max(6, Math.round(cellRect.left - panelRect.left + 4))
|
||||||
|
);
|
||||||
|
turnTipEl.style.top = `${topPx}px`;
|
||||||
|
turnTipEl.style.left = `${leftPx}px`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- 子视图 2:总汇总分析面板 ---
|
// --- 子视图 2:总汇总分析面板 ---
|
||||||
let selectedLineMetric = 'totalTokens';
|
let selectedLineMetric = 'totalTokens';
|
||||||
let selectedFitMetric = 'tps';
|
let selectedFitMetric = 'tps';
|
||||||
@@ -422,7 +472,7 @@ export const StepsDetailView = defineComponent({
|
|||||||
'section',
|
'section',
|
||||||
{
|
{
|
||||||
className: 'panel',
|
className: 'panel',
|
||||||
style: 'flex: 1; min-height: 0; display: flex; flex-direction: column;',
|
style: 'flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative;',
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
h('div', { className: 'panel-header steps-panel-header' }, [
|
h('div', { className: 'panel-header steps-panel-header' }, [
|
||||||
@@ -438,8 +488,11 @@ export const StepsDetailView = defineComponent({
|
|||||||
]),
|
]),
|
||||||
stepsScroll.el,
|
stepsScroll.el,
|
||||||
modelsScroll.el,
|
modelsScroll.el,
|
||||||
|
turnTipEl,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
stepsTablePane.addEventListener('scroll', hideTurnTip);
|
||||||
|
stepsTbody.addEventListener('mouseleave', hideTurnTip);
|
||||||
|
|
||||||
const rootEl = h('div', { className: 'view-pane' }, [panelEl]);
|
const rootEl = h('div', { className: 'view-pane' }, [panelEl]);
|
||||||
|
|
||||||
@@ -515,42 +568,111 @@ export const StepsDetailView = defineComponent({
|
|||||||
function renderStepTable(tableSteps, cascadeId, colKeys, locale, {
|
function renderStepTable(tableSteps, cascadeId, colKeys, locale, {
|
||||||
effectiveScopes,
|
effectiveScopes,
|
||||||
hasSubagents,
|
hasSubagents,
|
||||||
|
isMergedMultiAgents,
|
||||||
|
showStepTurnRail,
|
||||||
|
showStepAgentBadge,
|
||||||
displaySettings,
|
displaySettings,
|
||||||
}) {
|
}) {
|
||||||
const colOrderSig = colKeys.join(',');
|
const colOrderSig = colKeys.join(',');
|
||||||
const wantedSet = new Set(colKeys);
|
const wantedSet = new Set(colKeys);
|
||||||
syncTableHeaderColumns(colKeys);
|
syncTableHeaderColumns(colKeys);
|
||||||
|
|
||||||
|
const showAgentBadge = Boolean(hasSubagents && showStepAgentBadge);
|
||||||
const cellCtx = {
|
const cellCtx = {
|
||||||
hasSubagents,
|
hasSubagents,
|
||||||
|
showAgentBadge,
|
||||||
effectiveScopes,
|
effectiveScopes,
|
||||||
scopeSigKey: effectiveScopes.join(','),
|
scopeSigKey: effectiveScopes.join(','),
|
||||||
displaySettings,
|
displaySettings,
|
||||||
onSelectAgentScopes: applyAgentScopesSelection,
|
onSelectAgentScopes: applyAgentScopesSelection,
|
||||||
};
|
};
|
||||||
|
|
||||||
patchKeyedList(stepsTbody, tableSteps, {
|
const useRootTurn = Boolean(hasSubagents && isMergedMultiAgents);
|
||||||
keyFn: (st) => `${st.agentCascadeId || cascadeId || 'conv'}-${st.stepIndex}`,
|
const getStepTurnIdx = (st) =>
|
||||||
sigFn: (st) => {
|
useRootTurn ? (st?.rootTurnIndex ?? st?.turnIndex) : st?.turnIndex;
|
||||||
|
const getStepIsStart = (st) =>
|
||||||
|
Boolean(useRootTurn ? (st?.isRootTurnStart ?? st?.isTurnStart) : st?.isTurnStart);
|
||||||
|
const getStepIsLatest = (st) =>
|
||||||
|
Boolean(useRootTurn ? (st?.isRootLatestTurn ?? st?.isLatestTurn) : st?.isLatestTurn);
|
||||||
|
const getStepPrompt = (st) =>
|
||||||
|
(useRootTurn ? (st?.rootTurnPrompt ?? st?.turnPrompt) : st?.turnPrompt) || '';
|
||||||
|
const turnKeyOf = (st) => {
|
||||||
|
if (!showStepTurnRail) return '';
|
||||||
|
const tIdx = getStepTurnIdx(st);
|
||||||
|
if (!Number.isInteger(tIdx) || tIdx <= 0) return '';
|
||||||
|
return useRootTurn ? `root:${tIdx}` : `${st?.agentId || 'main'}:${tIdx}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const decoratedSteps = tableSteps.map((st, idx) => {
|
||||||
|
const tKey = turnKeyOf(st);
|
||||||
|
const hasTurn = Boolean(tKey);
|
||||||
|
const hasUp = Boolean(hasTurn && idx > 0 && turnKeyOf(tableSteps[idx - 1]) === tKey);
|
||||||
|
const hasDown = Boolean(
|
||||||
|
hasTurn && idx + 1 < tableSteps.length && turnKeyOf(tableSteps[idx + 1]) === tKey
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
st,
|
||||||
|
rowKey: `${st.agentCascadeId || cascadeId || 'conv'}-${st.stepIndex}`,
|
||||||
|
hasTurn,
|
||||||
|
hasUp,
|
||||||
|
hasDown,
|
||||||
|
isStart: Boolean(hasTurn && (getStepIsStart(st) || !hasDown)),
|
||||||
|
isLatest: hasTurn && getStepIsLatest(st),
|
||||||
|
prompt: hasTurn ? formatTurnPromptText(getStepPrompt(st)) : '',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const railActive = Boolean(showStepTurnRail && decoratedSteps.some((d) => d.hasTurn));
|
||||||
|
if (!railActive) {
|
||||||
|
hideTurnTip();
|
||||||
|
}
|
||||||
|
patchClasses(stepsTableEl, { 'has-turn-rail': railActive });
|
||||||
|
|
||||||
|
patchKeyedList(stepsTbody, decoratedSteps, {
|
||||||
|
keyFn: (item) => item.rowKey,
|
||||||
|
sigFn: (item) => {
|
||||||
|
const { st } = item;
|
||||||
const parts = colKeys
|
const parts = colKeys
|
||||||
.map((colKey) => STEP_COLUMN_REGISTRY[colKey].sigPart(st, cellCtx))
|
.map((colKey) => STEP_COLUMN_REGISTRY[colKey].sigPart(st, cellCtx))
|
||||||
.join('|');
|
.join('|');
|
||||||
return `${locale}:${colOrderSig}:${parts}`;
|
return `${locale}:${colOrderSig}:${railActive}:${item.hasTurn}:${item.hasUp}:${item.hasDown}:${item.isStart}:${item.isLatest}:${item.prompt}:${parts}`;
|
||||||
},
|
},
|
||||||
createRow: () => {
|
createRow: () => {
|
||||||
const tr = h('tr');
|
const tr = h('tr');
|
||||||
|
const railLineEl = h('span', { className: 'turn-rail-line', hidden: true });
|
||||||
|
const railDotEl = h('span', { className: 'turn-rail-dot', hidden: true });
|
||||||
|
const railEl = h(
|
||||||
|
'span',
|
||||||
|
{ className: 'turn-rail', 'aria-hidden': 'true', hidden: true },
|
||||||
|
[railLineEl, railDotEl]
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
el: tr,
|
el: tr,
|
||||||
refs: {
|
refs: {
|
||||||
cellMap: new Map(),
|
cellMap: new Map(),
|
||||||
colOrderSig: '',
|
colOrderSig: '',
|
||||||
|
railEl,
|
||||||
|
railLineEl,
|
||||||
|
railDotEl,
|
||||||
|
hoverTd: null,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
updateRow: (refs, st, _idx, tr) => {
|
updateRow: (refs, item, _idx, tr) => {
|
||||||
|
const { st, hasTurn, hasUp, hasDown, isStart, isLatest, prompt } = item;
|
||||||
|
|
||||||
if (refs.colOrderSig !== colOrderSig) {
|
if (refs.colOrderSig !== colOrderSig) {
|
||||||
|
if (refs.hoverTd) {
|
||||||
|
refs.hoverTd.onmouseenter = null;
|
||||||
|
refs.hoverTd.onmousemove = null;
|
||||||
|
refs.hoverTd.onmouseleave = null;
|
||||||
|
refs.hoverTd = null;
|
||||||
|
}
|
||||||
for (const [oldColKey, entry] of refs.cellMap) {
|
for (const [oldColKey, entry] of refs.cellMap) {
|
||||||
if (!wantedSet.has(oldColKey)) {
|
if (!wantedSet.has(oldColKey)) {
|
||||||
|
if (refs.railEl.parentNode === entry.td) {
|
||||||
|
entry.td.removeChild(refs.railEl);
|
||||||
|
}
|
||||||
tr.removeChild(entry.td);
|
tr.removeChild(entry.td);
|
||||||
refs.cellMap.delete(oldColKey);
|
refs.cellMap.delete(oldColKey);
|
||||||
}
|
}
|
||||||
@@ -573,6 +695,74 @@ export const StepsDetailView = defineComponent({
|
|||||||
const cellEntry = refs.cellMap.get(colKey);
|
const cellEntry = refs.cellMap.get(colKey);
|
||||||
STEP_COLUMN_REGISTRY[colKey].updateCell(cellEntry.refs, st, cellCtx);
|
STEP_COLUMN_REGISTRY[colKey].updateCell(cellEntry.refs, st, cellCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const firstColKey = colKeys[0];
|
||||||
|
const firstTd = firstColKey ? refs.cellMap.get(firstColKey)?.td || null : null;
|
||||||
|
if (firstTd && refs.railEl.parentNode !== firstTd) {
|
||||||
|
firstTd.insertBefore(refs.railEl, firstTd.firstChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
const showRowRail = Boolean(railActive && hasTurn && firstTd);
|
||||||
|
patchAttr(refs.railEl, 'hidden', !showRowRail);
|
||||||
|
if (showRowRail) {
|
||||||
|
patchClasses(refs.railEl, {
|
||||||
|
'is-latest': isLatest,
|
||||||
|
'has-up': hasUp,
|
||||||
|
'has-down': hasDown,
|
||||||
|
});
|
||||||
|
patchAttr(refs.railLineEl, 'hidden', !hasUp && !hasDown);
|
||||||
|
const showOrigin = isStart;
|
||||||
|
const showCap = !showOrigin && !hasUp && hasDown;
|
||||||
|
patchAttr(refs.railDotEl, 'hidden', !showOrigin && !showCap);
|
||||||
|
patchClasses(refs.railDotEl, {
|
||||||
|
'is-origin': showOrigin,
|
||||||
|
'is-cap': showCap,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const stepEntry = refs.cellMap.get('step') || null;
|
||||||
|
const targetHoverTd = stepEntry ? stepEntry.td : firstTd;
|
||||||
|
if (refs.hoverTd && refs.hoverTd !== targetHoverTd) {
|
||||||
|
refs.hoverTd.onmouseenter = null;
|
||||||
|
refs.hoverTd.onmousemove = null;
|
||||||
|
refs.hoverTd.onmouseleave = null;
|
||||||
|
}
|
||||||
|
refs.hoverTd = targetHoverTd;
|
||||||
|
|
||||||
|
if (targetHoverTd) {
|
||||||
|
if (stepEntry) {
|
||||||
|
const badgeEl = stepEntry.refs.agentBadgeEl;
|
||||||
|
targetHoverTd.onmouseenter = (ev) => {
|
||||||
|
if (!showRowRail || !prompt || ev?.target === badgeEl) {
|
||||||
|
hideTurnTip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showTurnTip(targetHoverTd, prompt);
|
||||||
|
};
|
||||||
|
targetHoverTd.onmousemove = (ev) => {
|
||||||
|
if (!showRowRail || !prompt || ev?.target === badgeEl) {
|
||||||
|
hideTurnTip();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
targetHoverTd.onmouseleave = hideTurnTip;
|
||||||
|
} else {
|
||||||
|
targetHoverTd.onmouseenter = null;
|
||||||
|
targetHoverTd.onmousemove = (ev) => {
|
||||||
|
if (!showRowRail || !prompt) {
|
||||||
|
hideTurnTip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const rect = targetHoverTd.getBoundingClientRect?.();
|
||||||
|
const relX = rect ? (ev?.clientX ?? 0) - rect.left : 0;
|
||||||
|
if (relX <= 18) {
|
||||||
|
showTurnTip(targetHoverTd, prompt);
|
||||||
|
} else {
|
||||||
|
hideTurnTip();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
targetHoverTd.onmouseleave = hideTurnTip;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -803,6 +993,9 @@ export const StepsDetailView = defineComponent({
|
|||||||
renderStepTable(tableSteps, slice.cascadeId, colKeys, locale, {
|
renderStepTable(tableSteps, slice.cascadeId, colKeys, locale, {
|
||||||
effectiveScopes,
|
effectiveScopes,
|
||||||
hasSubagents,
|
hasSubagents,
|
||||||
|
isMergedMultiAgents,
|
||||||
|
showStepTurnRail: slice.showStepTurnRail !== false,
|
||||||
|
showStepAgentBadge: slice.showStepAgentBadge !== false,
|
||||||
displaySettings,
|
displaySettings,
|
||||||
});
|
});
|
||||||
stepsScroll.refresh();
|
stepsScroll.refresh();
|
||||||
@@ -1099,6 +1292,7 @@ export const StepsDetailView = defineComponent({
|
|||||||
const unsubUi = uiStore.subscribe(
|
const unsubUi = uiStore.subscribe(
|
||||||
(st) => st.stepsSubTab,
|
(st) => st.stepsSubTab,
|
||||||
(tab) => {
|
(tab) => {
|
||||||
|
hideTurnTip();
|
||||||
subTabSwitch.setValue(tab);
|
subTabSwitch.setValue(tab);
|
||||||
patchAttr(stepsScroll.el, 'hidden', tab !== 'steps');
|
patchAttr(stepsScroll.el, 'hidden', tab !== 'steps');
|
||||||
patchAttr(modelsScroll.el, 'hidden', tab !== 'models');
|
patchAttr(modelsScroll.el, 'hidden', tab !== 'models');
|
||||||
@@ -1122,6 +1316,8 @@ export const StepsDetailView = defineComponent({
|
|||||||
orchestratorIdMode: normalizeOrchestratorIdDisplayMode(
|
orchestratorIdMode: normalizeOrchestratorIdDisplayMode(
|
||||||
st.telemetry?.settings?.orchestratorIdMode
|
st.telemetry?.settings?.orchestratorIdMode
|
||||||
),
|
),
|
||||||
|
showStepTurnRail: st.telemetry?.settings?.showStepTurnRail !== false,
|
||||||
|
showStepAgentBadge: st.telemetry?.settings?.showStepAgentBadge !== false,
|
||||||
stepTableColumns: st.telemetry?.settings?.stepTableColumns,
|
stepTableColumns: st.telemetry?.settings?.stepTableColumns,
|
||||||
}),
|
}),
|
||||||
(slice) => {
|
(slice) => {
|
||||||
@@ -1156,6 +1352,7 @@ export const StepsDetailView = defineComponent({
|
|||||||
prevScope = uiSlice.selectedAgentScope;
|
prevScope = uiSlice.selectedAgentScope;
|
||||||
prevActiveView = uiSlice.activeView;
|
prevActiveView = uiSlice.activeView;
|
||||||
if (uiSlice.activeView !== 'steps') {
|
if (uiSlice.activeView !== 'steps') {
|
||||||
|
hideTurnTip();
|
||||||
fitPinnedWhileVisible = false;
|
fitPinnedWhileVisible = false;
|
||||||
if (scopeChanged) isDirty = true;
|
if (scopeChanged) isDirty = true;
|
||||||
return;
|
return;
|
||||||
@@ -1180,6 +1377,8 @@ export const StepsDetailView = defineComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
onCleanup(() => {
|
onCleanup(() => {
|
||||||
|
stepsTablePane.removeEventListener('scroll', hideTurnTip);
|
||||||
|
stepsTbody.removeEventListener('mouseleave', hideTurnTip);
|
||||||
unsubUi();
|
unsubUi();
|
||||||
unsubTelemetry();
|
unsubTelemetry();
|
||||||
unsubView();
|
unsubView();
|
||||||
@@ -1200,8 +1399,10 @@ export const StepsDetailView = defineComponent({
|
|||||||
return {
|
return {
|
||||||
el: rootEl,
|
el: rootEl,
|
||||||
refs: {
|
refs: {
|
||||||
|
stepsTableEl,
|
||||||
stepsTheadRow,
|
stepsTheadRow,
|
||||||
stepsTbody,
|
stepsTbody,
|
||||||
|
turnTipEl,
|
||||||
modelsListEl,
|
modelsListEl,
|
||||||
inlineScopeSelect,
|
inlineScopeSelect,
|
||||||
stepsModelSelect,
|
stepsModelSelect,
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
let draftHoverModules = [...DEFAULT_CLIENT_HOVER_MODULES];
|
let draftHoverModules = [...DEFAULT_CLIENT_HOVER_MODULES];
|
||||||
let draftOverviewModules = [...DEFAULT_CLIENT_OVERVIEW_MODULES];
|
let draftOverviewModules = [...DEFAULT_CLIENT_OVERVIEW_MODULES];
|
||||||
let draftOverviewMetrics = [...DEFAULT_CLIENT_OVERVIEW_METRICS];
|
let draftOverviewMetrics = [...DEFAULT_CLIENT_OVERVIEW_METRICS];
|
||||||
|
let draftShowStepTurnRail = true;
|
||||||
|
let draftShowStepAgentBadge = true;
|
||||||
let draftStepColumns = [...DEFAULT_CLIENT_STEP_COLUMNS];
|
let draftStepColumns = [...DEFAULT_CLIENT_STEP_COLUMNS];
|
||||||
let latestSettings = null;
|
let latestSettings = null;
|
||||||
|
|
||||||
@@ -361,12 +363,46 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
overviewSection.refs.setResetDisabled(isDefault);
|
overviewSection.refs.setResetDisabled(isDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Section 4: 调用明细字段 (Step Table Columns 2..12) ---
|
// --- Section 4: 调用明细字段 (Turn Rail + Agent Badge Toggles + Step Table Columns 2..12) ---
|
||||||
|
const stepTurnRailLabelEl = h('span', {
|
||||||
|
className: 'form-label',
|
||||||
|
text: t('settings.str.stepTurnRailToggle'),
|
||||||
|
});
|
||||||
|
const stepAgentBadgeLabelEl = h('span', {
|
||||||
|
className: 'form-label',
|
||||||
|
text: t('settings.str.stepAgentBadgeToggle'),
|
||||||
|
});
|
||||||
const stepColsLabelEl = h('span', {
|
const stepColsLabelEl = h('span', {
|
||||||
className: 'form-label',
|
className: 'form-label',
|
||||||
text: t('settings.str.stepsColsLabel'),
|
text: t('settings.str.stepsColsLabel'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const stepTurnRailToggle = SegmentedControl({
|
||||||
|
ariaLabel: t('settings.str.stepTurnRailToggle'),
|
||||||
|
modelValue: 'show',
|
||||||
|
options: getMultiToggleOptions(),
|
||||||
|
onUpdateModelValue: (val) => {
|
||||||
|
draftShowStepTurnRail = val !== 'hide';
|
||||||
|
syncStepsSectionMeta();
|
||||||
|
void persistStructurePatch(stepsSection, {
|
||||||
|
showStepTurnRail: draftShowStepTurnRail,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const stepAgentBadgeToggle = SegmentedControl({
|
||||||
|
ariaLabel: t('settings.str.stepAgentBadgeToggle'),
|
||||||
|
modelValue: 'show',
|
||||||
|
options: getMultiToggleOptions(),
|
||||||
|
onUpdateModelValue: (val) => {
|
||||||
|
draftShowStepAgentBadge = val !== 'hide';
|
||||||
|
syncStepsSectionMeta();
|
||||||
|
void persistStructurePatch(stepsSection, {
|
||||||
|
showStepAgentBadge: draftShowStepAgentBadge,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const stepColumnsList = EditableSlotList({
|
const stepColumnsList = EditableSlotList({
|
||||||
items: draftStepColumns,
|
items: draftStepColumns,
|
||||||
options: getStepColumnOptions(),
|
options: getStepColumnOptions(),
|
||||||
@@ -390,26 +426,55 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
defaultExpanded: false,
|
defaultExpanded: false,
|
||||||
onToggle: () => props.onLayoutChange?.(),
|
onToggle: () => props.onLayoutChange?.(),
|
||||||
onReset: () => {
|
onReset: () => {
|
||||||
|
draftShowStepTurnRail = true;
|
||||||
|
draftShowStepAgentBadge = true;
|
||||||
draftStepColumns = [...DEFAULT_CLIENT_STEP_COLUMNS];
|
draftStepColumns = [...DEFAULT_CLIENT_STEP_COLUMNS];
|
||||||
syncStepsSectionMeta();
|
syncStepsSectionMeta();
|
||||||
props.onLayoutChange?.();
|
props.onLayoutChange?.();
|
||||||
void persistStructurePatch(
|
void persistStructurePatch(
|
||||||
stepsSection,
|
stepsSection,
|
||||||
{ stepTableColumns: [...DEFAULT_CLIENT_STEP_COLUMNS] },
|
{
|
||||||
|
showStepTurnRail: true,
|
||||||
|
showStepAgentBadge: true,
|
||||||
|
stepTableColumns: [...DEFAULT_CLIENT_STEP_COLUMNS],
|
||||||
|
},
|
||||||
'settings.resetDone'
|
'settings.resetDone'
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
children: [h('div', { className: 'form-row' }, [stepColsLabelEl, stepColumnsList.el])],
|
children: [
|
||||||
|
h('div', { className: 'settings-inline-row' }, [
|
||||||
|
stepTurnRailLabelEl,
|
||||||
|
stepTurnRailToggle.el,
|
||||||
|
]),
|
||||||
|
h('div', { className: 'settings-inline-row' }, [
|
||||||
|
stepAgentBadgeLabelEl,
|
||||||
|
stepAgentBadgeToggle.el,
|
||||||
|
]),
|
||||||
|
h('div', { className: 'settings-divider' }),
|
||||||
|
h('div', { className: 'form-row' }, [stepColsLabelEl, stepColumnsList.el]),
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
function syncStepsSectionMeta() {
|
function syncStepsSectionMeta() {
|
||||||
|
stepTurnRailToggle.setProps({
|
||||||
|
modelValue: draftShowStepTurnRail ? 'show' : 'hide',
|
||||||
|
options: getMultiToggleOptions(),
|
||||||
|
});
|
||||||
|
stepAgentBadgeToggle.setProps({
|
||||||
|
modelValue: draftShowStepAgentBadge ? 'show' : 'hide',
|
||||||
|
options: getMultiToggleOptions(),
|
||||||
|
});
|
||||||
stepColumnsList.refs.setProps({
|
stepColumnsList.refs.setProps({
|
||||||
items: draftStepColumns,
|
items: draftStepColumns,
|
||||||
options: getStepColumnOptions(),
|
options: getStepColumnOptions(),
|
||||||
addBtnTextFn: (count, max) => t('settings.str.addStepCol', { count, max }),
|
addBtnTextFn: (count, max) => t('settings.str.addStepCol', { count, max }),
|
||||||
});
|
});
|
||||||
stepsSection.refs.setBadge(t('settings.str.stepsBadge', { count: draftStepColumns.length }));
|
stepsSection.refs.setBadge(t('settings.str.stepsBadge', { count: draftStepColumns.length }));
|
||||||
stepsSection.refs.setResetDisabled(isSameList(draftStepColumns, DEFAULT_CLIENT_STEP_COLUMNS));
|
const isDefault =
|
||||||
|
draftShowStepTurnRail === true &&
|
||||||
|
draftShowStepAgentBadge === true &&
|
||||||
|
isSameList(draftStepColumns, DEFAULT_CLIENT_STEP_COLUMNS);
|
||||||
|
stepsSection.refs.setResetDisabled(isDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
const rootEl = h('div', { className: 'settings-tab-stack' }, [
|
const rootEl = h('div', { className: 'settings-tab-stack' }, [
|
||||||
@@ -431,6 +496,8 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
draftHoverModules = normalizeClientHoverModules(settings.hoverModules);
|
draftHoverModules = normalizeClientHoverModules(settings.hoverModules);
|
||||||
draftOverviewModules = normalizeClientOverviewModules(settings.overviewModules);
|
draftOverviewModules = normalizeClientOverviewModules(settings.overviewModules);
|
||||||
draftOverviewMetrics = normalizeClientOverviewMetrics(settings.overviewMetrics);
|
draftOverviewMetrics = normalizeClientOverviewMetrics(settings.overviewMetrics);
|
||||||
|
draftShowStepTurnRail = settings.showStepTurnRail !== false;
|
||||||
|
draftShowStepAgentBadge = settings.showStepAgentBadge !== false;
|
||||||
draftStepColumns = normalizeClientStepColumns(settings.stepTableColumns);
|
draftStepColumns = normalizeClientStepColumns(settings.stepTableColumns);
|
||||||
|
|
||||||
syncMountSectionMeta();
|
syncMountSectionMeta();
|
||||||
@@ -458,6 +525,8 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
|
|
||||||
stepsSection.refs.setTitle(t('settings.str.stepsSection'));
|
stepsSection.refs.setTitle(t('settings.str.stepsSection'));
|
||||||
stepsSection.refs.setResetLabel(t('settings.resetBtn'));
|
stepsSection.refs.setResetLabel(t('settings.resetBtn'));
|
||||||
|
patchText(stepTurnRailLabelEl, t('settings.str.stepTurnRailToggle'));
|
||||||
|
patchText(stepAgentBadgeLabelEl, t('settings.str.stepAgentBadgeToggle'));
|
||||||
patchText(stepColsLabelEl, t('settings.str.stepsColsLabel'));
|
patchText(stepColsLabelEl, t('settings.str.stepsColsLabel'));
|
||||||
|
|
||||||
syncMountSectionMeta();
|
syncMountSectionMeta();
|
||||||
@@ -478,6 +547,8 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
hoverModulesList.destroy();
|
hoverModulesList.destroy();
|
||||||
overviewModulesList.destroy();
|
overviewModulesList.destroy();
|
||||||
overviewMetricsList.destroy();
|
overviewMetricsList.destroy();
|
||||||
|
stepTurnRailToggle.destroy();
|
||||||
|
stepAgentBadgeToggle.destroy();
|
||||||
stepColumnsList.destroy();
|
stepColumnsList.destroy();
|
||||||
mountSection.destroy();
|
mountSection.destroy();
|
||||||
hoverSection.destroy();
|
hoverSection.destroy();
|
||||||
@@ -494,6 +565,8 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
hoverModulesList,
|
hoverModulesList,
|
||||||
overviewModulesList,
|
overviewModulesList,
|
||||||
overviewMetricsList,
|
overviewMetricsList,
|
||||||
|
stepTurnRailToggle,
|
||||||
|
stepAgentBadgeToggle,
|
||||||
stepColumnsList,
|
stepColumnsList,
|
||||||
mountSection,
|
mountSection,
|
||||||
hoverSection,
|
hoverSection,
|
||||||
|
|||||||
@@ -2609,6 +2609,115 @@ input {
|
|||||||
background: var(--surface-subtle);
|
background: var(--surface-subtle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- 2.5 极简对话轮次导轨与起点圆点 (Minimalist Turn Rail & Prompt Preview) --- */
|
||||||
|
.steps-data-table.has-turn-rail th:first-child,
|
||||||
|
.steps-data-table.has-turn-rail td:first-child {
|
||||||
|
padding-left: 17px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps-data-table td:first-child {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail {
|
||||||
|
--rail-line: color-mix(in srgb, var(--text-secondary) 28%, var(--border-hairline));
|
||||||
|
--rail-dot: color-mix(in srgb, var(--accent-primary) 52%, var(--text-secondary));
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: -1px;
|
||||||
|
left: 5px;
|
||||||
|
width: 8px;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail.is-latest {
|
||||||
|
--rail-line: color-mix(in srgb, var(--accent-primary) 62%, var(--surface-panel));
|
||||||
|
--rail-dot: var(--accent-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps-data-table tbody tr:hover .turn-rail {
|
||||||
|
--rail-line: color-mix(in srgb, var(--accent-primary) 78%, var(--surface-panel));
|
||||||
|
--rail-dot: var(--accent-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail-line {
|
||||||
|
position: absolute;
|
||||||
|
left: 3.25px;
|
||||||
|
width: 1.5px;
|
||||||
|
background: var(--rail-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail.has-up.has-down .turn-rail-line {
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail.has-up:not(.has-down) .turn-rail-line {
|
||||||
|
top: 0;
|
||||||
|
bottom: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail.has-down:not(.has-up) .turn-rail-line {
|
||||||
|
top: 50%;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail-dot {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 4px;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
border-radius: var(--radius-pill);
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail-dot.is-cap {
|
||||||
|
width: 3.5px;
|
||||||
|
height: 3.5px;
|
||||||
|
background: var(--rail-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail-dot.is-origin {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
background: var(--surface-panel);
|
||||||
|
border: 1.5px solid var(--rail-dot);
|
||||||
|
box-shadow: 0 0 0 1px var(--surface-panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail.is-latest .turn-rail-dot.is-origin {
|
||||||
|
background: var(--rail-dot);
|
||||||
|
}
|
||||||
|
|
||||||
|
.turn-rail[hidden],
|
||||||
|
.turn-rail-line[hidden],
|
||||||
|
.turn-rail-dot[hidden],
|
||||||
|
.turn-prompt-tip[hidden] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 极简紧凑提问文本悬停预览气泡 */
|
||||||
|
.turn-prompt-tip {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 45;
|
||||||
|
max-width: min(286px, calc(100% - 16px));
|
||||||
|
padding: 5px 8px;
|
||||||
|
font-size: var(--fs-sm);
|
||||||
|
line-height: 1.42;
|
||||||
|
color: var(--text-primary);
|
||||||
|
background: var(--surface-panel);
|
||||||
|
border: 1px solid var(--border-strong);
|
||||||
|
border-radius: var(--radius-xs);
|
||||||
|
box-shadow: var(--shadow-popover);
|
||||||
|
white-space: pre-line;
|
||||||
|
word-break: break-word;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 3;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
animation: anim-popover-in var(--dur-instant) var(--ease-fast);
|
||||||
|
}
|
||||||
|
|
||||||
/* --- 3. 按模型汇总分析视图:双趋势图与极简模型总览 (Models Analytics Pane) --- */
|
/* --- 3. 按模型汇总分析视图:双趋势图与极简模型总览 (Models Analytics Pane) --- */
|
||||||
.models-analytics-pane {
|
.models-analytics-pane {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -816,6 +816,8 @@ test('preferences schema defaults match pre-refactor UI, migrate legacy none slo
|
|||||||
assert.deepEqual([...def.hoverModules], ['metrics', 'context', 'quotas']);
|
assert.deepEqual([...def.hoverModules], ['metrics', 'context', 'quotas']);
|
||||||
assert.deepEqual([...def.overviewModules], ['metrics', 'context', 'quotas', 'live_tasks']);
|
assert.deepEqual([...def.overviewModules], ['metrics', 'context', 'quotas', 'live_tasks']);
|
||||||
assert.deepEqual([...def.overviewMetrics], ['tps', 'ttft', 'avg_tps', 'step_cost']);
|
assert.deepEqual([...def.overviewMetrics], ['tps', 'ttft', 'avg_tps', 'step_cost']);
|
||||||
|
assert.equal(def.showStepTurnRail, true);
|
||||||
|
assert.equal(def.showStepAgentBadge, true);
|
||||||
assert.deepEqual([...def.stepTableColumns], ['step', 'model', 'tps', 'ttft', 'tokens_combo', 'cache', 'cost']);
|
assert.deepEqual([...def.stepTableColumns], ['step', 'model', 'tps', 'ttft', 'tokens_combo', 'cache', 'cost']);
|
||||||
assert.deepEqual({ ...def.modelContextWindows }, {});
|
assert.deepEqual({ ...def.modelContextWindows }, {});
|
||||||
|
|
||||||
@@ -846,6 +848,8 @@ test('preferences schema defaults match pre-refactor UI, migrate legacy none slo
|
|||||||
hoverModules: ['metrics', 'context'],
|
hoverModules: ['metrics', 'context'],
|
||||||
overviewModules: ['quotas', 'metrics'],
|
overviewModules: ['quotas', 'metrics'],
|
||||||
overviewMetrics: ['avg_tps', 'cache_hit'],
|
overviewMetrics: ['avg_tps', 'cache_hit'],
|
||||||
|
showStepTurnRail: false,
|
||||||
|
showStepAgentBadge: false,
|
||||||
stepTableColumns: ['step', 'time', 'model', 'duration', 'input_tokens', 'output_tokens', 'cost'],
|
stepTableColumns: ['step', 'time', 'model', 'duration', 'input_tokens', 'output_tokens', 'cost'],
|
||||||
contextLimitOverrideTokens: 128000,
|
contextLimitOverrideTokens: 128000,
|
||||||
modelContextWindows: { MODEL_PLACEHOLDER_M418: '900K' },
|
modelContextWindows: { MODEL_PLACEHOLDER_M418: '900K' },
|
||||||
@@ -858,6 +862,8 @@ test('preferences schema defaults match pre-refactor UI, migrate legacy none slo
|
|||||||
assert.deepEqual([...saveRes.updated.hoverModules], ['metrics', 'context']);
|
assert.deepEqual([...saveRes.updated.hoverModules], ['metrics', 'context']);
|
||||||
assert.deepEqual([...saveRes.updated.overviewModules], ['quotas', 'metrics']);
|
assert.deepEqual([...saveRes.updated.overviewModules], ['quotas', 'metrics']);
|
||||||
assert.deepEqual([...saveRes.updated.overviewMetrics], ['avg_tps', 'cache_hit']);
|
assert.deepEqual([...saveRes.updated.overviewMetrics], ['avg_tps', 'cache_hit']);
|
||||||
|
assert.equal(saveRes.updated.showStepTurnRail, false);
|
||||||
|
assert.equal(saveRes.updated.showStepAgentBadge, false);
|
||||||
assert.equal(saveRes.updated.contextLimitOverrideTokens, undefined);
|
assert.equal(saveRes.updated.contextLimitOverrideTokens, undefined);
|
||||||
assert.deepEqual({ ...saveRes.updated.modelContextWindows }, {});
|
assert.deepEqual({ ...saveRes.updated.modelContextWindows }, {});
|
||||||
|
|
||||||
@@ -885,5 +891,71 @@ test('preferences schema defaults match pre-refactor UI, migrate legacy none slo
|
|||||||
assert.equal(resetRes.ok, true);
|
assert.equal(resetRes.ok, true);
|
||||||
assert.equal(resetRes.updated.language, 'zh-CN');
|
assert.equal(resetRes.updated.language, 'zh-CN');
|
||||||
assert.equal(resetRes.updated.themeAccent, 'host');
|
assert.equal(resetRes.updated.themeAccent, 'host');
|
||||||
|
assert.equal(resetRes.updated.showStepTurnRail, true);
|
||||||
|
assert.equal(resetRes.updated.showStepAgentBadge, true);
|
||||||
assert.deepEqual([...resetRes.updated.topbarCapsuleSlots], ['context', 'tps', 'quota_auto']);
|
assert.deepEqual([...resetRes.updated.topbarCapsuleSlots], ['context', 'tps', 'quota_auto']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('assigns unified rootTurnIndex across interleaved main and subagent steps so multi-agent turn rail never fragments', async () => {
|
||||||
|
const mkPlanner = (stepIndex, createdAt, finishedGeneratingAt) => ({
|
||||||
|
status: 'CORTEX_STEP_STATUS_DONE',
|
||||||
|
type: 'CORTEX_STEP_TYPE_PLANNER_RESPONSE',
|
||||||
|
metadata: {
|
||||||
|
sourceTrajectoryStepInfo: { stepIndex },
|
||||||
|
createdAt,
|
||||||
|
finishedGeneratingAt,
|
||||||
|
modelUsage: { model: 'MODEL_PLACEHOLDER_M429', inputTokens: '100', cacheReadTokens: '0', outputTokens: '80' },
|
||||||
|
},
|
||||||
|
plannerResponse: { response: 'ok' },
|
||||||
|
});
|
||||||
|
|
||||||
|
const h = backendHarness({
|
||||||
|
trajectories: {
|
||||||
|
'root-turn': {
|
||||||
|
trajectory: {
|
||||||
|
steps: [
|
||||||
|
{ type: 'CORTEX_STEP_TYPE_USER_INPUT', userInput: { userResponse: '第一轮设计' } },
|
||||||
|
mkPlanner(1, '2026-11-13T20:00:01Z', '2026-11-13T20:00:03Z'),
|
||||||
|
{ type: 'CORTEX_STEP_TYPE_USER_INPUT', userInput: { userResponse: '确认。设计是满意的。执行' } },
|
||||||
|
mkPlanner(3, '2026-11-13T20:33:10Z', '2026-11-13T20:33:12Z'),
|
||||||
|
mkPlanner(5, '2026-11-13T20:33:30Z', '2026-11-13T20:33:35Z'),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'sub-turn': {
|
||||||
|
trajectory: {
|
||||||
|
metadata: { parentConversationId: 'root-turn', rootConversationId: 'root-turn' },
|
||||||
|
steps: [
|
||||||
|
{ type: 'CORTEX_STEP_TYPE_USER_INPUT', userInput: { userResponse: 'Subagent internal brief' } },
|
||||||
|
mkPlanner(1, '2026-11-13T20:33:20Z', '2026-11-13T20:33:25Z'),
|
||||||
|
mkPlanner(2, '2026-11-13T20:33:40Z', '2026-11-13T20:33:45Z'),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
summaries: {
|
||||||
|
'root-turn': { stepCount: 5, lastModifiedTime: '2026-11-13T20:33:35Z', status: 'IDLE' },
|
||||||
|
'sub-turn': {
|
||||||
|
stepCount: 3,
|
||||||
|
lastModifiedTime: '2026-11-13T20:33:45Z',
|
||||||
|
status: 'IDLE',
|
||||||
|
trajectoryMetadata: { parentConversationId: 'root-turn', rootConversationId: 'root-turn' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const p = await h.buildTelemetryPayloadInternal('root-turn');
|
||||||
|
const mainSteps = p.activeConversation.recentSteps; // desc: #5 (20:33:30), #3 (20:33:10), #1 (20:00:01)
|
||||||
|
const subSteps = p.activeConversation.agents[1].recentSteps; // desc: #2 (20:33:40), #1 (20:33:20)
|
||||||
|
|
||||||
|
for (const s of [mainSteps[0], mainSteps[1], subSteps[0], subSteps[1]]) {
|
||||||
|
assert.equal(s.rootTurnIndex, 2);
|
||||||
|
assert.equal(s.isRootLatestTurn, true);
|
||||||
|
assert.equal(s.rootTurnPrompt, '确认。设计是满意的。执行');
|
||||||
|
}
|
||||||
|
assert.equal(mainSteps[1].isRootTurnStart, true);
|
||||||
|
assert.equal(mainSteps[0].isRootTurnStart, false);
|
||||||
|
assert.equal(subSteps[1].isRootTurnStart, false);
|
||||||
|
assert.equal(subSteps[1].isTurnStart, true);
|
||||||
|
assert.equal(subSteps[1].turnPrompt, 'Subagent internal brief');
|
||||||
|
});
|
||||||
|
|||||||
@@ -295,3 +295,59 @@ test('extractLiveActivity covers thinking, partial streaming tool args, multi-to
|
|||||||
assert.equal(actTranscript2.stepProgress, '2/2');
|
assert.equal(actTranscript2.stepProgress, '2/2');
|
||||||
assert.equal(actTranscript2.detail, '列出插件项目全部源文件 (Get-ChildItem -Path "f:\\ppt")');
|
assert.equal(actTranscript2.detail, '列出插件项目全部源文件 (Get-ChildItem -Path "f:\\ppt")');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('extractModelSteps tracks sequential user turns, merges consecutive prompts, marks media, and strips compaction context summaries', () => {
|
||||||
|
const mkModelStep = (stepIndex) => ({
|
||||||
|
status: 'CORTEX_STEP_STATUS_DONE',
|
||||||
|
type: 'CORTEX_STEP_TYPE_PLANNER_RESPONSE',
|
||||||
|
metadata: {
|
||||||
|
sourceTrajectoryStepInfo: { stepIndex },
|
||||||
|
createdAt: '2026-01-01T00:00:00Z',
|
||||||
|
finishedGeneratingAt: '2026-01-01T00:00:02Z',
|
||||||
|
modelUsage: { inputTokens: '100', cacheReadTokens: '200', outputTokens: '80' },
|
||||||
|
},
|
||||||
|
plannerResponse: { response: 'ok' },
|
||||||
|
});
|
||||||
|
|
||||||
|
const steps = extractModelSteps([
|
||||||
|
{
|
||||||
|
type: 'CORTEX_STEP_TYPE_USER_INPUT',
|
||||||
|
userInput: { userResponse: '第一轮提问' },
|
||||||
|
},
|
||||||
|
mkModelStep(1),
|
||||||
|
{ type: 'CORTEX_STEP_TYPE_VIEW_FILE' },
|
||||||
|
mkModelStep(3),
|
||||||
|
{
|
||||||
|
type: 'CORTEX_STEP_TYPE_USER_INPUT',
|
||||||
|
userInput: { userResponse: '取消前一句' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'CORTEX_STEP_TYPE_USER_INPUT',
|
||||||
|
userInput: { userResponse: '第二轮补充提问', media: [{}] },
|
||||||
|
},
|
||||||
|
mkModelStep(7),
|
||||||
|
{
|
||||||
|
type: 'USER_INPUT',
|
||||||
|
content:
|
||||||
|
'<CONTEXT_SUMMARY><USER_REQUEST>旧摘要文本</USER_REQUEST></CONTEXT_SUMMARY>\n<USER_REQUEST>\n 第三轮真实提问 \n</USER_REQUEST>\n<ADDITIONAL_METADATA>ignored</ADDITIONAL_METADATA>',
|
||||||
|
},
|
||||||
|
mkModelStep(9),
|
||||||
|
]);
|
||||||
|
|
||||||
|
assert.equal(steps.length, 4);
|
||||||
|
assert.equal(steps[0].turnIndex, 1);
|
||||||
|
assert.equal(steps[0].isTurnStart, true);
|
||||||
|
assert.equal(steps[0].turnPrompt, '第一轮提问');
|
||||||
|
|
||||||
|
assert.equal(steps[1].turnIndex, 1);
|
||||||
|
assert.equal(steps[1].isTurnStart, false);
|
||||||
|
assert.equal(steps[1].turnPrompt, undefined);
|
||||||
|
|
||||||
|
assert.equal(steps[2].turnIndex, 2);
|
||||||
|
assert.equal(steps[2].isTurnStart, true);
|
||||||
|
assert.equal(steps[2].turnPrompt, '取消前一句\n第二轮补充提问 [附图]');
|
||||||
|
|
||||||
|
assert.equal(steps[3].turnIndex, 3);
|
||||||
|
assert.equal(steps[3].isTurnStart, true);
|
||||||
|
assert.equal(steps[3].turnPrompt, '第三轮真实提问');
|
||||||
|
});
|
||||||
|
|||||||
@@ -763,6 +763,8 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
overviewModules: ['metrics', 'context', 'quotas', 'live_tasks'],
|
overviewModules: ['metrics', 'context', 'quotas', 'live_tasks'],
|
||||||
overviewMetrics: ['tps', 'ttft', 'avg_tps', 'step_cost'],
|
overviewMetrics: ['tps', 'ttft', 'avg_tps', 'step_cost'],
|
||||||
stepTableColumns: ['step', 'model', 'tps', 'ttft', 'tokens_combo', 'cache', 'cost'],
|
stepTableColumns: ['step', 'model', 'tps', 'ttft', 'tokens_combo', 'cache', 'cost'],
|
||||||
|
showStepTurnRail: true,
|
||||||
|
showStepAgentBadge: true,
|
||||||
showUpstreamModel: false,
|
showUpstreamModel: false,
|
||||||
orchestratorIdMode: 'compact',
|
orchestratorIdMode: 'compact',
|
||||||
weeklyLimitMode: 'official',
|
weeklyLimitMode: 'official',
|
||||||
@@ -968,6 +970,14 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
{
|
{
|
||||||
stepIndex: 35,
|
stepIndex: 35,
|
||||||
createdAtMs: 2000,
|
createdAtMs: 2000,
|
||||||
|
turnIndex: 1,
|
||||||
|
isTurnStart: false,
|
||||||
|
isLatestTurn: true,
|
||||||
|
turnPrompt: '请优化调用明细与轮次导轨',
|
||||||
|
rootTurnIndex: 1,
|
||||||
|
isRootTurnStart: false,
|
||||||
|
isRootLatestTurn: true,
|
||||||
|
rootTurnPrompt: '请优化调用明细与轮次导轨',
|
||||||
modelLabel: 'Gemini 4 Hydrogen',
|
modelLabel: 'Gemini 4 Hydrogen',
|
||||||
modelShort: 'gemini-4-hydrogen',
|
modelShort: 'gemini-4-hydrogen',
|
||||||
modelUpstream: 'gemini-4-hydrogen',
|
modelUpstream: 'gemini-4-hydrogen',
|
||||||
@@ -985,6 +995,14 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
{
|
{
|
||||||
stepIndex: 20,
|
stepIndex: 20,
|
||||||
createdAtMs: 1000,
|
createdAtMs: 1000,
|
||||||
|
turnIndex: 1,
|
||||||
|
isTurnStart: true,
|
||||||
|
isLatestTurn: true,
|
||||||
|
turnPrompt: '请优化调用明细与轮次导轨',
|
||||||
|
rootTurnIndex: 1,
|
||||||
|
isRootTurnStart: true,
|
||||||
|
isRootLatestTurn: true,
|
||||||
|
rootTurnPrompt: '请优化调用明细与轮次导轨',
|
||||||
modelLabel: 'Claude Opus 4.6',
|
modelLabel: 'Claude Opus 4.6',
|
||||||
modelShort: 'claude-opus-4.6',
|
modelShort: 'claude-opus-4.6',
|
||||||
modelUpstream: 'claude-opus-4-6',
|
modelUpstream: 'claude-opus-4-6',
|
||||||
@@ -1068,6 +1086,14 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
isSubagent: true,
|
isSubagent: true,
|
||||||
stepIndex: 4,
|
stepIndex: 4,
|
||||||
createdAtMs: 3500,
|
createdAtMs: 3500,
|
||||||
|
turnIndex: 1,
|
||||||
|
isTurnStart: true,
|
||||||
|
isLatestTurn: true,
|
||||||
|
turnPrompt: '审计子代理任务',
|
||||||
|
rootTurnIndex: 1,
|
||||||
|
isRootTurnStart: false,
|
||||||
|
isRootLatestTurn: true,
|
||||||
|
rootTurnPrompt: '请优化调用明细与轮次导轨',
|
||||||
modelLabel: 'Gemini 3 Flash',
|
modelLabel: 'Gemini 3 Flash',
|
||||||
modelShort: 'gemini-3-flash',
|
modelShort: 'gemini-3-flash',
|
||||||
modelUpstream: 'gemini-3-flash',
|
modelUpstream: 'gemini-3-flash',
|
||||||
@@ -1138,6 +1164,12 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
stepCount: 2,
|
stepCount: 2,
|
||||||
activeModelLabel: 'Gemini 4 Hydrogen',
|
activeModelLabel: 'Gemini 4 Hydrogen',
|
||||||
activeModelShort: 'gemini-4-hydrogen',
|
activeModelShort: 'gemini-4-hydrogen',
|
||||||
|
recentSteps: mainSteps.map((s) => ({
|
||||||
|
...s,
|
||||||
|
agentId: 'main',
|
||||||
|
agentBadge: '主',
|
||||||
|
isSubagent: false,
|
||||||
|
})),
|
||||||
modelBreakdown: mainModels,
|
modelBreakdown: mainModels,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1163,6 +1195,15 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
activeAgentId: 'sub-fast-1',
|
activeAgentId: 'sub-fast-1',
|
||||||
activeModelLabel: 'Gemini 3 Flash',
|
activeModelLabel: 'Gemini 3 Flash',
|
||||||
activeModelShort: 'gemini-3-flash',
|
activeModelShort: 'gemini-3-flash',
|
||||||
|
recentSteps: [
|
||||||
|
subStep,
|
||||||
|
...mainSteps.map((s) => ({
|
||||||
|
...s,
|
||||||
|
agentId: 'main',
|
||||||
|
agentBadge: '主',
|
||||||
|
isSubagent: false,
|
||||||
|
})),
|
||||||
|
],
|
||||||
modelBreakdown: [...mainModels, subModel],
|
modelBreakdown: [...mainModels, subModel],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -1745,9 +1786,22 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
assert.deepEqual(mockSettings.overviewModules, ['metrics', 'context', 'quotas', 'live_tasks']);
|
assert.deepEqual(mockSettings.overviewModules, ['metrics', 'context', 'quotas', 'live_tasks']);
|
||||||
assert.deepEqual(mockSettings.overviewMetrics, ['tps', 'ttft', 'avg_tps', 'step_cost']);
|
assert.deepEqual(mockSettings.overviewMetrics, ['tps', 'ttft', 'avg_tps', 'step_cost']);
|
||||||
|
|
||||||
// Section 3: Step Table Columns (2..12) — add optional 'time' and 'duration' columns
|
// Section 3: Step Table Columns (2..12) + independent Turn Rail & Main/Sub Agent Badge switches
|
||||||
const sec3 = accordionSections[3];
|
const sec3 = accordionSections[3];
|
||||||
sec3.querySelector('.collapsible-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
|
sec3.querySelector('.collapsible-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
const sec3SettingLabels = sec3.querySelectorAll('.form-label').map((el) => el.textContent);
|
||||||
|
assert.ok(sec3SettingLabels.includes('对话轮次导轨'), 'Turn rail switch rendered in 调用明细字段');
|
||||||
|
assert.ok(sec3SettingLabels.includes('主/子代理标识'), 'Main/Sub agent badge switch rendered in 调用明细字段');
|
||||||
|
const sec3SegControls = sec3.querySelectorAll('.segmented');
|
||||||
|
assert.equal(sec3SegControls.length, 2, 'Two independent switches rendered in 调用明细字段');
|
||||||
|
// Toggle off 对话轮次导轨 and 主/子代理标识
|
||||||
|
sec3SegControls[0].querySelectorAll('.seg-btn')[1].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 25));
|
||||||
|
assert.equal(mockSettings.showStepTurnRail, false, 'Turn rail switch updates showStepTurnRail to false');
|
||||||
|
sec3SegControls[1].querySelectorAll('.seg-btn')[1].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 25));
|
||||||
|
assert.equal(mockSettings.showStepAgentBadge, false, 'Agent badge switch updates showStepAgentBadge to false');
|
||||||
|
|
||||||
const stepColWrap = sec3.querySelector('.editable-slot-wrap');
|
const stepColWrap = sec3.querySelector('.editable-slot-wrap');
|
||||||
stepColWrap.querySelector('.slot-add-btn').dispatchEvent({ type: 'click', stopPropagation() {} });
|
stepColWrap.querySelector('.slot-add-btn').dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
await new Promise((r) => setTimeout(r, 25));
|
await new Promise((r) => setTimeout(r, 25));
|
||||||
@@ -1756,13 +1810,26 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
assert.equal(mockSettings.stepTableColumns.length, 9, 'Added time and duration columns (7 -> 9)');
|
assert.equal(mockSettings.stepTableColumns.length, 9, 'Added time and duration columns (7 -> 9)');
|
||||||
pillTabs[2].dispatchEvent({ type: 'click', stopPropagation() {} });
|
pillTabs[2].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
await new Promise((r) => setTimeout(r, 15));
|
await new Promise((r) => setTimeout(r, 15));
|
||||||
const stepHeaderThs = allPanes[2].querySelector('.data-table').children[0].children[0].children;
|
const stepTableWhileRailOff = allPanes[2].querySelector('.data-table');
|
||||||
|
assert.equal(
|
||||||
|
stepTableWhileRailOff.classList.contains('has-turn-rail'),
|
||||||
|
false,
|
||||||
|
'has-turn-rail class removed when showStepTurnRail is false'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
stepTableWhileRailOff.querySelector('.turn-rail').hasAttribute('hidden'),
|
||||||
|
true,
|
||||||
|
'Turn rail DOM hidden when showStepTurnRail is false'
|
||||||
|
);
|
||||||
|
const stepHeaderThs = stepTableWhileRailOff.children[0].children[0].children;
|
||||||
assert.equal(stepHeaderThs.length, 9, 'StepsDetailView thead dynamically renders 9 columns');
|
assert.equal(stepHeaderThs.length, 9, 'StepsDetailView thead dynamically renders 9 columns');
|
||||||
pillTabs[3].dispatchEvent({ type: 'click', stopPropagation() {} });
|
pillTabs[3].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
await new Promise((r) => setTimeout(r, 15));
|
await new Promise((r) => setTimeout(r, 15));
|
||||||
sec3.querySelector('.btn-ghost-sm').dispatchEvent({ type: 'click', stopPropagation() {} });
|
sec3.querySelector('.btn-ghost-sm').dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
await new Promise((r) => setTimeout(r, 40));
|
await new Promise((r) => setTimeout(r, 40));
|
||||||
assert.equal(mockSettings.stepTableColumns.length, 7);
|
assert.equal(mockSettings.stepTableColumns.length, 7);
|
||||||
|
assert.equal(mockSettings.showStepTurnRail, true, 'Section reset restores showStepTurnRail to true');
|
||||||
|
assert.equal(mockSettings.showStepAgentBadge, true, 'Section reset restores showStepAgentBadge to true');
|
||||||
|
|
||||||
// --- 其他 (model format, context limits, cache rebuild, reset) ---
|
// --- 其他 (model format, context limits, cache rebuild, reset) ---
|
||||||
subNavBtns[2].dispatchEvent({ type: 'click', stopPropagation() {} });
|
subNavBtns[2].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
@@ -1928,6 +1995,24 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
assert.equal(stepRows[0].children[4].getAttribute('title'), '上下文 37800 · 思考 420 · 正文 265');
|
assert.equal(stepRows[0].children[4].getAttribute('title'), '上下文 37800 · 思考 420 · 正文 265');
|
||||||
assert.equal(stepRows[1].children[4].textContent, '117.7k / 14.5k / 57');
|
assert.equal(stepRows[1].children[4].textContent, '117.7k / 14.5k / 57');
|
||||||
|
|
||||||
|
// Verify minimalist Turn Rail (.has-turn-rail, cap & origin dots) and hover prompt preview tooltip
|
||||||
|
const stepsDataTable = stepsPane.querySelectorAll('.data-table')[0];
|
||||||
|
assert.equal(stepsDataTable.classList.contains('has-turn-rail'), true, 'Turn rail active when showStepTurnRail=true');
|
||||||
|
const row0Rail = stepRows[0].children[0].querySelector('.turn-rail');
|
||||||
|
const row1Rail = stepRows[1].children[0].querySelector('.turn-rail');
|
||||||
|
assert.equal(row0Rail.hasAttribute('hidden'), false);
|
||||||
|
assert.equal(row0Rail.classList.contains('is-latest'), true);
|
||||||
|
assert.equal(row0Rail.querySelector('.turn-rail-dot').classList.contains('is-cap'), true, 'Newest step in turn renders cap dot');
|
||||||
|
assert.equal(row1Rail.querySelector('.turn-rail-dot').classList.contains('is-origin'), true, 'First step of user turn renders hollow origin dot');
|
||||||
|
|
||||||
|
const turnPromptTipEl = stepsPane.querySelector('.turn-prompt-tip');
|
||||||
|
assert.equal(turnPromptTipEl.hasAttribute('hidden'), true, 'Prompt preview tooltip hidden initially');
|
||||||
|
stepRows[0].children[0].onmouseenter({ target: stepRows[0].children[0] });
|
||||||
|
assert.equal(turnPromptTipEl.hasAttribute('hidden'), false, 'Hovering first cell opens turn prompt preview');
|
||||||
|
assert.equal(turnPromptTipEl.textContent, '请优化调用明细与轮次导轨');
|
||||||
|
stepRows[0].children[0].onmouseleave();
|
||||||
|
assert.equal(turnPromptTipEl.hasAttribute('hidden'), true, 'Leaving cell hides turn prompt preview');
|
||||||
|
|
||||||
// Verify '按步查看' multi-select model filter (visible when >1 model) & '总汇总' sub-tab rename
|
// Verify '按步查看' multi-select model filter (visible when >1 model) & '总汇总' sub-tab rename
|
||||||
const stepsHeaderSegBtns = stepsPane.querySelector('.steps-header-controls').querySelectorAll('.seg-btn');
|
const stepsHeaderSegBtns = stepsPane.querySelector('.steps-header-controls').querySelectorAll('.seg-btn');
|
||||||
assert.equal(stepsHeaderSegBtns[0].textContent, '按步查看 (2)');
|
assert.equal(stepsHeaderSegBtns[0].textContent, '按步查看 (2)');
|
||||||
@@ -2191,8 +2276,78 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
'ModelFitChart model dropdown auto-hidden when only 1 model exists'
|
'ModelFitChart model dropdown auto-hidden when only 1 model exists'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Restore sub-tab to 'steps' before subsequent route tests
|
// Restore sub-tab to 'steps', reset scope to 'all', and verify multi-agent rootTurnIndex rail + decoupled [主]/[子] badge toggle
|
||||||
stepsHeaderSegBtns[0].dispatchEvent({ type: 'click', stopPropagation() {} });
|
stepsHeaderSegBtns[0].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 15));
|
||||||
|
inlineScopeSelectEl
|
||||||
|
.querySelectorAll('.select-option')
|
||||||
|
.find((o) => o.getAttribute('data-value') === 'all')
|
||||||
|
.dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
inlineScopeSelectEl.querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 20));
|
||||||
|
|
||||||
|
const multiStepRows = stepsPane.querySelectorAll('.data-table')[0].children[1].children;
|
||||||
|
assert.equal(multiStepRows.length, 3, 'All 3 interleaved main + subagent steps rendered in 全部代理');
|
||||||
|
assert.equal(
|
||||||
|
multiStepRows[0].children[0].querySelector('.agent-badge').hasAttribute('hidden'),
|
||||||
|
false,
|
||||||
|
'[子1] badge visible when showStepAgentBadge is true'
|
||||||
|
);
|
||||||
|
assert.equal(multiStepRows[0].children[0].querySelector('.agent-badge').textContent, '子1');
|
||||||
|
assert.equal(multiStepRows[1].children[0].querySelector('.agent-badge').textContent, '主');
|
||||||
|
assert.equal(
|
||||||
|
multiStepRows[0].children[0].querySelector('.turn-rail-dot').classList.contains('is-cap'),
|
||||||
|
true,
|
||||||
|
'Interleaved subagent step at top joins unified rootTurnIndex rail as cap'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
multiStepRows[1].children[0].querySelector('.turn-rail-dot').hasAttribute('hidden'),
|
||||||
|
true,
|
||||||
|
'Middle main step connects continuously along unified rootTurnIndex rail'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
multiStepRows[2].children[0].querySelector('.turn-rail-dot').classList.contains('is-origin'),
|
||||||
|
true,
|
||||||
|
'Earliest main step anchors unified rootTurnIndex rail origin'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Hide [主]/[子] badge independently via settings switch while keeping step numbers (#4, #35, #20) and turn rail intact
|
||||||
|
pillTabs[3].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 15));
|
||||||
|
subNavBtns[1].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 15));
|
||||||
|
sec3SegControls[1].querySelectorAll('.seg-btn')[1].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 25));
|
||||||
|
pillTabs[2].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 15));
|
||||||
|
assert.equal(
|
||||||
|
multiStepRows[0].children[0].querySelector('.agent-badge').hasAttribute('hidden'),
|
||||||
|
true,
|
||||||
|
'[子1] badge hidden when showStepAgentBadge=false'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
multiStepRows[1].children[0].querySelector('.agent-badge').hasAttribute('hidden'),
|
||||||
|
true,
|
||||||
|
'[主] badge hidden when showStepAgentBadge=false'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
multiStepRows[0].children[0].children.at(-1).textContent,
|
||||||
|
'#4',
|
||||||
|
'Step index remains intact when [主]/[子] badge is hidden'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
multiStepRows[0].children[0].querySelector('.turn-rail').hasAttribute('hidden'),
|
||||||
|
false,
|
||||||
|
'Turn rail remains visible independently of [主]/[子] badge switch'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Restore showStepAgentBadge=true before subsequent route tests
|
||||||
|
pillTabs[3].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 15));
|
||||||
|
sec3SegControls[1].querySelectorAll('.seg-btn')[0].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 260));
|
||||||
|
pillTabs[2].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 15));
|
||||||
liveSubagentPollActive = false;
|
liveSubagentPollActive = false;
|
||||||
|
|
||||||
// Verify bundle version bump NEVER calls window.location.reload() in overlay mode
|
// Verify bundle version bump NEVER calls window.location.reload() in overlay mode
|
||||||
|
|||||||
Reference in New Issue
Block a user