diff --git a/sidecars/panel/app.js b/sidecars/panel/app.js index ed502ff..53832f7 100644 --- a/sidecars/panel/app.js +++ b/sidecars/panel/app.js @@ -1670,22 +1670,6 @@ const I18N_MESSAGES_ZH_CN = Object.freeze({ 'steps.chipLowCacheTip': '筛选缓存命中率低于 50% 的步骤', 'steps.chipSlowTtft': '慢首字 {count}', 'steps.chipSlowTtftTip': '筛选首字延迟 >= 30s 的严重卡顿步骤', - 'steps.inspPrevAria': '查看上一步', - 'steps.inspNextAria': '查看下一步', - 'steps.inspCopy': '复制诊断', - 'steps.inspCopied': '已复制', - 'steps.inspCloseAria': '关闭单步详情', - 'steps.inspWaterfallTtft': '首字 {sec}', - 'steps.inspWaterfallStream': '流式 {sec}', - 'steps.inspWaterfallOther': '工具/等待 {sec}', - 'steps.inspWaterfallThink': '思考 {sec}', - 'steps.inspInputLabel': '新输入', - 'steps.inspCacheLabel': '缓存读取', - 'steps.inspOutputLabel': '输出', - 'steps.inspOutputSplit': '思 {think} / 回 {reply}', - 'steps.inspContextCostLabel': '上下文 / 费用', - 'steps.inspPromptTitle': '本轮提问', - 'steps.inspRowClickTip': '点击查看单步详情', 'steps.exportMenuAria': '导出及报告选项', 'steps.exportXlsx': '导出 Excel (.xlsx)', 'steps.exportXlsxTip': '导出排版精美的步骤明细及模型汇总 Excel 报表', @@ -2577,22 +2561,6 @@ const I18N_MESSAGES_EN_US = Object.freeze({ 'steps.chipLowCacheTip': 'Filter steps with cache hit rate below 50%', 'steps.chipSlowTtft': 'Slow TTFT {count}', 'steps.chipSlowTtftTip': 'Filter severely delayed steps with TTFT >= 30s', - 'steps.inspPrevAria': 'Previous step', - 'steps.inspNextAria': 'Next step', - 'steps.inspCopy': 'Copy', - 'steps.inspCopied': 'Copied', - 'steps.inspCloseAria': 'Close step inspector', - 'steps.inspWaterfallTtft': 'TTFT {sec}', - 'steps.inspWaterfallStream': 'Stream {sec}', - 'steps.inspWaterfallOther': 'Tool/Wait {sec}', - 'steps.inspWaterfallThink': 'Think {sec}', - 'steps.inspInputLabel': 'Fresh Input', - 'steps.inspCacheLabel': 'Cache Read', - 'steps.inspOutputLabel': 'Output', - 'steps.inspOutputSplit': 'Think {think} / Reply {reply}', - 'steps.inspContextCostLabel': 'Context / Cost', - 'steps.inspPromptTitle': 'Turn Prompt', - 'steps.inspRowClickTip': 'Click row to inspect step details', 'steps.exportMenuAria': 'Export and report actions', 'steps.exportXlsx': 'Export Excel (.xlsx)', 'steps.exportXlsxTip': 'Export styled multi-sheet Excel workbook for steps and model summary', @@ -22007,8 +21975,6 @@ const StepTableWidget = defineComponent({ typeof props.onVirtualHeightChange === 'function' ? props.onVirtualHeightChange : null; const onSortChange = typeof props.onSortChange === 'function' ? props.onSortChange : null; - const onSelectStep = - typeof props.onSelectStep === 'function' ? props.onSelectStep : null; const stepsTheadRow = h('tr'); const stepsThead = h('thead', {}, [stepsTheadRow]); @@ -22754,8 +22720,7 @@ const StepTableWidget = defineComponent({ const stripeSig = isVirtualized ? (item.isStripeEven ? 'E' : 'O') : 'N'; const anomalySig = st.anomalySig || ''; const compactSig = isCompactionStepItem(st) ? 'C' : ''; - const selSig = ds.selectedStepKey && ds.selectedStepKey === item.rowKey ? 'S' : ''; - return `${locale}:${colOrderSig}:${stripeSig}:${badgeSig}:${anomalySig}:${compactSig}:${selSig}:${railActive}:${item.hasTurn}:${item.hasUp}:${item.hasDown}:${item.isStart}:${item.isLatest}:${item.prompt}:${parts}`; + return `${locale}:${colOrderSig}:${stripeSig}:${badgeSig}:${anomalySig}:${compactSig}:${railActive}:${item.hasTurn}:${item.hasUp}:${item.hasDown}:${item.isStart}:${item.isLatest}:${item.prompt}:${parts}`; }, createRow: (item) => { if (item.isSizer) { @@ -23008,21 +22973,11 @@ const StepTableWidget = defineComponent({ const rowDiagGetter = hasRowTip ? () => buildStepRowDiagnostic(st, cellCtx.displaySettings, hasStepAnomaly, isCompactionRow) : null; - const isSelectedRow = Boolean(ds.selectedStepKey && ds.selectedStepKey === item.rowKey); patchClasses(tr, { 'is-compaction': isCompactionRow, 'is-anomaly-warn': isAnomalyWarn, 'is-anomaly-danger': isAnomalyDanger, - 'is-selectable': Boolean(onSelectStep), - 'is-selected': isSelectedRow, }); - if (onSelectStep) { - tr.onclick = () => { - onSelectStep(st, item.rowKey); - }; - } else { - tr.onclick = null; - } if (hasRowTip) { const anchorEl = firstTd || tr; tr.onmouseenter = () => { @@ -23196,7 +23151,6 @@ const StepTableWidget = defineComponent({ allowNewRowFade = false, sortKey = '', sortDir = '', - selectedStepKey = '', } = {} ) { const normCascadeId = String(cascadeId || ''); @@ -23267,7 +23221,7 @@ const StepTableWidget = defineComponent({ cascadeId, locale, colOrderSig, effectiveScopes, hasSubagents, isMergedMultiAgents, effectiveTurnRail, showStepAgentBadge, showStepSpeedColor, normTokenFmt, displaySettings.modelDisplayMode, displaySettings.showUpstreamModel, - displaySettings.orchestratorIdMode, normSortKey, normSortDir, String(selectedStepKey || ''), + displaySettings.orchestratorIdMode, normSortKey, normSortDir, ]); if ( lastRenderOptions === renderOptions && @@ -23366,7 +23320,6 @@ const StepTableWidget = defineComponent({ totalBodyH, sizerSpec, effectiveScopes, - selectedStepKey: String(selectedStepKey || ''), formattedPrompts: new Map(), }; renderedSliceStart = -1; @@ -31817,11 +31770,9 @@ const StepsDetailView = defineComponent({ let anomalyKindFilter = ''; let stepSearchQuery = ''; let stepQuickChip = ''; - let selectedStepKey = ''; let currentTableSteps = []; let currentAllConvSteps = []; let currentDisplaySettings = {}; - let inspCopyTimer = null; let sortKey = ''; let sortDir = ''; let cachedSortSrc = null; @@ -31908,10 +31859,6 @@ const StepsDetailView = defineComponent({ sortDir = nextDir || ''; if (latestSlice) renderStepsData(latestSlice); }, - onSelectStep: (_st, rowKey) => { - selectedStepKey = selectedStepKey === rowKey ? '' : rowKey; - if (latestSlice) renderStepsData(latestSlice); - }, }); const { stepsTablePane, @@ -32072,288 +32019,6 @@ const StepsDetailView = defineComponent({ [stepSearchWrapEl, stepQuickChipsEl] ); - // --- 点击行展开的单步透视诊断抽屉 --- - const inspStepBadgeEl = h('span', { className: 'step-insp-badge text-mono' }); - const inspModelEl = h('strong', { className: 'step-insp-model' }); - const inspTimeEl = h('span', { className: 'step-insp-time text-mono text-muted' }); - const inspPrevBtn = h( - 'button', - { - type: 'button', - className: 'step-insp-icon-btn', - 'aria-label': t('steps.inspPrevAria'), - title: t('steps.inspPrevAria'), - onclick: () => navigateInspectorStep(-1), - }, - [createSvgIcon('chevron-up', { size: 12 })] - ); - const inspNextBtn = h( - 'button', - { - type: 'button', - className: 'step-insp-icon-btn', - 'aria-label': t('steps.inspNextAria'), - title: t('steps.inspNextAria'), - onclick: () => navigateInspectorStep(1), - }, - [createSvgIcon('chevron-down', { size: 12 })] - ); - const inspCopyIcon = createSvgIcon('copy', { size: 11 }); - const inspCopyLabel = h('span', { text: t('steps.inspCopy') }); - let currentInspectedStep = null; - let currentInspectedPrevCtx = null; - const inspCopyBtn = h( - 'button', - { - type: 'button', - className: 'step-insp-copy-btn', - onclick: async () => { - if (!currentInspectedStep) return; - const md = buildStepDiagnosticMarkdown(currentInspectedStep, { - prevContextTokens: currentInspectedPrevCtx, - displaySettings: currentDisplaySettings, - }); - await copyPlainTextToClipboard(md); - patchSvgIcon(inspCopyIcon, 'check'); - patchText(inspCopyLabel, t('steps.inspCopied')); - patchClasses(inspCopyBtn, { 'is-copied': true }); - if (inspCopyTimer) clearTimeout(inspCopyTimer); - inspCopyTimer = setTimeout(() => { - inspCopyTimer = null; - patchSvgIcon(inspCopyIcon, 'copy'); - patchText(inspCopyLabel, t('steps.inspCopy')); - patchClasses(inspCopyBtn, { 'is-copied': false }); - }, 1600); - }, - }, - [inspCopyIcon, inspCopyLabel] - ); - const inspCloseBtn = h( - 'button', - { - type: 'button', - className: 'step-insp-icon-btn', - 'aria-label': t('steps.inspCloseAria'), - title: t('steps.inspCloseAria'), - onclick: () => { - selectedStepKey = ''; - if (latestSlice) renderStepsData(latestSlice); - }, - }, - [createSvgIcon('close', { size: 12 })] - ); - - const inspWfTtftSeg = h('div', { className: 'step-insp-wf-seg is-ttft' }); - const inspWfStreamSeg = h('div', { className: 'step-insp-wf-seg is-stream' }); - const inspWfOtherSeg = h('div', { className: 'step-insp-wf-seg is-other' }); - const inspWfTrackEl = h('div', { className: 'step-insp-wf-track' }, [ - inspWfTtftSeg, - inspWfStreamSeg, - inspWfOtherSeg, - ]); - const inspWfLegendEl = h('div', { className: 'step-insp-wf-legend text-mono' }); - const inspWaterfallEl = h('div', { className: 'step-insp-waterfall', hidden: true }, [ - inspWfTrackEl, - inspWfLegendEl, - ]); - - function createInspKpiCell(labelText) { - const lbl = h('span', { className: 'step-insp-kpi-lbl', text: labelText }); - const val = h('strong', { className: 'step-insp-kpi-val text-mono', text: '—' }); - const sub = h('span', { className: 'step-insp-kpi-sub text-mono text-muted', text: '' }); - return { - el: h('div', { className: 'step-insp-kpi' }, [lbl, val, sub]), - lbl, - val, - sub, - }; - } - const inspKpiInput = createInspKpiCell(t('steps.inspInputLabel')); - const inspKpiCache = createInspKpiCell(t('steps.inspCacheLabel')); - const inspKpiOutput = createInspKpiCell(t('steps.inspOutputLabel')); - const inspKpiCtxCost = createInspKpiCell(t('steps.inspContextCostLabel')); - const inspGridEl = h('div', { className: 'step-insp-grid' }, [ - inspKpiInput.el, - inspKpiCache.el, - inspKpiOutput.el, - inspKpiCtxCost.el, - ]); - - const inspPromptLabelEl = h('span', { - className: 'step-insp-prompt-lbl', - text: t('steps.inspPromptTitle'), - }); - const inspPromptTextEl = h('div', { className: 'step-insp-prompt-text' }); - const inspPromptWrapEl = h('div', { className: 'step-insp-prompt', hidden: true }, [ - inspPromptLabelEl, - inspPromptTextEl, - ]); - const inspAnomaliesEl = h('div', { className: 'step-insp-anomalies text-mono', hidden: true }); - - const stepInspectorDrawerEl = h( - 'div', - { className: 'step-inspector-drawer', hidden: true }, - [ - h('div', { className: 'step-insp-head' }, [ - h('div', { className: 'step-insp-head-left' }, [ - inspStepBadgeEl, - inspModelEl, - inspTimeEl, - ]), - h('div', { className: 'step-insp-head-actions' }, [ - inspPrevBtn, - inspNextBtn, - inspCopyBtn, - inspCloseBtn, - ]), - ]), - inspWaterfallEl, - inspGridEl, - inspPromptWrapEl, - inspAnomaliesEl, - ] - ); - - function navigateInspectorStep(delta) { - if (!selectedStepKey || currentTableSteps.length === 0) return; - const cid = String(latestSlice?.cascadeId || latestSlice?.activeConversation?.cascadeId || ''); - const curIdx = currentTableSteps.findIndex( - (st) => getStepSelectionKey(st, cid) === selectedStepKey - ); - if (curIdx < 0) return; - const nextIdx = curIdx + delta; - if (nextIdx < 0 || nextIdx >= currentTableSteps.length) return; - selectedStepKey = getStepSelectionKey(currentTableSteps[nextIdx], cid); - if (latestSlice) renderStepsData(latestSlice); - } - - function syncStepInspectorDrawer(tableSteps, allConvSteps, cascadeId, displaySettings, showModels) { - if (showModels || !selectedStepKey || !Array.isArray(tableSteps) || tableSteps.length === 0) { - currentInspectedStep = null; - currentInspectedPrevCtx = null; - patchAttr(stepInspectorDrawerEl, 'hidden', true); - return; - } - const idx = tableSteps.findIndex( - (st) => getStepSelectionKey(st, cascadeId) === selectedStepKey - ); - if (idx < 0) { - selectedStepKey = ''; - currentInspectedStep = null; - currentInspectedPrevCtx = null; - patchAttr(stepInspectorDrawerEl, 'hidden', true); - return; - } - const st = tableSteps[idx]; - currentInspectedStep = st; - const prevCtx = findPrevAgentContextTokens(allConvSteps, st); - currentInspectedPrevCtx = prevCtx; - - patchAttr(stepInspectorDrawerEl, 'hidden', false); - patchText(inspStepBadgeEl, `#${st.stepIndex ?? '—'}`); - const mInfo = resolveModelDisplayInfo(st, displaySettings); - patchText(inspModelEl, mInfo.text); - patchAttr(inspModelEl, 'title', mInfo.title || mInfo.text); - patchText(inspTimeEl, st.createdAtMs ? formatCompactDateTime(st.createdAtMs) : ''); - patchAttr(inspPrevBtn, 'disabled', idx <= 0); - patchAttr(inspNextBtn, 'disabled', idx >= tableSteps.length - 1); - - const wf = computeStepTimingWaterfall(st); - patchAttr(inspWaterfallEl, 'hidden', !wf); - if (wf) { - inspWfTtftSeg.style.width = `${wf.ttftPct}%`; - inspWfStreamSeg.style.width = `${wf.streamPct}%`; - inspWfOtherSeg.style.width = `${wf.otherPct}%`; - const parts = [formatSpeedMetric(st.tokPerSec, ' tok/s')]; - if (wf.ttftSec > 0) { - parts.push(t('steps.inspWaterfallTtft', { sec: formatTimingDetailSec(wf.ttftSec) })); - } - if (wf.streamSec > 0) { - parts.push(t('steps.inspWaterfallStream', { sec: formatTimingDetailSec(wf.streamSec) })); - } - if (wf.otherSec > 0.05) { - parts.push(t('steps.inspWaterfallOther', { sec: formatTimingDetailSec(wf.otherSec) })); - } - if (wf.thinkingSec > 0) { - parts.push(t('steps.inspWaterfallThink', { sec: formatTimingDetailSec(wf.thinkingSec) })); - } - const reason = st.selectedSpeedReason ? speedReasonText(st.selectedSpeedReason) : ''; - if (reason) parts.push(reason); - patchText(inspWfLegendEl, parts.join(' · ')); - } - - const inTok = Number(st.inputTokens || 0); - const cacheTok = Number(st.cacheReadTokens || 0); - const outTok = Number(st.outputTokens || 0); - const thinkTok = Number(st.thinkingTokens || 0); - const replyTok = - st.responseTokens != null ? Number(st.responseTokens) : Math.max(0, outTok - thinkTok); - const promptTok = inTok + cacheTok; - const cachePct = - st.cacheHitPct != null && Number.isFinite(Number(st.cacheHitPct)) - ? Number(st.cacheHitPct) - : promptTok > 0 - ? (cacheTok / promptTok) * 100 - : 0; - const ctxTok = Number(st.contextTokens || promptTok + outTok); - - patchText(inspKpiInput.lbl, t('steps.inspInputLabel')); - patchText(inspKpiInput.val, formatTokensPrecise(inTok)); - patchText(inspKpiInput.sub, st.inputCostUsd != null ? formatUsd(st.inputCostUsd, { precise: true }) : ''); - - patchText(inspKpiCache.lbl, t('steps.inspCacheLabel')); - patchText(inspKpiCache.val, formatTokensPrecise(cacheTok)); - patchText(inspKpiCache.sub, formatPctNumber(cachePct, { withSymbol: true })); - - patchText(inspKpiOutput.lbl, t('steps.inspOutputLabel')); - patchText(inspKpiOutput.val, formatTokensPrecise(outTok)); - patchText( - inspKpiOutput.sub, - thinkTok > 0 - ? t('steps.inspOutputSplit', { - think: formatTokens(thinkTok), - reply: formatTokens(replyTok), - }) - : st.outCostUsd != null - ? formatUsd(st.outCostUsd, { precise: true }) - : '' - ); - - patchText(inspKpiCtxCost.lbl, t('steps.inspContextCostLabel')); - const deltaStr = - prevCtx != null && ctxTok > 0 - ? ` (${ctxTok >= prevCtx ? '+' : '-'}${formatTokens(Math.abs(ctxTok - prevCtx))})` - : ''; - patchText(inspKpiCtxCost.val, `${formatTokens(ctxTok)}${deltaStr}`); - patchText(inspKpiCtxCost.sub, formatUsd(st.costUsd, { precise: true })); - - const promptText = String(st.turnPrompt || st.rootTurnPrompt || '').trim(); - patchAttr(inspPromptWrapEl, 'hidden', !promptText); - if (promptText) { - patchText(inspPromptLabelEl, t('steps.inspPromptTitle')); - patchText(inspPromptTextEl, promptText); - } - - const anom = st.anomaly; - const hasAnom = Boolean(anom && Number(anom.count) > 0); - patchAttr(inspAnomaliesEl, 'hidden', !hasAnom); - if (hasAnom) { - const itemsText = Array.isArray(anom.items) && anom.items.length > 0 - ? anom.items - .map((it) => { - const lbl = formatAnomalyKindLabel(it.kind || anom.primaryKind); - const code = it.httpStatus ? ` HTTP ${it.httpStatus}` : ''; - const delay = Number(it.delaySec) > 0 ? ` (${Number(it.delaySec).toFixed(1)}s)` : ''; - return `${lbl}${code}${delay}`; - }) - .join(' · ') - : Object.entries(anom.kinds || {}) - .map(([k, v]) => `${formatAnomalyKindLabel(k)} ×${v}`) - .join(' · '); - patchText(inspAnomaliesEl, itemsText); - } - } - // --- 子视图 2:总汇总分析面板 --- let selectedLineMetric = 'totalTokens'; let selectedFitMetric = 'tps'; @@ -32523,7 +32188,6 @@ const StepsDetailView = defineComponent({ stepsFilterToolbarEl, anomalyFilterBarEl, stepsScroll.el, - stepInspectorDrawerEl, modelsScroll.el, turnTipEl, anomalyTipEl, @@ -32600,13 +32264,6 @@ const StepsDetailView = defineComponent({ patchAttr(stepSearchInput, 'placeholder', t('steps.searchPlaceholder')); patchAttr(stepSearchInput, 'aria-label', t('steps.searchPlaceholder')); patchAttr(stepSearchClearBtn, 'aria-label', t('steps.searchClearAria')); - patchAttr(inspPrevBtn, 'aria-label', t('steps.inspPrevAria')); - patchAttr(inspPrevBtn, 'title', t('steps.inspPrevAria')); - patchAttr(inspNextBtn, 'aria-label', t('steps.inspNextAria')); - patchAttr(inspNextBtn, 'title', t('steps.inspNextAria')); - patchAttr(inspCloseBtn, 'aria-label', t('steps.inspCloseAria')); - patchAttr(inspCloseBtn, 'title', t('steps.inspCloseAria')); - if (!inspCopyTimer) patchText(inspCopyLabel, t('steps.inspCopy')); stepsExportMenu.refs.setAriaLabel(t('steps.exportMenuAria')); stepsExportMenu.refs.updateItemLabels({ xlsx: { label: t('steps.exportXlsx'), title: t('steps.exportXlsxTip') }, @@ -32652,7 +32309,6 @@ const StepsDetailView = defineComponent({ stepSearchInput.value = ''; patchAttr(stepSearchClearBtn, 'hidden', true); stepQuickChip = ''; - selectedStepKey = ''; sortKey = ''; sortDir = ''; } @@ -32968,14 +32624,11 @@ const StepsDetailView = defineComponent({ allowNewRowFade: shouldAnimateNewRows, sortKey, sortDir, - selectedStepKey, }); - syncStepInspectorDrawer(tableSteps, allConversationSteps, currentCid, displaySettings, false); stepsScroll.refresh(); fitPinnedWhileVisible = false; return; } - syncStepInspectorDrawer(tableSteps, allConversationSteps, currentCid, displaySettings, true); const chronoSteps = getMemoizedChronoSteps(steps, isMergedMultiAgents); const stepTtftFallbackMap = new Map(); @@ -33519,7 +33172,6 @@ const StepsDetailView = defineComponent({ tab !== 'steps' || !toolbarAllowed || (currentTableSteps.length === 0 && !stepSearchQuery && !stepQuickChip) ); stepsExportMenu.refs.setHidden(tab !== 'steps' || currentAllConvSteps.length === 0); - patchAttr(stepInspectorDrawerEl, 'hidden', tab !== 'steps' || !selectedStepKey); patchAttr(stepsScroll.el, 'hidden', tab !== 'steps'); patchAttr(modelsScroll.el, 'hidden', tab !== 'models'); if (getVisibleMonitorView() === 'steps' && latestSlice) { @@ -33616,33 +33268,8 @@ const StepsDetailView = defineComponent({ } ); - const onPanelKeydown = (e) => { - if (!selectedStepKey || uiStore.getState().stepsSubTab !== 'steps') return; - const tag = String(e?.target?.tagName || '').toUpperCase(); - if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' || e?.target?.isContentEditable) { - return; - } - if (e?.key === 'Escape') { - e.preventDefault?.(); - selectedStepKey = ''; - if (latestSlice) renderStepsData(latestSlice); - } else if (e?.key === 'ArrowUp') { - e.preventDefault?.(); - navigateInspectorStep(-1); - } else if (e?.key === 'ArrowDown') { - e.preventDefault?.(); - navigateInspectorStep(1); - } - }; - panelEl.addEventListener?.('keydown', onPanelKeydown); - onCleanup(() => { - if (inspCopyTimer) { - clearTimeout(inspCopyTimer); - inspCopyTimer = null; - } stepsExportMenu.destroy(); - panelEl.removeEventListener?.('keydown', onPanelKeydown); modelsAnalyticsPane.removeEventListener('scroll', onModelsPaneScroll); unsubUi(); unsubTelemetry(); @@ -33675,7 +33302,6 @@ const StepsDetailView = defineComponent({ stepSearchInput, stepQuickChipsEl, stepsExportMenu, - stepInspectorDrawerEl, modelsAnomalyStripEl, modelsListEl, inlineScopeSelect, diff --git a/sidecars/panel/index.html b/sidecars/panel/index.html index c05ece7..4e0d7c6 100644 --- a/sidecars/panel/index.html +++ b/sidecars/panel/index.html @@ -4,11 +4,11 @@ 用量监控 - +
- + diff --git a/sidecars/panel/src/components/widgets/StepTableWidget.js b/sidecars/panel/src/components/widgets/StepTableWidget.js index ff00382..2a5de1e 100644 --- a/sidecars/panel/src/components/widgets/StepTableWidget.js +++ b/sidecars/panel/src/components/widgets/StepTableWidget.js @@ -395,8 +395,6 @@ export const StepTableWidget = defineComponent({ typeof props.onVirtualHeightChange === 'function' ? props.onVirtualHeightChange : null; const onSortChange = typeof props.onSortChange === 'function' ? props.onSortChange : null; - const onSelectStep = - typeof props.onSelectStep === 'function' ? props.onSelectStep : null; const stepsTheadRow = h('tr'); const stepsThead = h('thead', {}, [stepsTheadRow]); @@ -1142,8 +1140,7 @@ export const StepTableWidget = defineComponent({ const stripeSig = isVirtualized ? (item.isStripeEven ? 'E' : 'O') : 'N'; const anomalySig = st.anomalySig || ''; const compactSig = isCompactionStepItem(st) ? 'C' : ''; - const selSig = ds.selectedStepKey && ds.selectedStepKey === item.rowKey ? 'S' : ''; - return `${locale}:${colOrderSig}:${stripeSig}:${badgeSig}:${anomalySig}:${compactSig}:${selSig}:${railActive}:${item.hasTurn}:${item.hasUp}:${item.hasDown}:${item.isStart}:${item.isLatest}:${item.prompt}:${parts}`; + return `${locale}:${colOrderSig}:${stripeSig}:${badgeSig}:${anomalySig}:${compactSig}:${railActive}:${item.hasTurn}:${item.hasUp}:${item.hasDown}:${item.isStart}:${item.isLatest}:${item.prompt}:${parts}`; }, createRow: (item) => { if (item.isSizer) { @@ -1396,21 +1393,11 @@ export const StepTableWidget = defineComponent({ const rowDiagGetter = hasRowTip ? () => buildStepRowDiagnostic(st, cellCtx.displaySettings, hasStepAnomaly, isCompactionRow) : null; - const isSelectedRow = Boolean(ds.selectedStepKey && ds.selectedStepKey === item.rowKey); patchClasses(tr, { 'is-compaction': isCompactionRow, 'is-anomaly-warn': isAnomalyWarn, 'is-anomaly-danger': isAnomalyDanger, - 'is-selectable': Boolean(onSelectStep), - 'is-selected': isSelectedRow, }); - if (onSelectStep) { - tr.onclick = () => { - onSelectStep(st, item.rowKey); - }; - } else { - tr.onclick = null; - } if (hasRowTip) { const anchorEl = firstTd || tr; tr.onmouseenter = () => { @@ -1584,7 +1571,6 @@ export const StepTableWidget = defineComponent({ allowNewRowFade = false, sortKey = '', sortDir = '', - selectedStepKey = '', } = {} ) { const normCascadeId = String(cascadeId || ''); @@ -1655,7 +1641,7 @@ export const StepTableWidget = defineComponent({ cascadeId, locale, colOrderSig, effectiveScopes, hasSubagents, isMergedMultiAgents, effectiveTurnRail, showStepAgentBadge, showStepSpeedColor, normTokenFmt, displaySettings.modelDisplayMode, displaySettings.showUpstreamModel, - displaySettings.orchestratorIdMode, normSortKey, normSortDir, String(selectedStepKey || ''), + displaySettings.orchestratorIdMode, normSortKey, normSortDir, ]); if ( lastRenderOptions === renderOptions && @@ -1754,7 +1740,6 @@ export const StepTableWidget = defineComponent({ totalBodyH, sizerSpec, effectiveScopes, - selectedStepKey: String(selectedStepKey || ''), formattedPrompts: new Map(), }; renderedSliceStart = -1; diff --git a/sidecars/panel/src/i18n/en-US.js b/sidecars/panel/src/i18n/en-US.js index 8454a76..3ea01b0 100644 --- a/sidecars/panel/src/i18n/en-US.js +++ b/sidecars/panel/src/i18n/en-US.js @@ -414,22 +414,6 @@ export const I18N_MESSAGES_EN_US = Object.freeze({ 'steps.chipLowCacheTip': 'Filter steps with cache hit rate below 50%', 'steps.chipSlowTtft': 'Slow TTFT {count}', 'steps.chipSlowTtftTip': 'Filter severely delayed steps with TTFT >= 30s', - 'steps.inspPrevAria': 'Previous step', - 'steps.inspNextAria': 'Next step', - 'steps.inspCopy': 'Copy', - 'steps.inspCopied': 'Copied', - 'steps.inspCloseAria': 'Close step inspector', - 'steps.inspWaterfallTtft': 'TTFT {sec}', - 'steps.inspWaterfallStream': 'Stream {sec}', - 'steps.inspWaterfallOther': 'Tool/Wait {sec}', - 'steps.inspWaterfallThink': 'Think {sec}', - 'steps.inspInputLabel': 'Fresh Input', - 'steps.inspCacheLabel': 'Cache Read', - 'steps.inspOutputLabel': 'Output', - 'steps.inspOutputSplit': 'Think {think} / Reply {reply}', - 'steps.inspContextCostLabel': 'Context / Cost', - 'steps.inspPromptTitle': 'Turn Prompt', - 'steps.inspRowClickTip': 'Click row to inspect step details', 'steps.exportMenuAria': 'Export and report actions', 'steps.exportXlsx': 'Export Excel (.xlsx)', 'steps.exportXlsxTip': 'Export styled multi-sheet Excel workbook for steps and model summary', diff --git a/sidecars/panel/src/i18n/zh-CN.js b/sidecars/panel/src/i18n/zh-CN.js index 66db785..5353788 100644 --- a/sidecars/panel/src/i18n/zh-CN.js +++ b/sidecars/panel/src/i18n/zh-CN.js @@ -414,22 +414,6 @@ export const I18N_MESSAGES_ZH_CN = Object.freeze({ 'steps.chipLowCacheTip': '筛选缓存命中率低于 50% 的步骤', 'steps.chipSlowTtft': '慢首字 {count}', 'steps.chipSlowTtftTip': '筛选首字延迟 >= 30s 的严重卡顿步骤', - 'steps.inspPrevAria': '查看上一步', - 'steps.inspNextAria': '查看下一步', - 'steps.inspCopy': '复制诊断', - 'steps.inspCopied': '已复制', - 'steps.inspCloseAria': '关闭单步详情', - 'steps.inspWaterfallTtft': '首字 {sec}', - 'steps.inspWaterfallStream': '流式 {sec}', - 'steps.inspWaterfallOther': '工具/等待 {sec}', - 'steps.inspWaterfallThink': '思考 {sec}', - 'steps.inspInputLabel': '新输入', - 'steps.inspCacheLabel': '缓存读取', - 'steps.inspOutputLabel': '输出', - 'steps.inspOutputSplit': '思 {think} / 回 {reply}', - 'steps.inspContextCostLabel': '上下文 / 费用', - 'steps.inspPromptTitle': '本轮提问', - 'steps.inspRowClickTip': '点击查看单步详情', 'steps.exportMenuAria': '导出及报告选项', 'steps.exportXlsx': '导出 Excel (.xlsx)', 'steps.exportXlsxTip': '导出排版精美的步骤明细及模型汇总 Excel 报表', diff --git a/sidecars/panel/src/styles/views-tables.css b/sidecars/panel/src/styles/views-tables.css index 355b724..6d2a3dd 100644 --- a/sidecars/panel/src/styles/views-tables.css +++ b/sidecars/panel/src/styles/views-tables.css @@ -1316,267 +1316,8 @@ color: var(--metric-info); } -.data-table tbody tr.is-selectable { - cursor: pointer; -} - -.data-table tbody tr.is-selected { - background: var(--surface-active) !important; -} - -.step-inspector-drawer { - display: flex; - flex-direction: column; - gap: 8px; - padding: 9px 10px; - margin-top: 4px; - border-top: 1px solid var(--border-strong); - background: var(--surface-subtle); - border-radius: 0 0 var(--radius-sm) var(--radius-sm); - flex-shrink: 0; -} - -.step-inspector-drawer[hidden] { - display: none !important; -} - -.step-insp-head { - display: flex; - align-items: center; - justify-content: space-between; - gap: 8px; - min-width: 0; -} - -.step-insp-head-left { - display: inline-flex; - align-items: center; - gap: 6px; - min-width: 0; - overflow: hidden; -} - -.step-insp-badge { - display: inline-flex; - align-items: center; - padding: 1px 6px; - border-radius: var(--radius-xs); - background: var(--accent-primary-soft); - color: var(--accent-primary); - font-size: var(--fs-xs); - font-weight: 600; - flex-shrink: 0; -} - -.step-insp-model { - font-size: var(--fs-base-sm); - color: var(--text-primary); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.step-insp-time { - font-size: var(--fs-xs); - white-space: nowrap; - flex-shrink: 0; -} - -.step-insp-head-actions { - display: inline-flex; - align-items: center; - gap: 4px; - flex-shrink: 0; -} - -.step-insp-icon-btn, -.step-insp-copy-btn { - display: inline-flex; - align-items: center; - justify-content: center; - gap: 4px; - height: 22px; - padding: 0 6px; - border-radius: var(--radius-xs); - border: 1px solid var(--border-hairline); - background: var(--surface-panel); - color: var(--text-secondary); - font-family: var(--font-sans); - font-size: var(--fs-xs); - cursor: pointer; -} - -.step-insp-icon-btn { - width: 22px; - padding: 0; -} - -.step-insp-icon-btn:hover:not(:disabled), -.step-insp-copy-btn:hover { - background: var(--surface-hover); - color: var(--text-primary); -} - -.step-insp-icon-btn:disabled { - opacity: 0.4; - cursor: default; -} - -.step-insp-copy-btn.is-copied { - color: var(--metric-ok); - border-color: color-mix(in srgb, var(--metric-ok) 40%, var(--border-hairline)); -} - -.step-insp-waterfall { - display: flex; - flex-direction: column; - gap: 4px; -} - -.step-insp-waterfall[hidden] { - display: none !important; -} - -.step-insp-wf-track { - display: flex; - width: 100%; - height: 5px; - border-radius: var(--radius-pill); - overflow: hidden; - background: var(--surface-track); -} - -.step-insp-wf-seg { - height: 100%; - min-width: 0; -} - -.step-insp-wf-seg.is-ttft { - background: var(--metric-warn); -} - -.step-insp-wf-seg.is-stream { - background: var(--metric-ok); -} - -.step-insp-wf-seg.is-other { - background: color-mix(in srgb, var(--text-muted) 48%, transparent); -} - -.step-insp-wf-legend { - font-size: var(--fs-xs); - color: var(--text-secondary); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.step-insp-grid { - display: grid; - grid-template-columns: repeat(4, minmax(0, 1fr)); - gap: 6px; -} - -.step-insp-kpi { - display: flex; - flex-direction: column; - gap: 1px; - padding: 5px 7px; - border-radius: var(--radius-sm); - border: 1px solid var(--border-hairline); - background: var(--surface-panel); - min-width: 0; -} - -.step-insp-kpi-lbl { - font-size: var(--fs-2xs); - color: var(--text-muted); - white-space: nowrap; -} - -.step-insp-kpi-val { - font-size: var(--fs-sm); - color: var(--text-primary); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.step-insp-kpi-sub { - font-size: var(--fs-2xs); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.step-insp-prompt { - display: flex; - flex-direction: column; - gap: 2px; - padding: 5px 8px; - border-radius: var(--radius-sm); - background: var(--surface-panel); - border: 1px solid var(--border-hairline); -} - -.step-insp-prompt[hidden] { - display: none !important; -} - -.step-insp-prompt-lbl { - font-size: var(--fs-2xs); - color: var(--text-muted); -} - -.step-insp-prompt-text { - font-size: var(--fs-sm); - color: var(--text-primary); - line-height: 1.4; - max-height: 54px; - overflow-y: auto; - white-space: pre-wrap; - word-break: break-word; - scrollbar-width: none; -} - -.step-insp-prompt-text::-webkit-scrollbar { - display: none; -} - -.step-insp-anomalies { - font-size: var(--fs-xs); - color: var(--metric-danger); - padding: 4px 8px; - border-radius: var(--radius-sm); - background: var(--metric-danger-soft); -} - -.step-insp-anomalies[hidden] { - display: none !important; -} - [data-modern-ui="true"] .steps-chip-btn { border: none; border-radius: var(--radius-pill); background: var(--modern-surface-subtle); } - -[data-modern-ui="true"] .step-inspector-drawer { - border-top: none; - border-radius: 10px; - background: var(--modern-surface-subtle); -} - -[data-modern-ui="true"] .step-insp-kpi, -[data-modern-ui="true"] .step-insp-prompt, -[data-modern-ui="true"] .step-insp-icon-btn, -[data-modern-ui="true"] .step-insp-copy-btn { - border: none; - background: var(--modern-surface-card); -} - -@media (max-width: 440px) { - .step-insp-grid { - grid-template-columns: repeat(2, minmax(0, 1fr)); - } -} diff --git a/sidecars/panel/src/views/StepsDetailView.js b/sidecars/panel/src/views/StepsDetailView.js index 4a8f9c2..8691e4a 100644 --- a/sidecars/panel/src/views/StepsDetailView.js +++ b/sidecars/panel/src/views/StepsDetailView.js @@ -18,7 +18,6 @@ import { buildModelAnomalyDiagnostic, formatAnomalyKindLabel, formatAnomalyTagText, - formatCompactDateTime, formatMetric, formatPctNumber, formatSpeedMetric, @@ -34,13 +33,8 @@ import { speedReasonText, } from '../core/formatters.js'; import { - buildStepDiagnosticMarkdown, computeStepQuickChipCounts, - computeStepTimingWaterfall, - copyPlainTextToClipboard, filterStepsBySearchAndChip, - findPrevAgentContextTokens, - getStepSelectionKey, } from '../core/stepInspector.js'; import { buildStepsExportBaseName, @@ -301,11 +295,9 @@ export const StepsDetailView = defineComponent({ let anomalyKindFilter = ''; let stepSearchQuery = ''; let stepQuickChip = ''; - let selectedStepKey = ''; let currentTableSteps = []; let currentAllConvSteps = []; let currentDisplaySettings = {}; - let inspCopyTimer = null; let sortKey = ''; let sortDir = ''; let cachedSortSrc = null; @@ -392,10 +384,6 @@ export const StepsDetailView = defineComponent({ sortDir = nextDir || ''; if (latestSlice) renderStepsData(latestSlice); }, - onSelectStep: (_st, rowKey) => { - selectedStepKey = selectedStepKey === rowKey ? '' : rowKey; - if (latestSlice) renderStepsData(latestSlice); - }, }); const { stepsTablePane, @@ -556,288 +544,6 @@ export const StepsDetailView = defineComponent({ [stepSearchWrapEl, stepQuickChipsEl] ); - // --- 点击行展开的单步透视诊断抽屉 --- - const inspStepBadgeEl = h('span', { className: 'step-insp-badge text-mono' }); - const inspModelEl = h('strong', { className: 'step-insp-model' }); - const inspTimeEl = h('span', { className: 'step-insp-time text-mono text-muted' }); - const inspPrevBtn = h( - 'button', - { - type: 'button', - className: 'step-insp-icon-btn', - 'aria-label': t('steps.inspPrevAria'), - title: t('steps.inspPrevAria'), - onclick: () => navigateInspectorStep(-1), - }, - [createSvgIcon('chevron-up', { size: 12 })] - ); - const inspNextBtn = h( - 'button', - { - type: 'button', - className: 'step-insp-icon-btn', - 'aria-label': t('steps.inspNextAria'), - title: t('steps.inspNextAria'), - onclick: () => navigateInspectorStep(1), - }, - [createSvgIcon('chevron-down', { size: 12 })] - ); - const inspCopyIcon = createSvgIcon('copy', { size: 11 }); - const inspCopyLabel = h('span', { text: t('steps.inspCopy') }); - let currentInspectedStep = null; - let currentInspectedPrevCtx = null; - const inspCopyBtn = h( - 'button', - { - type: 'button', - className: 'step-insp-copy-btn', - onclick: async () => { - if (!currentInspectedStep) return; - const md = buildStepDiagnosticMarkdown(currentInspectedStep, { - prevContextTokens: currentInspectedPrevCtx, - displaySettings: currentDisplaySettings, - }); - await copyPlainTextToClipboard(md); - patchSvgIcon(inspCopyIcon, 'check'); - patchText(inspCopyLabel, t('steps.inspCopied')); - patchClasses(inspCopyBtn, { 'is-copied': true }); - if (inspCopyTimer) clearTimeout(inspCopyTimer); - inspCopyTimer = setTimeout(() => { - inspCopyTimer = null; - patchSvgIcon(inspCopyIcon, 'copy'); - patchText(inspCopyLabel, t('steps.inspCopy')); - patchClasses(inspCopyBtn, { 'is-copied': false }); - }, 1600); - }, - }, - [inspCopyIcon, inspCopyLabel] - ); - const inspCloseBtn = h( - 'button', - { - type: 'button', - className: 'step-insp-icon-btn', - 'aria-label': t('steps.inspCloseAria'), - title: t('steps.inspCloseAria'), - onclick: () => { - selectedStepKey = ''; - if (latestSlice) renderStepsData(latestSlice); - }, - }, - [createSvgIcon('close', { size: 12 })] - ); - - const inspWfTtftSeg = h('div', { className: 'step-insp-wf-seg is-ttft' }); - const inspWfStreamSeg = h('div', { className: 'step-insp-wf-seg is-stream' }); - const inspWfOtherSeg = h('div', { className: 'step-insp-wf-seg is-other' }); - const inspWfTrackEl = h('div', { className: 'step-insp-wf-track' }, [ - inspWfTtftSeg, - inspWfStreamSeg, - inspWfOtherSeg, - ]); - const inspWfLegendEl = h('div', { className: 'step-insp-wf-legend text-mono' }); - const inspWaterfallEl = h('div', { className: 'step-insp-waterfall', hidden: true }, [ - inspWfTrackEl, - inspWfLegendEl, - ]); - - function createInspKpiCell(labelText) { - const lbl = h('span', { className: 'step-insp-kpi-lbl', text: labelText }); - const val = h('strong', { className: 'step-insp-kpi-val text-mono', text: '—' }); - const sub = h('span', { className: 'step-insp-kpi-sub text-mono text-muted', text: '' }); - return { - el: h('div', { className: 'step-insp-kpi' }, [lbl, val, sub]), - lbl, - val, - sub, - }; - } - const inspKpiInput = createInspKpiCell(t('steps.inspInputLabel')); - const inspKpiCache = createInspKpiCell(t('steps.inspCacheLabel')); - const inspKpiOutput = createInspKpiCell(t('steps.inspOutputLabel')); - const inspKpiCtxCost = createInspKpiCell(t('steps.inspContextCostLabel')); - const inspGridEl = h('div', { className: 'step-insp-grid' }, [ - inspKpiInput.el, - inspKpiCache.el, - inspKpiOutput.el, - inspKpiCtxCost.el, - ]); - - const inspPromptLabelEl = h('span', { - className: 'step-insp-prompt-lbl', - text: t('steps.inspPromptTitle'), - }); - const inspPromptTextEl = h('div', { className: 'step-insp-prompt-text' }); - const inspPromptWrapEl = h('div', { className: 'step-insp-prompt', hidden: true }, [ - inspPromptLabelEl, - inspPromptTextEl, - ]); - const inspAnomaliesEl = h('div', { className: 'step-insp-anomalies text-mono', hidden: true }); - - const stepInspectorDrawerEl = h( - 'div', - { className: 'step-inspector-drawer', hidden: true }, - [ - h('div', { className: 'step-insp-head' }, [ - h('div', { className: 'step-insp-head-left' }, [ - inspStepBadgeEl, - inspModelEl, - inspTimeEl, - ]), - h('div', { className: 'step-insp-head-actions' }, [ - inspPrevBtn, - inspNextBtn, - inspCopyBtn, - inspCloseBtn, - ]), - ]), - inspWaterfallEl, - inspGridEl, - inspPromptWrapEl, - inspAnomaliesEl, - ] - ); - - function navigateInspectorStep(delta) { - if (!selectedStepKey || currentTableSteps.length === 0) return; - const cid = String(latestSlice?.cascadeId || latestSlice?.activeConversation?.cascadeId || ''); - const curIdx = currentTableSteps.findIndex( - (st) => getStepSelectionKey(st, cid) === selectedStepKey - ); - if (curIdx < 0) return; - const nextIdx = curIdx + delta; - if (nextIdx < 0 || nextIdx >= currentTableSteps.length) return; - selectedStepKey = getStepSelectionKey(currentTableSteps[nextIdx], cid); - if (latestSlice) renderStepsData(latestSlice); - } - - function syncStepInspectorDrawer(tableSteps, allConvSteps, cascadeId, displaySettings, showModels) { - if (showModels || !selectedStepKey || !Array.isArray(tableSteps) || tableSteps.length === 0) { - currentInspectedStep = null; - currentInspectedPrevCtx = null; - patchAttr(stepInspectorDrawerEl, 'hidden', true); - return; - } - const idx = tableSteps.findIndex( - (st) => getStepSelectionKey(st, cascadeId) === selectedStepKey - ); - if (idx < 0) { - selectedStepKey = ''; - currentInspectedStep = null; - currentInspectedPrevCtx = null; - patchAttr(stepInspectorDrawerEl, 'hidden', true); - return; - } - const st = tableSteps[idx]; - currentInspectedStep = st; - const prevCtx = findPrevAgentContextTokens(allConvSteps, st); - currentInspectedPrevCtx = prevCtx; - - patchAttr(stepInspectorDrawerEl, 'hidden', false); - patchText(inspStepBadgeEl, `#${st.stepIndex ?? '—'}`); - const mInfo = resolveModelDisplayInfo(st, displaySettings); - patchText(inspModelEl, mInfo.text); - patchAttr(inspModelEl, 'title', mInfo.title || mInfo.text); - patchText(inspTimeEl, st.createdAtMs ? formatCompactDateTime(st.createdAtMs) : ''); - patchAttr(inspPrevBtn, 'disabled', idx <= 0); - patchAttr(inspNextBtn, 'disabled', idx >= tableSteps.length - 1); - - const wf = computeStepTimingWaterfall(st); - patchAttr(inspWaterfallEl, 'hidden', !wf); - if (wf) { - inspWfTtftSeg.style.width = `${wf.ttftPct}%`; - inspWfStreamSeg.style.width = `${wf.streamPct}%`; - inspWfOtherSeg.style.width = `${wf.otherPct}%`; - const parts = [formatSpeedMetric(st.tokPerSec, ' tok/s')]; - if (wf.ttftSec > 0) { - parts.push(t('steps.inspWaterfallTtft', { sec: formatTimingDetailSec(wf.ttftSec) })); - } - if (wf.streamSec > 0) { - parts.push(t('steps.inspWaterfallStream', { sec: formatTimingDetailSec(wf.streamSec) })); - } - if (wf.otherSec > 0.05) { - parts.push(t('steps.inspWaterfallOther', { sec: formatTimingDetailSec(wf.otherSec) })); - } - if (wf.thinkingSec > 0) { - parts.push(t('steps.inspWaterfallThink', { sec: formatTimingDetailSec(wf.thinkingSec) })); - } - const reason = st.selectedSpeedReason ? speedReasonText(st.selectedSpeedReason) : ''; - if (reason) parts.push(reason); - patchText(inspWfLegendEl, parts.join(' · ')); - } - - const inTok = Number(st.inputTokens || 0); - const cacheTok = Number(st.cacheReadTokens || 0); - const outTok = Number(st.outputTokens || 0); - const thinkTok = Number(st.thinkingTokens || 0); - const replyTok = - st.responseTokens != null ? Number(st.responseTokens) : Math.max(0, outTok - thinkTok); - const promptTok = inTok + cacheTok; - const cachePct = - st.cacheHitPct != null && Number.isFinite(Number(st.cacheHitPct)) - ? Number(st.cacheHitPct) - : promptTok > 0 - ? (cacheTok / promptTok) * 100 - : 0; - const ctxTok = Number(st.contextTokens || promptTok + outTok); - - patchText(inspKpiInput.lbl, t('steps.inspInputLabel')); - patchText(inspKpiInput.val, formatTokensPrecise(inTok)); - patchText(inspKpiInput.sub, st.inputCostUsd != null ? formatUsd(st.inputCostUsd, { precise: true }) : ''); - - patchText(inspKpiCache.lbl, t('steps.inspCacheLabel')); - patchText(inspKpiCache.val, formatTokensPrecise(cacheTok)); - patchText(inspKpiCache.sub, formatPctNumber(cachePct, { withSymbol: true })); - - patchText(inspKpiOutput.lbl, t('steps.inspOutputLabel')); - patchText(inspKpiOutput.val, formatTokensPrecise(outTok)); - patchText( - inspKpiOutput.sub, - thinkTok > 0 - ? t('steps.inspOutputSplit', { - think: formatTokens(thinkTok), - reply: formatTokens(replyTok), - }) - : st.outCostUsd != null - ? formatUsd(st.outCostUsd, { precise: true }) - : '' - ); - - patchText(inspKpiCtxCost.lbl, t('steps.inspContextCostLabel')); - const deltaStr = - prevCtx != null && ctxTok > 0 - ? ` (${ctxTok >= prevCtx ? '+' : '-'}${formatTokens(Math.abs(ctxTok - prevCtx))})` - : ''; - patchText(inspKpiCtxCost.val, `${formatTokens(ctxTok)}${deltaStr}`); - patchText(inspKpiCtxCost.sub, formatUsd(st.costUsd, { precise: true })); - - const promptText = String(st.turnPrompt || st.rootTurnPrompt || '').trim(); - patchAttr(inspPromptWrapEl, 'hidden', !promptText); - if (promptText) { - patchText(inspPromptLabelEl, t('steps.inspPromptTitle')); - patchText(inspPromptTextEl, promptText); - } - - const anom = st.anomaly; - const hasAnom = Boolean(anom && Number(anom.count) > 0); - patchAttr(inspAnomaliesEl, 'hidden', !hasAnom); - if (hasAnom) { - const itemsText = Array.isArray(anom.items) && anom.items.length > 0 - ? anom.items - .map((it) => { - const lbl = formatAnomalyKindLabel(it.kind || anom.primaryKind); - const code = it.httpStatus ? ` HTTP ${it.httpStatus}` : ''; - const delay = Number(it.delaySec) > 0 ? ` (${Number(it.delaySec).toFixed(1)}s)` : ''; - return `${lbl}${code}${delay}`; - }) - .join(' · ') - : Object.entries(anom.kinds || {}) - .map(([k, v]) => `${formatAnomalyKindLabel(k)} ×${v}`) - .join(' · '); - patchText(inspAnomaliesEl, itemsText); - } - } - // --- 子视图 2:总汇总分析面板 --- let selectedLineMetric = 'totalTokens'; let selectedFitMetric = 'tps'; @@ -1007,7 +713,6 @@ export const StepsDetailView = defineComponent({ stepsFilterToolbarEl, anomalyFilterBarEl, stepsScroll.el, - stepInspectorDrawerEl, modelsScroll.el, turnTipEl, anomalyTipEl, @@ -1084,13 +789,6 @@ export const StepsDetailView = defineComponent({ patchAttr(stepSearchInput, 'placeholder', t('steps.searchPlaceholder')); patchAttr(stepSearchInput, 'aria-label', t('steps.searchPlaceholder')); patchAttr(stepSearchClearBtn, 'aria-label', t('steps.searchClearAria')); - patchAttr(inspPrevBtn, 'aria-label', t('steps.inspPrevAria')); - patchAttr(inspPrevBtn, 'title', t('steps.inspPrevAria')); - patchAttr(inspNextBtn, 'aria-label', t('steps.inspNextAria')); - patchAttr(inspNextBtn, 'title', t('steps.inspNextAria')); - patchAttr(inspCloseBtn, 'aria-label', t('steps.inspCloseAria')); - patchAttr(inspCloseBtn, 'title', t('steps.inspCloseAria')); - if (!inspCopyTimer) patchText(inspCopyLabel, t('steps.inspCopy')); stepsExportMenu.refs.setAriaLabel(t('steps.exportMenuAria')); stepsExportMenu.refs.updateItemLabels({ xlsx: { label: t('steps.exportXlsx'), title: t('steps.exportXlsxTip') }, @@ -1136,7 +834,6 @@ export const StepsDetailView = defineComponent({ stepSearchInput.value = ''; patchAttr(stepSearchClearBtn, 'hidden', true); stepQuickChip = ''; - selectedStepKey = ''; sortKey = ''; sortDir = ''; } @@ -1452,14 +1149,11 @@ export const StepsDetailView = defineComponent({ allowNewRowFade: shouldAnimateNewRows, sortKey, sortDir, - selectedStepKey, }); - syncStepInspectorDrawer(tableSteps, allConversationSteps, currentCid, displaySettings, false); stepsScroll.refresh(); fitPinnedWhileVisible = false; return; } - syncStepInspectorDrawer(tableSteps, allConversationSteps, currentCid, displaySettings, true); const chronoSteps = getMemoizedChronoSteps(steps, isMergedMultiAgents); const stepTtftFallbackMap = new Map(); @@ -2003,7 +1697,6 @@ export const StepsDetailView = defineComponent({ tab !== 'steps' || !toolbarAllowed || (currentTableSteps.length === 0 && !stepSearchQuery && !stepQuickChip) ); stepsExportMenu.refs.setHidden(tab !== 'steps' || currentAllConvSteps.length === 0); - patchAttr(stepInspectorDrawerEl, 'hidden', tab !== 'steps' || !selectedStepKey); patchAttr(stepsScroll.el, 'hidden', tab !== 'steps'); patchAttr(modelsScroll.el, 'hidden', tab !== 'models'); if (getVisibleMonitorView() === 'steps' && latestSlice) { @@ -2100,33 +1793,8 @@ export const StepsDetailView = defineComponent({ } ); - const onPanelKeydown = (e) => { - if (!selectedStepKey || uiStore.getState().stepsSubTab !== 'steps') return; - const tag = String(e?.target?.tagName || '').toUpperCase(); - if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' || e?.target?.isContentEditable) { - return; - } - if (e?.key === 'Escape') { - e.preventDefault?.(); - selectedStepKey = ''; - if (latestSlice) renderStepsData(latestSlice); - } else if (e?.key === 'ArrowUp') { - e.preventDefault?.(); - navigateInspectorStep(-1); - } else if (e?.key === 'ArrowDown') { - e.preventDefault?.(); - navigateInspectorStep(1); - } - }; - panelEl.addEventListener?.('keydown', onPanelKeydown); - onCleanup(() => { - if (inspCopyTimer) { - clearTimeout(inspCopyTimer); - inspCopyTimer = null; - } stepsExportMenu.destroy(); - panelEl.removeEventListener?.('keydown', onPanelKeydown); modelsAnalyticsPane.removeEventListener('scroll', onModelsPaneScroll); unsubUi(); unsubTelemetry(); @@ -2159,7 +1827,6 @@ export const StepsDetailView = defineComponent({ stepSearchInput, stepQuickChipsEl, stepsExportMenu, - stepInspectorDrawerEl, modelsAnomalyStripEl, modelsListEl, inlineScopeSelect, diff --git a/sidecars/panel/styles.css b/sidecars/panel/styles.css index 6788be8..21c7034 100644 --- a/sidecars/panel/styles.css +++ b/sidecars/panel/styles.css @@ -5409,271 +5409,12 @@ html[data-standalone="true"] .app-shell { color: var(--metric-info); } -.data-table tbody tr.is-selectable { - cursor: pointer; -} - -.data-table tbody tr.is-selected { - background: var(--surface-active) !important; -} - -.step-inspector-drawer { - display: flex; - flex-direction: column; - gap: 8px; - padding: 9px 10px; - margin-top: 4px; - border-top: 1px solid var(--border-strong); - background: var(--surface-subtle); - border-radius: 0 0 var(--radius-sm) var(--radius-sm); - flex-shrink: 0; -} - -.step-inspector-drawer[hidden] { - display: none !important; -} - -.step-insp-head { - display: flex; - align-items: center; - justify-content: space-between; - gap: 8px; - min-width: 0; -} - -.step-insp-head-left { - display: inline-flex; - align-items: center; - gap: 6px; - min-width: 0; - overflow: hidden; -} - -.step-insp-badge { - display: inline-flex; - align-items: center; - padding: 1px 6px; - border-radius: var(--radius-xs); - background: var(--accent-primary-soft); - color: var(--accent-primary); - font-size: var(--fs-xs); - font-weight: 600; - flex-shrink: 0; -} - -.step-insp-model { - font-size: var(--fs-base-sm); - color: var(--text-primary); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.step-insp-time { - font-size: var(--fs-xs); - white-space: nowrap; - flex-shrink: 0; -} - -.step-insp-head-actions { - display: inline-flex; - align-items: center; - gap: 4px; - flex-shrink: 0; -} - -.step-insp-icon-btn, -.step-insp-copy-btn { - display: inline-flex; - align-items: center; - justify-content: center; - gap: 4px; - height: 22px; - padding: 0 6px; - border-radius: var(--radius-xs); - border: 1px solid var(--border-hairline); - background: var(--surface-panel); - color: var(--text-secondary); - font-family: var(--font-sans); - font-size: var(--fs-xs); - cursor: pointer; -} - -.step-insp-icon-btn { - width: 22px; - padding: 0; -} - -.step-insp-icon-btn:hover:not(:disabled), -.step-insp-copy-btn:hover { - background: var(--surface-hover); - color: var(--text-primary); -} - -.step-insp-icon-btn:disabled { - opacity: 0.4; - cursor: default; -} - -.step-insp-copy-btn.is-copied { - color: var(--metric-ok); - border-color: color-mix(in srgb, var(--metric-ok) 40%, var(--border-hairline)); -} - -.step-insp-waterfall { - display: flex; - flex-direction: column; - gap: 4px; -} - -.step-insp-waterfall[hidden] { - display: none !important; -} - -.step-insp-wf-track { - display: flex; - width: 100%; - height: 5px; - border-radius: var(--radius-pill); - overflow: hidden; - background: var(--surface-track); -} - -.step-insp-wf-seg { - height: 100%; - min-width: 0; -} - -.step-insp-wf-seg.is-ttft { - background: var(--metric-warn); -} - -.step-insp-wf-seg.is-stream { - background: var(--metric-ok); -} - -.step-insp-wf-seg.is-other { - background: color-mix(in srgb, var(--text-muted) 48%, transparent); -} - -.step-insp-wf-legend { - font-size: var(--fs-xs); - color: var(--text-secondary); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.step-insp-grid { - display: grid; - grid-template-columns: repeat(4, minmax(0, 1fr)); - gap: 6px; -} - -.step-insp-kpi { - display: flex; - flex-direction: column; - gap: 1px; - padding: 5px 7px; - border-radius: var(--radius-sm); - border: 1px solid var(--border-hairline); - background: var(--surface-panel); - min-width: 0; -} - -.step-insp-kpi-lbl { - font-size: var(--fs-2xs); - color: var(--text-muted); - white-space: nowrap; -} - -.step-insp-kpi-val { - font-size: var(--fs-sm); - color: var(--text-primary); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.step-insp-kpi-sub { - font-size: var(--fs-2xs); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.step-insp-prompt { - display: flex; - flex-direction: column; - gap: 2px; - padding: 5px 8px; - border-radius: var(--radius-sm); - background: var(--surface-panel); - border: 1px solid var(--border-hairline); -} - -.step-insp-prompt[hidden] { - display: none !important; -} - -.step-insp-prompt-lbl { - font-size: var(--fs-2xs); - color: var(--text-muted); -} - -.step-insp-prompt-text { - font-size: var(--fs-sm); - color: var(--text-primary); - line-height: 1.4; - max-height: 54px; - overflow-y: auto; - white-space: pre-wrap; - word-break: break-word; - scrollbar-width: none; -} - -.step-insp-prompt-text::-webkit-scrollbar { - display: none; -} - -.step-insp-anomalies { - font-size: var(--fs-xs); - color: var(--metric-danger); - padding: 4px 8px; - border-radius: var(--radius-sm); - background: var(--metric-danger-soft); -} - -.step-insp-anomalies[hidden] { - display: none !important; -} - [data-modern-ui="true"] .steps-chip-btn { border: none; border-radius: var(--radius-pill); background: var(--modern-surface-subtle); } -[data-modern-ui="true"] .step-inspector-drawer { - border-top: none; - border-radius: 10px; - background: var(--modern-surface-subtle); -} - -[data-modern-ui="true"] .step-insp-kpi, -[data-modern-ui="true"] .step-insp-prompt, -[data-modern-ui="true"] .step-insp-icon-btn, -[data-modern-ui="true"] .step-insp-copy-btn { - border: none; - background: var(--modern-surface-card); -} - -@media (max-width: 440px) { - .step-insp-grid { - grid-template-columns: repeat(2, minmax(0, 1fr)); - } -} - /* --- src/styles/views-settings.css --- */ /* * 模块化偏好设置样式表 (views-settings.css). diff --git a/sidecars/panel/test/practical-enhancements.test.mjs b/sidecars/panel/test/practical-enhancements.test.mjs index 8111f3f..b1f3a26 100644 --- a/sidecars/panel/test/practical-enhancements.test.mjs +++ b/sidecars/panel/test/practical-enhancements.test.mjs @@ -1436,18 +1436,11 @@ test('Feature 10: StepsDetailView live search, dynamic diagnostic chips, and cli rows = view.el.querySelectorAll('tbody tr'); assert.equal(rows.length, 3); - // Click row #4 -> opens inspector drawer with prompt, waterfall, and delta - assert.equal(view.refs.stepInspectorDrawerEl.hasAttribute('hidden'), true); - - rows[0].onclick(); - assert.equal(view.refs.stepInspectorDrawerEl.hasAttribute('hidden'), false); - assert.equal(rows[0].classList.contains('is-selected'), true); - assert.match(view.refs.stepInspectorDrawerEl.textContent, /Debug SQLite migrator/); - assert.match(view.refs.stepInspectorDrawerEl.textContent, /\+79\.1k/); - - // Close drawer cleanly by clicking same row again - rows[0].onclick(); - assert.equal(view.refs.stepInspectorDrawerEl.hasAttribute('hidden'), true); + // Step rows do not expose row-click diagnostic drawer or selection handlers + assert.equal(view.el.querySelector('.step-inspector-drawer'), null); + assert.equal(Boolean(rows[0].onclick), false); + assert.equal(rows[0].classList.contains('is-selectable'), false); + assert.equal(rows[0].classList.contains('is-selected'), false); }); test('Feature 11: native multi-sheet localized XLSX, formula-safe CSV and bilingual Markdown report export', async () => { @@ -2446,8 +2439,9 @@ test('P0 regression: V4 display-projected steps open inspector, preserve waterfa `${cascadeUuid}-${projectedLikeStep.stepIndex}` ); const tr = stepsView.el.querySelectorAll('tbody tr')[0]; - tr.onclick({}); - assert.equal(stepsView.refs.stepInspectorDrawerEl.hasAttribute('hidden'), false); + assert.ok(tr, 'projected step row rendered'); + assert.equal(Boolean(tr.onclick), false, 'clicking step row does not trigger diagnostic drawer'); + assert.equal(stepsView.el.querySelector('.step-inspector-drawer'), null); stepsView.destroy(); stepsView = null;