Metrics: show the speed section also if the wait exceeded 10 seconds

This commit is contained in:
Enrico Ros
2025-02-27 16:55:39 -08:00
parent dfc37fb2d4
commit 6d010c0ef1
+10 -6
View File
@@ -252,8 +252,12 @@ export function useMessageAvatarLabel(
function _prettyMetrics(metrics: DMessageGenerator['metrics'], uiComplexityMode: UIComplexityMode): React.ReactNode {
if (!metrics) return null;
const showSpeed = uiComplexityMode !== 'minimal' && ((metrics?.dtStart !== undefined && uiComplexityMode === 'extra') || metrics?.vTOutInner !== undefined);
const showWaitingTime = metrics?.dtStart !== undefined && (uiComplexityMode === 'extra' || metrics.dtStart >= 10000);
const showSpeedSection = uiComplexityMode !== 'minimal' && (showWaitingTime || metrics?.vTOutInner !== undefined);
const costCode = metrics.$code ? _prettyCostCode(metrics.$code) : null;
return <Box sx={tooltipMetricsGridSx}>
{/* Tokens */}
@@ -268,12 +272,12 @@ function _prettyMetrics(metrics: DMessageGenerator['metrics'], uiComplexityMode:
</div>}
{/* Timings */}
{showSpeed && <div>Speed:</div>}
{showSpeed && <div>
{showSpeedSection && <div>Speed:</div>}
{showSpeedSection && <div>
{!!metrics.vTOutInner && <>~<b>{(Math.round(metrics.vTOutInner * 10) / 10).toLocaleString() || ''}</b> tok/s</>}
{uiComplexityMode === 'extra' && metrics?.dtStart && (<span style={{ opacity: 0.5 }}>
{showWaitingTime && (<span style={{ opacity: 0.5 }}>
{metrics.vTOutInner !== undefined && ' · '}
<span>{(Math.round(metrics.dtStart / 100) / 10).toLocaleString() || ''}</span>s wait
<span>{(Math.round(metrics.dtStart! / 100) / 10).toLocaleString() || ''}</span>s wait
</span>)}
</div>}
@@ -289,7 +293,7 @@ function _prettyMetrics(metrics: DMessageGenerator['metrics'], uiComplexityMode:
})</small>
</>}
</div>}
{costCode && <div />}
{costCode && metrics?.$c !== undefined ? <div>Costs:</div> : <div />}
{costCode && <div><em>{costCode}</em></div>}
</Box>;
}