mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix: address Greptile review feedback on PR #21018
- Fix session time range calculation: use Math.min/Math.max across all entries instead of relying on array order (sessionLogs is sorted by type, not time). Other Greptile comments were already addressed in the branch: - LogDetailContent.tsx exists - Clipboard call already wrapped in try/catch - Dedup already uses O(1) Map lookup - model_dump() serialization is documented - GROUP BY performance comment already present
This commit is contained in:
parent
13699b27f3
commit
b117a68122
1 changed files with 6 additions and 2 deletions
|
|
@ -188,8 +188,12 @@ export function LogDetailsDrawer({
|
|||
const environment = metadata?.user_api_key_team_alias || "default";
|
||||
|
||||
const totalSessionCost = sessionLogs.reduce((sum, row) => sum + (row.spend || 0), 0);
|
||||
const sessionStart = sessionLogs.length > 0 ? new Date(sessionLogs[0].startTime) : null;
|
||||
const sessionEnd = sessionLogs.length > 0 ? new Date(sessionLogs[sessionLogs.length - 1].endTime) : null;
|
||||
const sessionStart = sessionLogs.length > 0
|
||||
? new Date(Math.min(...sessionLogs.map((r) => new Date(r.startTime).getTime())))
|
||||
: null;
|
||||
const sessionEnd = sessionLogs.length > 0
|
||||
? new Date(Math.max(...sessionLogs.map((r) => new Date(r.endTime).getTime())))
|
||||
: null;
|
||||
const sessionDurationSeconds =
|
||||
sessionStart && sessionEnd ? ((sessionEnd.getTime() - sessionStart.getTime()) / 1000).toFixed(2) : "0.00";
|
||||
const llmCount = sessionLogs.filter((row) => !MCP_CALL_TYPES.includes(row.call_type)).length;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue