Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix table filters (#283)

Maximilian Deichmann459c0b85bf8b
diff --git a/src/components/table/use-cases/traces.tsx b/src/components/table/use-cases/traces.tsx
index 7f5e9a096b..93b7c9eeea 100644
--- a/src/components/table/use-cases/traces.tsx
+++ b/src/components/table/use-cases/traces.tsx
@@ -309,8 +309,13 @@ export default function TracesTable({
data: convertToOptions(options.data),
};
- const isFiltered = () =>
- Object.entries(queryOptions).filter(([_k, v]) => v !== null).length > 0;
+ const isFiltered = () => {
+ return (
+ Object.entries(queryOptions).filter(
+ ([k, v]) => v !== null && !omittedFilter.find((f) => f === k),
+ ).length > 0
+ );
+ };
const resetFilters = () => {
setQueryOptions({
diff --git a/src/server/api/routers/scores.ts b/src/server/api/routers/scores.ts
index 64009793ed..954350c604 100644
--- a/src/server/api/routers/scores.ts
+++ b/src/server/api/routers/scores.ts
@@ -33,6 +33,10 @@ export const scoresRouter = createTRPCRouter({
all: protectedProjectProcedure
.input(ScoreAllOptions)
.query(async ({ input, ctx }) => {
+ const userIdCondition = input.userId
+ ? Prisma.sql`AND t.user_id = ${input.userId}`
+ : Prisma.empty;
+
const scores = await ctx.prisma.$queryRaw<
Array<Score & { traceName: string; totalCount: number }>
>(Prisma.sql`
@@ -49,6 +53,7 @@ export const scoresRouter = createTRPCRouter({
FROM scores s
JOIN traces t ON t.id = s.trace_id
WHERE t.project_id = ${input.projectId}
+ ${userIdCondition}
${scoresFilterPrismaCondition(input)}
ORDER BY s.timestamp DESC
LIMIT ${input.limit}