Skip to content

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

mobile support

Max Deichmann81f3a9413cbd
diff --git a/src/pages/project/[projectId]/users.tsx b/src/pages/project/[projectId]/users.tsx
index 590b3a4d15..a3896ad302 100644
--- a/src/pages/project/[projectId]/users.tsx
+++ b/src/pages/project/[projectId]/users.tsx
@@ -106,8 +106,7 @@ export default function UsersPage() {
data: users.data?.map((t) => {
return {
userId: t.userId,
- firstEvent:
- t.firstObservation?.toISOString() ?? "No event yet",
+ firstEvent: t.firstTrace?.toISOString() ?? "No event yet",
lastEvent:
t.lastObservation?.toISOString() ?? "No event yet",
totalEvents: numberFormatter(
diff --git a/src/pages/project/[projectId]/users/[userId].tsx b/src/pages/project/[projectId]/users/[userId].tsx
index 5409bb868c..f8e48d0c8a 100644
--- a/src/pages/project/[projectId]/users/[userId].tsx
+++ b/src/pages/project/[projectId]/users/[userId].tsx
@@ -66,6 +66,7 @@ export default function TracePage() {
name="tabs"
className="block w-full rounded-md border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm"
defaultValue={tabs.find((tab) => tab.current)?.name ?? undefined}
+ onChange={(e) => setCurrentTab(e.currentTarget.value)}
>
{tabs.map((tab) => (
<option key={tab.name}>{tab.name}</option>
@@ -119,6 +120,7 @@ function DetailsTab({ userId, projectId }: TabProps) {
value: user.data.lastObservation?.toISOString(),
},
{ label: "Total Observations", value: user.data.totalObservations },
+ { label: "Total Traces", value: user.data.totalTraces },
{
label: "Prompt Tokens",
value: numberFormatter(user.data.totalPromptTokens),
diff --git a/src/server/api/routers/users.ts b/src/server/api/routers/users.ts
index b17ad1feb7..905447555d 100644
--- a/src/server/api/routers/users.ts
+++ b/src/server/api/routers/users.ts
@@ -28,14 +28,11 @@ export const userRouter = createTRPCRouter({
const userId = trace.userId;
const traceId = trace.id;
- // If the user ID is not in the map, create a new entry with an array containing the trace ID
-
if (userId) {
if (!map.has(userId)) {
map.set(userId, [traceId]);
} else {
- // If the user ID is already in the map, append the trace ID to the existing array
- map.get(userId).push(traceId);
+ map.get(userId)?.push(traceId);
}
}
@@ -127,9 +124,9 @@ export const userRouter = createTRPCRouter({
return {
userId: userId,
- firstTrace: traceAnalytics[0]?._min?.timestamp,
- lastTrace: traceAnalytics[0]?._max?.timestamp,
- totalTraces: traceAnalytics[0]?._count?._all,
+ firstTrace: traceAnalyticsForUser._min?.timestamp,
+ lastTrace: traceAnalyticsForUser?._max?.timestamp,
+ totalTraces: traceAnalyticsForUser?._count?._all,
totalPromptTokens: observationAnalyticsForUser.prompt_tokens ?? 0,
totalCompletionTokens:
observationAnalyticsForUser.completion_tokens ?? 0,