|
48 | 48 | // Working mutable state (refreshed on time range changes) |
49 | 49 | let evalData = $state<AgentPromptEvalData[]>(agentPromptEvals); |
50 | 50 | let isRefreshing = $state(false); |
| 51 | + let recordTraceMap = $state(new Map<string, string>()); |
51 | 52 | // Snapshot on mount so stale singleton state from prior navigation never triggers an immediate refresh. |
52 | 53 | let lastSeenRange = $state(timeRangeState.selectedTimeRange); |
53 | 54 | let lastSeenSignal = $state(timeRangeState.refreshSignal); |
|
93 | 94 | console.error('[AgentEvalDashboard] Refresh failed:', err); |
94 | 95 | } finally { |
95 | 96 | isRefreshing = false; |
| 97 | + resetRecordTraceMap(); |
96 | 98 | timeRangeState.endRefresh(); |
97 | 99 | } |
98 | 100 | } |
|
118 | 120 | console.error('[AgentEvalDashboard] Record page change failed:', err); |
119 | 121 | } finally { |
120 | 122 | isRefreshing = false; |
| 123 | + appendToRecordTraceMap(); |
121 | 124 | timeRangeState.endRefresh(); |
122 | 125 | } |
123 | 126 | } |
|
147 | 150 | } |
148 | 151 | } |
149 | 152 |
|
| 153 | + function appendToRecordTraceMap() { |
| 154 | + evalData.forEach(e => { |
| 155 | + if (e.monitoringData.status !== 'success') return; |
| 156 | + e.monitoringData.selectedData.records?.items?.forEach(r => { |
| 157 | + if (r.trace_id) recordTraceMap.set(r.uid, r.trace_id); |
| 158 | + }); |
| 159 | + }); |
| 160 | + } |
| 161 | +
|
| 162 | + function resetRecordTraceMap() { |
| 163 | + recordTraceMap = new Map<string, string>(); |
| 164 | + appendToRecordTraceMap(); |
| 165 | + } |
| 166 | +
|
150 | 167 | // ── Chart ───────────────────────────────────────────────────────────────────── |
151 | 168 | Chart.register(zoomPlugin, annotationPlugin, Filler); |
152 | 169 |
|
|
290 | 307 | /** Merged workflow page: items from all evals sorted by created_at desc. */ |
291 | 308 | const workflowPage = $derived( |
292 | 309 | (() => { |
293 | | - const recordTraceMap = new Map<string, string>(); |
294 | | - evalData.forEach(e => { |
295 | | - if (e.monitoringData.status !== 'success') return; |
296 | | - e.monitoringData.selectedData.records?.items?.forEach(r => { |
297 | | - if (r.trace_id) recordTraceMap.set(r.uid, r.trace_id); |
298 | | - }); |
299 | | - }); |
300 | | -
|
301 | 310 | const items: WorkflowWithAgent[] = []; |
302 | 311 | let hasNext = false; |
303 | 312 | let hasPrevious = false; |
|
327 | 336 |
|
328 | 337 | onMount(() => { |
329 | 338 | currentMaxPoints = getMaxDataPoints(); |
| 339 | + appendToRecordTraceMap(); |
330 | 340 | let timeoutId: ReturnType<typeof setTimeout>; |
331 | 341 | const handleResize = () => { |
332 | 342 | clearTimeout(timeoutId); |
|
448 | 458 | <!-- ── Evaluation Records Table ──────────────────────────────────────────── --> |
449 | 459 | <div class="grid grid-cols-1 gap-6"> |
450 | 460 | {#if recordPage.items.length > 0 || recordPage.hasPrevious} |
451 | | - <div class="bg-white border-2 border-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] rounded-xl overflow-hidden flex flex-col h-full"> |
| 461 | + <div class="bg-white border-2 border-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] rounded-base overflow-hidden flex flex-col h-full"> |
452 | 462 | <div class="bg-primary-100 border-b-2 border-black px-5 py-3 flex items-center justify-between flex-shrink-0"> |
453 | 463 | <div class="flex items-center gap-2"> |
454 | 464 | <TableProperties class="w-4 h-4 text-primary-700" /> |
|
458 | 468 | {recordPage.items.length} |
459 | 469 | </span> |
460 | 470 | </div> |
461 | | - <div class="p-2 w-full flex-grow bg-slate-50 min-h-0"> |
| 471 | + <div class="p-2 w-full flex-grow bg-surface-50 min-h-0"> |
462 | 472 | <AgentEvalRecordTable |
463 | 473 | records={recordPage.items} |
464 | 474 | hasNext={recordPage.hasNext} |
|
471 | 481 | {/if} |
472 | 482 |
|
473 | 483 | {#if workflowPage.items.length > 0 || workflowPage.hasPrevious} |
474 | | - <div class="bg-white border-2 border-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] rounded-xl overflow-hidden flex flex-col h-full"> |
| 484 | + <div class="bg-white border-2 border-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] rounded-base overflow-hidden flex flex-col h-full"> |
475 | 485 | <div class="bg-primary-100 border-b-2 border-black px-5 py-3 flex items-center justify-between flex-shrink-0"> |
476 | 486 | <div class="flex items-center gap-2"> |
477 | 487 | <ArrowRightLeft class="w-4 h-4 text-primary-700"/> |
|
481 | 491 | {workflowPage.items.length} |
482 | 492 | </span> |
483 | 493 | </div> |
484 | | - <div class="p-2 w-full flex-grow bg-slate-50 min-h-0"> |
| 494 | + <div class="p-2 w-full flex-grow bg-surface-50 min-h-0"> |
485 | 495 | <AgentEvalWorkflowTable |
486 | 496 | workflows={workflowPage.items} |
487 | 497 | hasNext={workflowPage.hasNext} |
|
0 commit comments