diff --git a/sidecars/panel/app.js b/sidecars/panel/app.js
index 780e7dd..1890089 100644
--- a/sidecars/panel/app.js
+++ b/sidecars/panel/app.js
@@ -18,18 +18,16 @@ function escapeHtml(str) {
.replace(/"/g, '"');
}
-function formatMetric(value, unit = '', estimated = false) {
- return Number.isFinite(value) ? `${estimated ? '≈' : ''}${value.toFixed(1)}${unit}` : '—';
+function formatMetric(value, unit = '') {
+ return Number.isFinite(value) ? `${value.toFixed(1)}${unit}` : '—';
}
function speedReasonText(reason) {
return ({
compaction: '自动压缩不计测速',
incomplete_or_invalid_timing: '未完成或计时缺失',
- tool_timing_unavailable: '工具输出无法独立计时',
- no_answer_text: '无正文',
- token_breakdown_unavailable: '输出 Token 构成不明',
- answer_start_unavailable: '缺少正文起点',
+ invalid_output_tokens: '输出 Token 计数无效',
+ short_timing: '计时过短,暂不测速',
short_sample: '短样本,不计均速',
legacy_cache: '旧缓存,等待重新读取',
})[reason] || '';
@@ -39,25 +37,6 @@ function sampleSummary(summary) {
return `${summary?.sampleCount || 0}/${(summary?.sampleCount || 0) + (summary?.excludedCount || 0)} 步`;
}
-// Display a measured request rate when the answer phase cannot be separated.
-// This presentation choice never changes the backend's homogeneous means.
-function stepSpeedDisplay(step = {}, mode = 'stream') {
- const reason = speedReasonText(step.selectedSpeedReason || step.speedReason);
- const valid = step.measurementVersion === 1 && step.isComplete === true;
- if (valid && mode !== 'total' && !step.isCompactionStep && Number.isFinite(step.streamTokPerSec)) {
- return { value: step.streamTokPerSec, estimated: true, label: '正文估算',
- detail: step.responseShortSample ? '正文估算 · 短样本' : '正文估算',
- explanation: reason || '正文阶段估算' };
- }
- if (valid && Number.isFinite(step.totalTokPerSec) && step.totalDurationSec > 0) {
- return { value: step.totalTokPerSec, estimated: false, label: '整体吞吐',
- detail: step.isCompactionStep ? '整体吞吐 · 压缩' : '整体吞吐',
- explanation: `${mode !== 'total' && reason ? `${reason};` : ''}总输出 Token(含思考)÷ 请求总耗时${mode !== 'total' ? ';不计正文均速' : ''}${step.isCompactionStep ? ';压缩不计均速' : ''}` };
- }
- return { value: null, estimated: false, label: '待计时', detail: reason || '计时不可用',
- explanation: reason || '计时不可用' };
-}
-
function formatTokens(num) {
const n = Number(num || 0);
if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`;
@@ -175,15 +154,14 @@ function renderAllPools(pools, activeFamily) {
let lastStepsRenderSig = '';
let lastModelsRenderSig = '';
-function renderTables(activeConv, modelBreakdown, speedMode = 'stream') {
- const estimated = speedMode !== 'total';
+function renderTables(activeConv, modelBreakdown) {
const steps = activeConv.recentSteps || [];
const tabStepsBtn = $('tab-steps-btn');
if (tabStepsBtn) {
tabStepsBtn.textContent = `当前会话步骤测速与计费 (${steps.length}步)`;
}
- const stepsSig = `${activeConv.cascadeId || ''}:${speedMode}:${JSON.stringify(steps)}`;
+ const stepsSig = `${activeConv.cascadeId || ''}:${JSON.stringify(steps)}`;
if (stepsSig !== lastStepsRenderSig) {
lastStepsRenderSig = stepsSig;
const stepsTbody = $('steps-tbody');
@@ -198,8 +176,6 @@ function renderTables(activeConv, modelBreakdown, speedMode = 'stream') {
: '';
const compTag = st.isCompactionStep ? ' [压缩汇总步]' : '';
const reason = speedReasonText(st.selectedSpeedReason);
- const displaySpeed = stepSpeedDisplay(st, speedMode);
- const timingSource = st.responseTimingSource === 'post_thinking_estimate' ? '总时长减记录的思考阶段(估算)' : st.responseTimingSource === 'native_text_stream' ? '无思考正文的原始流时长(估算)' : '不可用';
const stepCostVal = Number(st.costUsd || 0);
const stepCostDisplay = stepCostVal >= 1 ? `$${stepCostVal.toFixed(2)}` : `$${stepCostVal.toFixed(3)}`;
const costStyle =
@@ -208,11 +184,11 @@ function renderTables(activeConv, modelBreakdown, speedMode = 'stream') {
: 'color: var(--foreground); font-weight: 600;';
const pct5h = (stepCostVal / 0.25).toFixed(2);
const pctWk = stepCostVal.toFixed(3);
- tr.title = `单步消费: $${stepCostVal.toFixed(4)} (入 $${Number(st.inCostUsd || 0).toFixed(4)} + 缓 $${Number(st.cacheCostUsd || 0).toFixed(4)} + 出 $${Number(st.outCostUsd || 0).toFixed(4)} | 约合 5h ${pct5h}% / 周限 ${pctWk}%) | ${thinkInfo}正文/工具输出: ${st.responseTokens} tok | 正文阶段: ${formatMetric(st.streamDurationSec, 's')} (${timingSource}) | 请求总耗时: ${formatMetric(st.totalDurationSec, 's')} | 整体吞吐: ${formatMetric(st.totalTokPerSec, ' tok/s')} | ${reason}`;
+ tr.title = `单步消费: $${stepCostVal.toFixed(4)} (入 $${Number(st.inCostUsd || 0).toFixed(4)} + 缓 $${Number(st.cacheCostUsd || 0).toFixed(4)} + 出 $${Number(st.outCostUsd || 0).toFixed(4)} | 约合 5h ${pct5h}% / 周限 ${pctWk}%) | ${thinkInfo}正文/工具输出: ${st.responseTokens} tok | TPS = 总输出 ${st.outputTokens} Token ÷ 请求总耗时 ${formatMetric(st.totalDurationSec, 's')}(含等待与思考) | ${reason}`;
tr.innerHTML = `
监控口径与周限额基准设置
-