pr message fixes

This commit is contained in:
Aadesh Kheria 2026-04-17 16:02:33 -07:00
parent 7a2332fd61
commit 83a37d1d80
3 changed files with 9 additions and 5 deletions

View File

@ -86,7 +86,7 @@ export const POST = createSmartRouteHandler({
mcpCorrelationId: body.mcpCallMetadata ? correlationId : undefined,
conversationId: conversationIdForLog,
};
const startedAt = Date.now();
const startedAt = performance.now();
const isAnthropic = model.modelId.startsWith("anthropic/");
const systemMessage: ModelMessage = {

View File

@ -119,7 +119,7 @@ function logSuccess(args: {
cachedInputTokens: extractCachedTokens(providerMetadata),
costUsd: extractOpenRouterCost(providerMetadata),
stepCount: steps.length,
durationMs: BigInt(Date.now() - startedAt),
durationMs: BigInt(Math.round(performance.now() - startedAt)),
errorMessage: undefined,
}));
}
@ -140,7 +140,7 @@ function logFailure(args: {
cachedInputTokens: undefined,
costUsd: undefined,
stepCount: 0,
durationMs: BigInt(Date.now() - startedAt),
durationMs: BigInt(Math.round(performance.now() - startedAt)),
errorMessage: err instanceof Error ? err.message : String(err),
}));
}
@ -183,7 +183,7 @@ function logMcpCallAndReview(args: {
response: finalText,
stepCount,
innerToolCallsJson,
durationMs: BigInt(Date.now() - startedAt),
durationMs: BigInt(Math.round(performance.now() - startedAt)),
modelId,
errorMessage: undefined,
});

View File

@ -45,7 +45,11 @@ export function Usage({ rows, connectionState, onSelect, selectedId }: Props) {
const [page, setPage] = useState(0);
const [pageSize, setPageSize] = useState<PageSize>(50);
const now = Date.now();
const [now, setNow] = useState(() => Date.now());
useEffect(() => {
const id = setInterval(() => setNow(Date.now()), 60_000);
return () => clearInterval(id);
}, []);
const rangeStart = useMemo(() => {
switch (timeRange) {
case "24h": {