diff --git a/benchmark/apps/web/src/app/runs/[id]/connection-status.tsx b/benchmark/apps/web/src/app/runs/[id]/connection-status.tsx
index 95c069f7fd..f1c39ce03c 100644
--- a/benchmark/apps/web/src/app/runs/[id]/connection-status.tsx
+++ b/benchmark/apps/web/src/app/runs/[id]/connection-status.tsx
@@ -3,18 +3,16 @@ import { cn } from "@/lib/utils"
type ConnectionStatusProps = {
status: EventSourceStatus
- clientId?: string
pid: number | null
}
-export const ConnectionStatus = ({ status, clientId, pid }: ConnectionStatusProps) => (
+export const ConnectionStatus = ({ status, pid }: ConnectionStatusProps) => (
Status: {status}
PID: {pid}
- {clientId &&
Client: {clientId}
}
(null)
const [selectedTask, setSelectedTask] = useState
()
@@ -32,34 +45,73 @@ export function Run({ run }: { run: db.Run }) {
return (
<>
-
-
Run #{run.id}
+
{run.model}
{run.description &&
{run.description}
}
{!tasks ? (
) : (
- tasks.map((task) => (
-
-
-
- {task.language}/{task.exercise}
-
- {(outputCounts[task.id] ?? 0) > 0 && (
-
setSelectedTask(task)}>
-
-
({outputCounts[task.id]})
-
- )}
-
- ))
+
+
+
+ Exercise
+ Tokens In / Out
+ Context
+ Duration
+ Cost
+
+
+
+ {tasks.map((task) => (
+
+
+
+
+
+ {task.language}/{task.exercise}
+
+ {(outputCounts[task.id] ?? 0) > 0 && (
+
setSelectedTask(task)}>
+
+
+ {outputCounts[task.id]}
+
+
+ )}
+
+
+ {task.taskMetrics ? (
+ <>
+
+
+
{formatTokens(task.taskMetrics.tokensIn)}
/
+
{formatTokens(task.taskMetrics.tokensOut)}
+
+
+
+ {formatTokens(task.taskMetrics.tokensContext)}
+
+
+ {formatDuration(task.taskMetrics.duration)}
+
+
+ {formatCurrency(task.taskMetrics.cost)}
+
+ >
+ ) : (
+
+ )}
+
+ ))}
+
+
)}
-
+
setSelectedTask(undefined)}>
diff --git a/benchmark/apps/web/src/lib/format-tokens.ts b/benchmark/apps/web/src/lib/format-tokens.ts
new file mode 100644
index 0000000000..d017c9ce6a
--- /dev/null
+++ b/benchmark/apps/web/src/lib/format-tokens.ts
@@ -0,0 +1,7 @@
+export const formatTokens = (tokens: number) => {
+ if (tokens < 1000) {
+ return tokens.toString()
+ }
+
+ return `${(tokens / 1000).toFixed(1)}k`
+}
diff --git a/benchmark/apps/web/src/lib/index.ts b/benchmark/apps/web/src/lib/index.ts
index e2d57baac5..f4262c384f 100644
--- a/benchmark/apps/web/src/lib/index.ts
+++ b/benchmark/apps/web/src/lib/index.ts
@@ -1,2 +1,3 @@
export { formatCurrency } from "./format-currency"
export { formatDuration } from "./format-duration"
+export { formatTokens } from "./format-tokens"
diff --git a/benchmark/packages/db/src/queries/tasks.ts b/benchmark/packages/db/src/queries/tasks.ts
index 77ea4f678d..a32e92bf51 100644
--- a/benchmark/packages/db/src/queries/tasks.ts
+++ b/benchmark/packages/db/src/queries/tasks.ts
@@ -58,4 +58,5 @@ export const getTask = async ({ runId, language, exercise }: GetTask) =>
where: and(eq(table.runId, runId), eq(table.language, language), eq(table.exercise, exercise)),
})
-export const getTasks = async (runId: number) => db.query.tasks.findMany({ where: eq(table.runId, runId) })
+export const getTasks = async (runId: number) =>
+ db.query.tasks.findMany({ where: eq(table.runId, runId), with: { taskMetrics: true } })