MCPcopy Create free account
hub / github.com/Noumena-Network/code / computeTtftText

Function computeTtftText

src/components/Spinner.tsx:566–573  ·  view source on GitHub ↗
(entries: ApiMetricsEntry[])

Source from the content-addressed store, hash-verified

564 return sorted.length % 2 === 0 ? Math.round((sorted[mid - 1]! + sorted[mid]!) / 2) : sorted[mid]!;
565}
566function computeTtftText(entries: ApiMetricsEntry[]): string | null {
567 const ttfts = entries.map(entry => entry.ttftMs).filter(ttftMs => Number.isFinite(ttftMs) && ttftMs > 0);
568 if (ttfts.length === 0) {
569 return null;
570 }
571 const ttftMs = ttfts.length > 1 ? median(ttfts) : ttfts[0]!;
572 return `${ttfts.length > 1 ? 'P50 ' : ''}TTFT ${formatSecondsShort(ttftMs)}`;
573}
574function findNextPendingTask(tasks: Task[] | undefined): Task | undefined {
575 if (!tasks) {
576 return undefined;

Callers 1

SpinnerWithVerbInnerFunction · 0.85

Calls 2

medianFunction · 0.85
formatSecondsShortFunction · 0.85

Tested by

no test coverage detected