Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
// Working mutable state (refreshed on time range changes)
let evalData = $state<AgentPromptEvalData[]>(agentPromptEvals);
let isRefreshing = $state(false);
let recordTraceMap = $state(new Map<string, string>());
// Snapshot on mount so stale singleton state from prior navigation never triggers an immediate refresh.
let lastSeenRange = $state(timeRangeState.selectedTimeRange);
let lastSeenSignal = $state(timeRangeState.refreshSignal);
Expand Down Expand Up @@ -93,6 +94,7 @@
console.error('[AgentEvalDashboard] Refresh failed:', err);
} finally {
isRefreshing = false;
resetRecordTraceMap();
timeRangeState.endRefresh();
}
}
Expand All @@ -118,6 +120,7 @@
console.error('[AgentEvalDashboard] Record page change failed:', err);
} finally {
isRefreshing = false;
appendToRecordTraceMap();
timeRangeState.endRefresh();
}
}
Expand Down Expand Up @@ -147,6 +150,20 @@
}
}

function appendToRecordTraceMap() {
evalData.forEach(e => {
if (e.monitoringData.status !== 'success') return;
e.monitoringData.selectedData.records?.items?.forEach(r => {
if (r.trace_id) recordTraceMap.set(r.uid, r.trace_id);
});
});
}

function resetRecordTraceMap() {
recordTraceMap = new Map<string, string>();
appendToRecordTraceMap();
}

// ── Chart ─────────────────────────────────────────────────────────────────────
Chart.register(zoomPlugin, annotationPlugin, Filler);

Expand Down Expand Up @@ -290,14 +307,6 @@
/** Merged workflow page: items from all evals sorted by created_at desc. */
const workflowPage = $derived(
(() => {
const recordTraceMap = new Map<string, string>();
evalData.forEach(e => {
if (e.monitoringData.status !== 'success') return;
e.monitoringData.selectedData.records?.items?.forEach(r => {
if (r.trace_id) recordTraceMap.set(r.uid, r.trace_id);
});
});

const items: WorkflowWithAgent[] = [];
let hasNext = false;
let hasPrevious = false;
Expand Down Expand Up @@ -327,6 +336,7 @@

onMount(() => {
currentMaxPoints = getMaxDataPoints();
appendToRecordTraceMap();
let timeoutId: ReturnType<typeof setTimeout>;
const handleResize = () => {
clearTimeout(timeoutId);
Expand Down Expand Up @@ -448,7 +458,7 @@
<!-- ── Evaluation Records Table ──────────────────────────────────────────── -->
<div class="grid grid-cols-1 gap-6">
{#if recordPage.items.length > 0 || recordPage.hasPrevious}
<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">
<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">
<div class="bg-primary-100 border-b-2 border-black px-5 py-3 flex items-center justify-between flex-shrink-0">
<div class="flex items-center gap-2">
<TableProperties class="w-4 h-4 text-primary-700" />
Expand All @@ -458,7 +468,7 @@
{recordPage.items.length}
</span>
</div>
<div class="p-2 w-full flex-grow bg-slate-50 min-h-0">
<div class="p-2 w-full flex-grow bg-surface-50 min-h-0">
<AgentEvalRecordTable
records={recordPage.items}
hasNext={recordPage.hasNext}
Expand All @@ -471,7 +481,7 @@
{/if}

{#if workflowPage.items.length > 0 || workflowPage.hasPrevious}
<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">
<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">
<div class="bg-primary-100 border-b-2 border-black px-5 py-3 flex items-center justify-between flex-shrink-0">
<div class="flex items-center gap-2">
<ArrowRightLeft class="w-4 h-4 text-primary-700"/>
Expand All @@ -481,7 +491,7 @@
{workflowPage.items.length}
</span>
</div>
<div class="p-2 w-full flex-grow bg-slate-50 min-h-0">
<div class="p-2 w-full flex-grow bg-surface-50 min-h-0">
<AgentEvalWorkflowTable
workflows={workflowPage.items}
hasNext={workflowPage.hasNext}
Expand Down
20 changes: 7 additions & 13 deletions crates/opsml_server/opsml_ui/src/lib/server/card/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ export async function loadCardLayout(
fetch: typeof globalThis.fetch,
useMockFallback = false,
): Promise<CardLayoutData> {
if (useMockFallback) {
return {
...buildMockCardLayout(registryType, space, name, version),
mockMode: true,
};
}

try {
const metadata = (await getCardMetadata(
space,
Expand All @@ -69,7 +62,11 @@ export async function loadCardLayout(
mockMode: false,
};
} catch (error) {
throw error;
if (!useMockFallback) throw error;
return {
...buildMockCardLayout(registryType, space, name, version),
mockMode: true,
};
}
}

Expand All @@ -85,10 +82,6 @@ export async function loadCard(
fetch: typeof globalThis.fetch,
useMockFallback = false,
): Promise<CardMetadata> {
if (useMockFallback) {
return buildMockCardMetadata(registryType, space, name, version);
}

try {
const metadata = await getCardMetadata(
space,
Expand All @@ -101,6 +94,7 @@ export async function loadCard(

return metadata as CardMetadata;
} catch (error) {
throw error;
if (!useMockFallback) throw error;
return buildMockCardMetadata(registryType, space, name, version);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ export const POST: RequestHandler = async ({ request, fetch, cookies }) => {

try {
const resp = await createOpsmlClient(fetch).post(RoutePaths.TRACE_FACETS, filters);
if (!resp.ok) {
const errorBody = await resp.text();
return json(
{ response: null, error: errorBody || `Facets request failed: ${resp.status}` },
{ status: resp.status },
);
}
const response = (await resp.json()) as TraceFacetsResponse;
return json({ response, error: null });
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ export const load: PageServerLoad = async ({ parent, fetch, cookies }) => {
const { metadata, registryType } = await parent();
const useMockFallback = isDevMockEnabled(cookies);

if (useMockFallback) {
return {
versionPage: buildMockVersionPage(metadata.space, metadata.name),
versionStats: buildMockVersionStats(),
mockMode: true,
};
}

try {
const [versionPage, versionStats] = await Promise.all([
getVersionPage(fetch, registryType, metadata.space, metadata.name),
Expand All @@ -26,9 +18,7 @@ export const load: PageServerLoad = async ({ parent, fetch, cookies }) => {

return { versionPage, versionStats, mockMode: false };
} catch (error) {
if (!useMockFallback) {
throw error;
}
if (!useMockFallback) throw error;

return {
versionPage: buildMockVersionPage(metadata.space, metadata.name),
Expand Down
Loading