mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
feat(panel): add minimalist conversation turn rail and prompt preview in steps table
This commit is contained in:
+126
-9
@@ -5355,10 +5355,10 @@ const StepsDetailView = defineComponent({
|
|||||||
// --- 子表 1:单步明细表(列定义:步序、模型、吞吐速度、首字延迟、上下文/输出、缓存命中率、单步费用) ---
|
// --- 子表 1:单步明细表(列定义:步序、模型、吞吐速度、首字延迟、上下文/输出、缓存命中率、单步费用) ---
|
||||||
const stepsTbody = h('tbody');
|
const stepsTbody = h('tbody');
|
||||||
const stepsTablePane = h('div', { className: 'table-viewport' }, [
|
const stepsTablePane = h('div', { className: 'table-viewport' }, [
|
||||||
h('table', { className: 'data-table' }, [
|
h('table', { className: 'data-table steps-data-table' }, [
|
||||||
h('thead', {}, [
|
h('thead', {}, [
|
||||||
h('tr', {}, [
|
h('tr', {}, [
|
||||||
h('th', { text: '步序' }),
|
h('th', { className: 'step-col-head', text: '步序' }),
|
||||||
h('th', { text: '模型' }),
|
h('th', { text: '模型' }),
|
||||||
h('th', { text: '速度' }),
|
h('th', { text: '速度' }),
|
||||||
h('th', { text: '首字' }),
|
h('th', { text: '首字' }),
|
||||||
@@ -5375,6 +5375,42 @@ const StepsDetailView = defineComponent({
|
|||||||
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 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 leftPx = Math.max(6, Math.round(cellRect.left - panelRect.left + 4));
|
||||||
|
turnTipEl.style.top = `${topPx}px`;
|
||||||
|
turnTipEl.style.left = `${leftPx}px`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- 子表 2:按模型汇总表(列定义:模型名称、调用次数、有效均速、总 Token、费用) ---
|
// --- 子表 2:按模型汇总表(列定义:模型名称、调用次数、有效均速、总 Token、费用) ---
|
||||||
const modelsTbody = h('tbody');
|
const modelsTbody = h('tbody');
|
||||||
const modelsTablePane = h('div', { className: 'table-viewport' }, [
|
const modelsTablePane = h('div', { className: 'table-viewport' }, [
|
||||||
@@ -5401,7 +5437,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' }, [
|
||||||
@@ -5416,14 +5452,18 @@ 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]);
|
||||||
|
|
||||||
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');
|
||||||
@@ -5506,21 +5546,65 @@ const StepsDetailView = defineComponent({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const useRootTurn = Boolean(hasSubagents && effectiveScope === 'all');
|
||||||
|
const getStepTurnIdx = (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) => {
|
||||||
|
const tIdx = getStepTurnIdx(st);
|
||||||
|
if (!Number.isInteger(tIdx) || tIdx <= 0) return '';
|
||||||
|
return useRootTurn ? `root:${tIdx}` : `${st.agentId || 'main'}:${tIdx}`;
|
||||||
|
};
|
||||||
|
const decoratedSteps = steps.map((st, idx) => {
|
||||||
|
const tKey = turnKeyOf(st);
|
||||||
|
const hasUp = Boolean(tKey && idx > 0 && turnKeyOf(steps[idx - 1]) === tKey);
|
||||||
|
const hasDown = Boolean(
|
||||||
|
tKey && idx + 1 < steps.length && turnKeyOf(steps[idx + 1]) === tKey
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
st,
|
||||||
|
rowKey: `${st.agentCascadeId || slice.cascadeId || 'conv'}-${st.stepIndex}`,
|
||||||
|
hasTurn: Boolean(tKey),
|
||||||
|
hasUp,
|
||||||
|
hasDown,
|
||||||
|
isStart: getStepIsStart(st),
|
||||||
|
isLatest: getStepIsLatest(st),
|
||||||
|
prompt: getStepPrompt(st),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
// 1. 单步测速表增量对账:以 `<agentCascadeId>-<stepIndex>` 为稳定行键,仅在签名变化时刷新单元格
|
// 1. 单步测速表增量对账:以 `<agentCascadeId>-<stepIndex>` 为稳定行键,仅在签名变化时刷新单元格
|
||||||
patchKeyedList(stepsTbody, steps, {
|
patchKeyedList(stepsTbody, decoratedSteps, {
|
||||||
keyFn: (st) => `${st.agentCascadeId || slice.cascadeId || 'conv'}-${st.stepIndex}`,
|
keyFn: (item) => item.rowKey,
|
||||||
sigFn: (st) => {
|
sigFn: (item) => {
|
||||||
|
const { st } = item;
|
||||||
const disp = resolveModelDisplayInfo(st, displaySettings, { fallback: '—' });
|
const disp = resolveModelDisplayInfo(st, displaySettings, { fallback: '—' });
|
||||||
return `${hasSubagents}:${effectiveScope}:${st.agentId || 'main'}:${st.stepIndex}:${disp.text}:${disp.title}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}`;
|
return `${hasSubagents}:${effectiveScope}:${st.agentId || 'main'}:${st.stepIndex}:${disp.text}:${disp.title}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}:${item.hasTurn}:${item.hasUp}:${item.hasDown}:${item.isStart}:${item.isLatest}:${item.prompt}`;
|
||||||
},
|
},
|
||||||
createRow: () => {
|
createRow: () => {
|
||||||
|
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]
|
||||||
|
);
|
||||||
const agentBadgeEl = h('span', {
|
const agentBadgeEl = h('span', {
|
||||||
className: 'agent-badge is-clickable',
|
className: 'agent-badge is-clickable',
|
||||||
hidden: true,
|
hidden: true,
|
||||||
style: 'margin-right: 4px;',
|
style: 'margin-right: 4px;',
|
||||||
});
|
});
|
||||||
const stepNumText = h('span');
|
const stepNumText = h('span');
|
||||||
const tdStep = h('td', {}, [agentBadgeEl, stepNumText]);
|
const tdStep = h('td', { className: 'step-cell' }, [
|
||||||
|
railEl,
|
||||||
|
agentBadgeEl,
|
||||||
|
stepNumText,
|
||||||
|
]);
|
||||||
|
|
||||||
const tdModel = h('td', {
|
const tdModel = h('td', {
|
||||||
style: 'max-width: 140px; overflow: hidden; text-overflow: ellipsis;',
|
style: 'max-width: 140px; overflow: hidden; text-overflow: ellipsis;',
|
||||||
@@ -5544,6 +5628,10 @@ const StepsDetailView = defineComponent({
|
|||||||
return {
|
return {
|
||||||
el: tr,
|
el: tr,
|
||||||
refs: {
|
refs: {
|
||||||
|
tdStep,
|
||||||
|
railEl,
|
||||||
|
railLineEl,
|
||||||
|
railDotEl,
|
||||||
agentBadgeEl,
|
agentBadgeEl,
|
||||||
stepNumText,
|
stepNumText,
|
||||||
tdModel,
|
tdModel,
|
||||||
@@ -5556,7 +5644,34 @@ const StepsDetailView = defineComponent({
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
updateRow: (refs, st) => {
|
updateRow: (refs, item) => {
|
||||||
|
const { st, hasTurn, hasUp, hasDown, isStart, isLatest, prompt } = item;
|
||||||
|
patchAttr(refs.railEl, 'hidden', !hasTurn);
|
||||||
|
if (hasTurn) {
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
refs.tdStep.onmouseenter = (ev) => {
|
||||||
|
if (ev?.target === refs.agentBadgeEl || !hasTurn || !prompt) {
|
||||||
|
hideTurnTip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showTurnTip(refs.tdStep, prompt);
|
||||||
|
};
|
||||||
|
refs.tdStep.onmouseleave = hideTurnTip;
|
||||||
|
|
||||||
patchAttr(refs.agentBadgeEl, 'hidden', !hasSubagents);
|
patchAttr(refs.agentBadgeEl, 'hidden', !hasSubagents);
|
||||||
if (hasSubagents) {
|
if (hasSubagents) {
|
||||||
const badgeCls = getAgentBadgeClass(st.agentIndex || 0, !st.isSubagent);
|
const badgeCls = getAgentBadgeClass(st.agentIndex || 0, !st.isSubagent);
|
||||||
@@ -5688,6 +5803,8 @@ const StepsDetailView = defineComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
onCleanup(() => {
|
onCleanup(() => {
|
||||||
|
stepsTablePane.removeEventListener('scroll', hideTurnTip);
|
||||||
|
stepsTbody.removeEventListener('mouseleave', hideTurnTip);
|
||||||
unsubUi();
|
unsubUi();
|
||||||
unsubTelemetry();
|
unsubTelemetry();
|
||||||
unsubView();
|
unsubView();
|
||||||
|
|||||||
@@ -724,6 +724,9 @@ export async function enumerateAndSyncConversations({
|
|||||||
if (!Object.prototype.hasOwnProperty.call(lastCachedStep, 'contextBreakdown')) {
|
if (!Object.prototype.hasOwnProperty.call(lastCachedStep, 'contextBreakdown')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(lastCachedStep, 'turnIndex')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (steps.some((s) => !Object.prototype.hasOwnProperty.call(s, 'responseModel'))) {
|
if (steps.some((s) => !Object.prototype.hasOwnProperty.call(s, 'responseModel'))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -893,7 +896,7 @@ export async function enumerateAndSyncConversations({
|
|||||||
`${CACHE_SCHEMA_VERSION}:`
|
`${CACHE_SCHEMA_VERSION}:`
|
||||||
);
|
);
|
||||||
if (!hasCurrentSchema) return true;
|
if (!hasCurrentSchema) return true;
|
||||||
if (hasMissingStepFields(cached)) return true;
|
if (hasMissingStepFields(cached) && (conv.inSummaries || conv.cascadeId.toLowerCase() === reqLower)) return true;
|
||||||
const missingSubagentRefs = !Array.isArray(cached.subagentRefs);
|
const missingSubagentRefs = !Array.isArray(cached.subagentRefs);
|
||||||
if (!conv.inSummaries) {
|
if (!conv.inSummaries) {
|
||||||
if (missingSubagentRefs && conv.cascadeId.toLowerCase() === reqLower) {
|
if (missingSubagentRefs && conv.cascadeId.toLowerCase() === reqLower) {
|
||||||
|
|||||||
@@ -167,6 +167,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);
|
||||||
@@ -543,6 +568,49 @@ 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 mainTurns = [];
|
||||||
|
let maxRootTurn = 0;
|
||||||
|
for (const mSt of enrichedActiveSteps) {
|
||||||
|
if (mSt.isTurnStart && Number.isInteger(mSt.turnIndex) && mSt.turnIndex > 0) {
|
||||||
|
mainTurns.push({
|
||||||
|
turnIndex: mSt.turnIndex,
|
||||||
|
startMs: mSt.createdAtMs || 0,
|
||||||
|
prompt: mSt.turnPrompt || '',
|
||||||
|
});
|
||||||
|
if (mSt.turnIndex > maxRootTurn) maxRootTurn = mSt.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 = mainTurns.find((t) => t.turnIndex === 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=1794565164880">
|
<link rel="stylesheet" href="/styles.css?v=1794602809968">
|
||||||
<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=1794565164880"></script>
|
<script src="/app.js?v=1794602809968"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -610,14 +610,87 @@ 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 mReq = step.content.match(/<USER_REQUEST>([\s\S]*?)<\/USER_REQUEST>/i);
|
||||||
|
raw = mReq
|
||||||
|
? mReq[1]
|
||||||
|
: step.content.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) {
|
||||||
@@ -778,6 +851,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 } : {}),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -104,3 +104,105 @@
|
|||||||
border: 1px solid var(--border-hairline);
|
border: 1px solid var(--border-hairline);
|
||||||
background: var(--surface-subtle);
|
background: var(--surface-subtle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- 3. 极简对话轮次导轨与起点圆点 (Minimalist Turn Rail & Origin Dot) --- */
|
||||||
|
.steps-data-table th.step-col-head,
|
||||||
|
.steps-data-table td.step-cell {
|
||||||
|
padding-left: 17px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps-data-table td.step-cell {
|
||||||
|
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-prompt-tip {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 45;
|
||||||
|
max-width: min(268px, calc(100% - 16px));
|
||||||
|
padding: 5px 8px;
|
||||||
|
font-size: 11px;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -72,10 +72,10 @@ export const StepsDetailView = defineComponent({
|
|||||||
// --- 子表 1:单步明细表(列定义:步序、模型、吞吐速度、首字延迟、上下文/输出、缓存命中率、单步费用) ---
|
// --- 子表 1:单步明细表(列定义:步序、模型、吞吐速度、首字延迟、上下文/输出、缓存命中率、单步费用) ---
|
||||||
const stepsTbody = h('tbody');
|
const stepsTbody = h('tbody');
|
||||||
const stepsTablePane = h('div', { className: 'table-viewport' }, [
|
const stepsTablePane = h('div', { className: 'table-viewport' }, [
|
||||||
h('table', { className: 'data-table' }, [
|
h('table', { className: 'data-table steps-data-table' }, [
|
||||||
h('thead', {}, [
|
h('thead', {}, [
|
||||||
h('tr', {}, [
|
h('tr', {}, [
|
||||||
h('th', { text: '步序' }),
|
h('th', { className: 'step-col-head', text: '步序' }),
|
||||||
h('th', { text: '模型' }),
|
h('th', { text: '模型' }),
|
||||||
h('th', { text: '速度' }),
|
h('th', { text: '速度' }),
|
||||||
h('th', { text: '首字' }),
|
h('th', { text: '首字' }),
|
||||||
@@ -92,6 +92,42 @@ export const StepsDetailView = defineComponent({
|
|||||||
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 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 leftPx = Math.max(6, Math.round(cellRect.left - panelRect.left + 4));
|
||||||
|
turnTipEl.style.top = `${topPx}px`;
|
||||||
|
turnTipEl.style.left = `${leftPx}px`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- 子表 2:按模型汇总表(列定义:模型名称、调用次数、有效均速、总 Token、费用) ---
|
// --- 子表 2:按模型汇总表(列定义:模型名称、调用次数、有效均速、总 Token、费用) ---
|
||||||
const modelsTbody = h('tbody');
|
const modelsTbody = h('tbody');
|
||||||
const modelsTablePane = h('div', { className: 'table-viewport' }, [
|
const modelsTablePane = h('div', { className: 'table-viewport' }, [
|
||||||
@@ -118,7 +154,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' }, [
|
||||||
@@ -133,14 +169,18 @@ 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]);
|
||||||
|
|
||||||
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');
|
||||||
@@ -223,21 +263,65 @@ export const StepsDetailView = defineComponent({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const useRootTurn = Boolean(hasSubagents && effectiveScope === 'all');
|
||||||
|
const getStepTurnIdx = (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) => {
|
||||||
|
const tIdx = getStepTurnIdx(st);
|
||||||
|
if (!Number.isInteger(tIdx) || tIdx <= 0) return '';
|
||||||
|
return useRootTurn ? `root:${tIdx}` : `${st.agentId || 'main'}:${tIdx}`;
|
||||||
|
};
|
||||||
|
const decoratedSteps = steps.map((st, idx) => {
|
||||||
|
const tKey = turnKeyOf(st);
|
||||||
|
const hasUp = Boolean(tKey && idx > 0 && turnKeyOf(steps[idx - 1]) === tKey);
|
||||||
|
const hasDown = Boolean(
|
||||||
|
tKey && idx + 1 < steps.length && turnKeyOf(steps[idx + 1]) === tKey
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
st,
|
||||||
|
rowKey: `${st.agentCascadeId || slice.cascadeId || 'conv'}-${st.stepIndex}`,
|
||||||
|
hasTurn: Boolean(tKey),
|
||||||
|
hasUp,
|
||||||
|
hasDown,
|
||||||
|
isStart: getStepIsStart(st),
|
||||||
|
isLatest: getStepIsLatest(st),
|
||||||
|
prompt: getStepPrompt(st),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
// 1. 单步测速表增量对账:以 `<agentCascadeId>-<stepIndex>` 为稳定行键,仅在签名变化时刷新单元格
|
// 1. 单步测速表增量对账:以 `<agentCascadeId>-<stepIndex>` 为稳定行键,仅在签名变化时刷新单元格
|
||||||
patchKeyedList(stepsTbody, steps, {
|
patchKeyedList(stepsTbody, decoratedSteps, {
|
||||||
keyFn: (st) => `${st.agentCascadeId || slice.cascadeId || 'conv'}-${st.stepIndex}`,
|
keyFn: (item) => item.rowKey,
|
||||||
sigFn: (st) => {
|
sigFn: (item) => {
|
||||||
|
const { st } = item;
|
||||||
const disp = resolveModelDisplayInfo(st, displaySettings, { fallback: '—' });
|
const disp = resolveModelDisplayInfo(st, displaySettings, { fallback: '—' });
|
||||||
return `${hasSubagents}:${effectiveScope}:${st.agentId || 'main'}:${st.stepIndex}:${disp.text}:${disp.title}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}`;
|
return `${hasSubagents}:${effectiveScope}:${st.agentId || 'main'}:${st.stepIndex}:${disp.text}:${disp.title}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}:${item.hasTurn}:${item.hasUp}:${item.hasDown}:${item.isStart}:${item.isLatest}:${item.prompt}`;
|
||||||
},
|
},
|
||||||
createRow: () => {
|
createRow: () => {
|
||||||
|
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]
|
||||||
|
);
|
||||||
const agentBadgeEl = h('span', {
|
const agentBadgeEl = h('span', {
|
||||||
className: 'agent-badge is-clickable',
|
className: 'agent-badge is-clickable',
|
||||||
hidden: true,
|
hidden: true,
|
||||||
style: 'margin-right: 4px;',
|
style: 'margin-right: 4px;',
|
||||||
});
|
});
|
||||||
const stepNumText = h('span');
|
const stepNumText = h('span');
|
||||||
const tdStep = h('td', {}, [agentBadgeEl, stepNumText]);
|
const tdStep = h('td', { className: 'step-cell' }, [
|
||||||
|
railEl,
|
||||||
|
agentBadgeEl,
|
||||||
|
stepNumText,
|
||||||
|
]);
|
||||||
|
|
||||||
const tdModel = h('td', {
|
const tdModel = h('td', {
|
||||||
style: 'max-width: 140px; overflow: hidden; text-overflow: ellipsis;',
|
style: 'max-width: 140px; overflow: hidden; text-overflow: ellipsis;',
|
||||||
@@ -261,6 +345,10 @@ export const StepsDetailView = defineComponent({
|
|||||||
return {
|
return {
|
||||||
el: tr,
|
el: tr,
|
||||||
refs: {
|
refs: {
|
||||||
|
tdStep,
|
||||||
|
railEl,
|
||||||
|
railLineEl,
|
||||||
|
railDotEl,
|
||||||
agentBadgeEl,
|
agentBadgeEl,
|
||||||
stepNumText,
|
stepNumText,
|
||||||
tdModel,
|
tdModel,
|
||||||
@@ -273,7 +361,34 @@ export const StepsDetailView = defineComponent({
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
updateRow: (refs, st) => {
|
updateRow: (refs, item) => {
|
||||||
|
const { st, hasTurn, hasUp, hasDown, isStart, isLatest, prompt } = item;
|
||||||
|
patchAttr(refs.railEl, 'hidden', !hasTurn);
|
||||||
|
if (hasTurn) {
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
refs.tdStep.onmouseenter = (ev) => {
|
||||||
|
if (ev?.target === refs.agentBadgeEl || !hasTurn || !prompt) {
|
||||||
|
hideTurnTip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showTurnTip(refs.tdStep, prompt);
|
||||||
|
};
|
||||||
|
refs.tdStep.onmouseleave = hideTurnTip;
|
||||||
|
|
||||||
patchAttr(refs.agentBadgeEl, 'hidden', !hasSubagents);
|
patchAttr(refs.agentBadgeEl, 'hidden', !hasSubagents);
|
||||||
if (hasSubagents) {
|
if (hasSubagents) {
|
||||||
const badgeCls = getAgentBadgeClass(st.agentIndex || 0, !st.isSubagent);
|
const badgeCls = getAgentBadgeClass(st.agentIndex || 0, !st.isSubagent);
|
||||||
@@ -405,6 +520,8 @@ export const StepsDetailView = defineComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
onCleanup(() => {
|
onCleanup(() => {
|
||||||
|
stepsTablePane.removeEventListener('scroll', hideTurnTip);
|
||||||
|
stepsTbody.removeEventListener('mouseleave', hideTurnTip);
|
||||||
unsubUi();
|
unsubUi();
|
||||||
unsubTelemetry();
|
unsubTelemetry();
|
||||||
unsubView();
|
unsubView();
|
||||||
|
|||||||
@@ -2277,6 +2277,108 @@ input {
|
|||||||
background: var(--surface-subtle);
|
background: var(--surface-subtle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- 3. 极简对话轮次导轨与起点圆点 (Minimalist Turn Rail & Origin Dot) --- */
|
||||||
|
.steps-data-table th.step-col-head,
|
||||||
|
.steps-data-table td.step-cell {
|
||||||
|
padding-left: 17px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps-data-table td.step-cell {
|
||||||
|
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-prompt-tip {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 45;
|
||||||
|
max-width: min(268px, calc(100% - 16px));
|
||||||
|
padding: 5px 8px;
|
||||||
|
font-size: 11px;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
/* --- src/styles/overlay.css --- */
|
/* --- src/styles/overlay.css --- */
|
||||||
/*
|
/*
|
||||||
* 双栖模式顶栏胶囊与悬浮面板样式表 (overlay.css).
|
* 双栖模式顶栏胶囊与悬浮面板样式表 (overlay.css).
|
||||||
|
|||||||
@@ -542,3 +542,69 @@ test('supports Gemini 4 Carbon pricing/pool and resolves all newly added languag
|
|||||||
assert.equal(p.quotas.activePool.poolKey, 'Carbon');
|
assert.equal(p.quotas.activePool.poolKey, 'Carbon');
|
||||||
assert.equal(p.quotas.activePool.weeklyRemainingIntPct, 65);
|
assert.equal(p.quotas.activePool.weeklyRemainingIntPct, 65);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('assigns unified rootTurnIndex across interleaved main and subagent steps so All view 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)
|
||||||
|
|
||||||
|
// All 4 Turn-2 steps (main #3, sub #1, main #5, sub #2) share rootTurnIndex=2 and rootTurnPrompt='确认。设计是满意的。执行'
|
||||||
|
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, '确认。设计是满意的。执行');
|
||||||
|
}
|
||||||
|
// Only main #3 (earliest step of Turn 2) is marked isRootTurnStart; subagent #1 keeps its own isTurnStart for subagent-only filter
|
||||||
|
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');
|
||||||
|
});
|
||||||
|
|||||||
@@ -281,3 +281,49 @@ 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, marks only the first model step per turn, and merges consecutive prompts', () => {
|
||||||
|
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),
|
||||||
|
]);
|
||||||
|
|
||||||
|
assert.equal(steps.length, 3);
|
||||||
|
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第二轮补充提问 [附图]');
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user