🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix: handle nullable values in scores table (#1531)
Max Deichmann8cfafe1e6117
diff --git a/web/src/components/table/use-cases/scores.tsx b/web/src/components/table/use-cases/scores.tsxindex ee795920b2..aa491a539b 100644--- a/web/src/components/table/use-cases/scores.tsx+++ b/web/src/components/table/use-cases/scores.tsx@@ -21,7 +21,7 @@ export type ScoresTableRow = {value: number;comment?: string;observationId?: string;- traceName: string;+ traceName?: string;userId?: string;};@@ -102,15 +102,16 @@ export default function ScoresTable({header: "Observation ID",enableSorting: true,cell: ({ row }) => {- const observationId = row.getValue("observationId");- const traceId = row.getValue("traceId");- return typeof observationId === "string" &&- typeof traceId === "string" ? (+ const observationId = row.getValue(+ "observationId",+ ) as ScoresTableRow["observationId"];+ const traceId = row.getValue("traceId") as ScoresTableRow["traceId"];+ return traceId && observationId ? (<TableLinkpath={`/project/${projectId}/traces/${traceId}?observation=${observationId}`}value={observationId}/>- ) : null;+ ) : undefined;},},{@@ -120,17 +121,17 @@ export default function ScoresTable({enableHiding: true,enableSorting: true,cell: ({ row }) => {- const value: string = row.getValue("traceName");+ const value = row.getValue("traceName") as ScoresTableRow["traceName"];const filter = encodeURIComponent(`name;stringOptions;;any of;${value}`,);- return (+ return value ? (<TableLinkpath={`/project/${projectId}/traces?filter=${value ? filter : ""}`}value={value}truncateAt={40}/>- );+ ) : undefined;},},{@@ -199,7 +200,7 @@ export default function ScoresTable({comment: score.comment ?? undefined,observationId: score.observationId ?? undefined,traceId: score.traceId,- traceName: score.traceName,+ traceName: score.traceName ?? undefined,userId: score.userId ?? undefined,};};diff --git a/web/src/server/api/routers/scores.ts b/web/src/server/api/routers/scores.tsindex 48a721139a..3a09693573 100644--- a/web/src/server/api/routers/scores.ts+++ b/web/src/server/api/routers/scores.ts@@ -48,7 +48,7 @@ export const scoresRouter = createTRPCRouter({);const scores = await ctx.prisma.$queryRaw<- Array<Score & { traceName: string; userId: string | null }>+ Array<Score & { traceName: string | null; userId: string | null }>>(generateScoresQuery(Prisma.sql`