🪢 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: pagination for clickhouse tables (#4098)
Max Deichmann63d1b85a6c82
diff --git a/packages/shared/src/server/repositories/traces.ts b/packages/shared/src/server/repositories/traces.tsindex 1f1b782017..69499c65d7 100644--- a/packages/shared/src/server/repositories/traces.ts+++ b/packages/shared/src/server/repositories/traces.ts@@ -68,8 +68,8 @@ export const getTracesTableCount = async (orderBy?: OrderByState,limit?: number,offset?: number,-) =>- getTracesTableGeneric<TableCount>({+) => {+ const countRows = await getTracesTableGeneric<{ count: string }>({select: "count(*) as count",projectId,filter,@@ -78,6 +78,13 @@ export const getTracesTableCount = async (offset,});+ const converted = countRows.map((row) => ({+ count: Number(row.count),+ }));++ return converted.length > 0 ? converted[0].count : 0;+};+export const getTracesTable = async (projectId: string,filter: FilterState,diff --git a/web/src/server/api/routers/traces.ts b/web/src/server/api/routers/traces.tsindex 5b16c1f313..d05f270799 100644--- a/web/src/server/api/routers/traces.ts+++ b/web/src/server/api/routers/traces.ts@@ -250,12 +250,12 @@ export const traceRouter = createTRPCRouter({ctx.session.projectId,input.filter ?? [],null,- input.limit,- input.page,+ 1,+ 0,);return {- totalCount: countQuery.shift()?.count,+ totalCount: countQuery,};}}),