mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
pr message fixes
This commit is contained in:
parent
7a2332fd61
commit
83a37d1d80
@ -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 = {
|
||||
|
||||
@ -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,
|
||||
});
|
||||
|
||||
@ -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": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user