mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
Metrics: show the speed section also if the wait exceeded 10 seconds
This commit is contained in:
@@ -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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user