Skip to content

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

fix: prompt metrics router add early return if no valid promptIds array input (#2125)

marliessophief5101083a221
diff --git a/web/src/features/prompts/server/routers/promptRouter.ts b/web/src/features/prompts/server/routers/promptRouter.ts
index a5311a65b1..c95900af9e 100644
--- a/web/src/features/prompts/server/routers/promptRouter.ts
+++ b/web/src/features/prompts/server/routers/promptRouter.ts
@@ -571,6 +571,8 @@ export const promptRouter = createTRPCRouter({
scope: "prompts:read",
});
+ if (input.promptIds.length === 0) return [];
+
const metrics = await ctx.prisma.$queryRaw<
Array<{
id: string;