From 8cfcfdcf1b582e1b005175fa83bf5c8302219b08 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 25 Jul 2025 17:53:37 +0000 Subject: [PATCH 01/11] Checkpoint before follow-up message --- packages/db/src/schema.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index 4c66ef8d41..697aeaeeba 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -263,6 +263,7 @@ export const log = pgTable("log", { content: text(), reasoningContent: text(), toolCalls: json(), + tools: json(), finishReason: text(), unifiedFinishReason: text(), promptTokens: decimal(), From 753a6f0520b4856cffe80426c5449f722c6d773d Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 25 Jul 2025 18:05:08 +0000 Subject: [PATCH 02/11] feat: log and display tools and tool_choice in chat completion activity logs - Add tools and toolChoice columns to log table schema - Update chat completion logging to capture tools and tool_choice parameters - Add database migration for new columns - Update API log schema to include new fields - Enhance LogCard UI to display tool information in activity logs - Update TypeScript interfaces for new fields - Display Available Tools, Tool Choice, and Tool Calls in separate sections - Maintain backwards compatibility with existing logs --- apps/api/src/routes/logs.ts | 3 + apps/gateway/src/chat/chat.ts | 18 + .../src/components/activity/recent-logs.tsx | 7 +- .../src/components/dashboard/log-card.tsx | 43 + apps/next/src/types/activity.ts | 3 + .../src/components/activity/recent-logs.tsx | 4 +- apps/ui/src/components/dashboard/log-card.tsx | 45 + .../1753466042_motionless_cardiac.sql | 2 + .../migrations/meta/1753466042_snapshot.json | 1722 +++++++++++++++++ packages/db/migrations/meta/_journal.json | 7 + packages/db/src/schema.ts | 1 + 11 files changed, 1853 insertions(+), 2 deletions(-) create mode 100644 packages/db/migrations/1753466042_motionless_cardiac.sql create mode 100644 packages/db/migrations/meta/1753466042_snapshot.json diff --git a/apps/api/src/routes/logs.ts b/apps/api/src/routes/logs.ts index fb6791ee73..eaf26871ea 100644 --- a/apps/api/src/routes/logs.ts +++ b/apps/api/src/routes/logs.ts @@ -37,6 +37,9 @@ const logSchema = z.object({ topP: z.number().nullable(), frequencyPenalty: z.number().nullable(), presencePenalty: z.number().nullable(), + tools: z.any().nullable(), + toolChoice: z.any().nullable(), + toolCalls: z.any().nullable(), hasError: z.boolean().nullable(), errorDetails: errorDetails.nullable(), cost: z.number().nullable(), diff --git a/apps/gateway/src/chat/chat.ts b/apps/gateway/src/chat/chat.ts index 657345bb6f..79463f1f78 100644 --- a/apps/gateway/src/chat/chat.ts +++ b/apps/gateway/src/chat/chat.ts @@ -78,6 +78,8 @@ function createLogEntry( top_p: number | undefined, frequency_penalty: number | undefined, presence_penalty: number | undefined, + tools: any[] | undefined, + toolChoice: any | undefined, ) { return { requestId, @@ -95,6 +97,8 @@ function createLogEntry( topP: top_p || null, frequencyPenalty: frequency_penalty || null, presencePenalty: presence_penalty || null, + tools: tools || null, + toolChoice: toolChoice || null, mode: project.mode, } as const; } @@ -1668,6 +1672,8 @@ chat.openapi(completions, async (c) => { top_p, frequency_penalty, presence_penalty, + tools, + tool_choice, ); await insertLog({ @@ -1802,6 +1808,8 @@ chat.openapi(completions, async (c) => { top_p, frequency_penalty, presence_penalty, + tools, + tool_choice, ); await insertLog({ @@ -1885,6 +1893,8 @@ chat.openapi(completions, async (c) => { top_p, frequency_penalty, presence_penalty, + tools, + tool_choice, ); await insertLog({ @@ -2551,6 +2561,8 @@ chat.openapi(completions, async (c) => { top_p, frequency_penalty, presence_penalty, + tools, + tool_choice, ); await insertLog({ @@ -2636,6 +2648,8 @@ chat.openapi(completions, async (c) => { top_p, frequency_penalty, presence_penalty, + tools, + tool_choice, ); await insertLog({ @@ -2697,6 +2711,8 @@ chat.openapi(completions, async (c) => { top_p, frequency_penalty, presence_penalty, + tools, + tool_choice, ); await insertLog({ @@ -2803,6 +2819,8 @@ chat.openapi(completions, async (c) => { top_p, frequency_penalty, presence_penalty, + tools, + tool_choice, ); await insertLog({ diff --git a/apps/next/src/components/activity/recent-logs.tsx b/apps/next/src/components/activity/recent-logs.tsx index a6c3086c16..9b01593198 100644 --- a/apps/next/src/components/activity/recent-logs.tsx +++ b/apps/next/src/components/activity/recent-logs.tsx @@ -59,6 +59,9 @@ interface RecentLogsProps { topP: number | null; frequencyPenalty: number | null; presencePenalty: number | null; + tools: unknown | null; + toolChoice: unknown | null; + toolCalls: unknown | null; hasError: boolean | null; errorDetails: { statusCode: number; @@ -290,7 +293,9 @@ export function RecentLogs({ initialData }: RecentLogsProps) { createdAt: new Date(log.createdAt), updatedAt: new Date(log.updatedAt), messages: log.messages as any, - toolCalls: null, + tools: log.tools, + toolChoice: log.toolChoice, + toolCalls: log.toolCalls, errorDetails: log.errorDetails as any, cachedTokens: (log as any).cachedTokens || null, cachedInputCost: (log as any).cachedInputCost || null, diff --git a/apps/next/src/components/dashboard/log-card.tsx b/apps/next/src/components/dashboard/log-card.tsx index 16b304b2ab..4ccab1e658 100644 --- a/apps/next/src/components/dashboard/log-card.tsx +++ b/apps/next/src/components/dashboard/log-card.tsx @@ -312,6 +312,49 @@ export function LogCard({ log }: { log: Log }) { + {(log.tools || log.toolChoice || log.toolCalls) && ( +
+

Tool Information

+
+ {log.tools && ( +
+
+ Available Tools +
+
+
+												{JSON.stringify(log.tools, null, 2)}
+											
+
+
+ )} + {log.toolChoice && ( +
+
+ Tool Choice +
+
+
+												{JSON.stringify(log.toolChoice, null, 2)}
+											
+
+
+ )} + {log.toolCalls && ( +
+
+ Tool Calls +
+
+
+												{JSON.stringify(log.toolCalls, null, 2)}
+											
+
+
+ )} +
+
+ )} {log.hasError && !!log.errorDetails && (

diff --git a/apps/next/src/types/activity.ts b/apps/next/src/types/activity.ts index 2500b988c7..db6dfd40a7 100644 --- a/apps/next/src/types/activity.ts +++ b/apps/next/src/types/activity.ts @@ -88,6 +88,9 @@ export interface LogsData { topP: number | null; frequencyPenalty: number | null; presencePenalty: number | null; + tools: unknown | null; + toolChoice: unknown | null; + toolCalls: unknown | null; hasError: boolean | null; errorDetails: { statusCode: number; diff --git a/apps/ui/src/components/activity/recent-logs.tsx b/apps/ui/src/components/activity/recent-logs.tsx index 79ef73bcd5..d2a2003b50 100644 --- a/apps/ui/src/components/activity/recent-logs.tsx +++ b/apps/ui/src/components/activity/recent-logs.tsx @@ -157,7 +157,9 @@ export function RecentLogs() { createdAt: new Date(log.createdAt), updatedAt: new Date(log.updatedAt), messages: log.messages as any, - toolCalls: null, + tools: (log as any).tools, + toolChoice: (log as any).toolChoice, + toolCalls: (log as any).toolCalls, errorDetails: log.errorDetails as any, reasoningTokens: log.reasoningTokens, reasoningContent: (log as any).reasoningContent, diff --git a/apps/ui/src/components/dashboard/log-card.tsx b/apps/ui/src/components/dashboard/log-card.tsx index 417c0127f7..5032bf1a73 100644 --- a/apps/ui/src/components/dashboard/log-card.tsx +++ b/apps/ui/src/components/dashboard/log-card.tsx @@ -312,6 +312,51 @@ export function LogCard({ log }: { log: Log }) {

+ {((log as any).tools || + (log as any).toolChoice || + (log as any).toolCalls) && ( +
+

Tool Information

+
+ {(log as any).tools && ( +
+
+ Available Tools +
+
+
+												{JSON.stringify((log as any).tools, null, 2)}
+											
+
+
+ )} + {(log as any).toolChoice && ( +
+
+ Tool Choice +
+
+
+												{JSON.stringify((log as any).toolChoice, null, 2)}
+											
+
+
+ )} + {(log as any).toolCalls && ( +
+
+ Tool Calls +
+
+
+												{JSON.stringify((log as any).toolCalls, null, 2)}
+											
+
+
+ )} +
+
+ )} {log.hasError && !!log.errorDetails && (

diff --git a/packages/db/migrations/1753466042_motionless_cardiac.sql b/packages/db/migrations/1753466042_motionless_cardiac.sql new file mode 100644 index 0000000000..67ac8a3cc7 --- /dev/null +++ b/packages/db/migrations/1753466042_motionless_cardiac.sql @@ -0,0 +1,2 @@ +ALTER TABLE "log" ADD COLUMN "tools" json;--> statement-breakpoint +ALTER TABLE "log" ADD COLUMN "tool_choice" json; \ No newline at end of file diff --git a/packages/db/migrations/meta/1753466042_snapshot.json b/packages/db/migrations/meta/1753466042_snapshot.json new file mode 100644 index 0000000000..36d49405bf --- /dev/null +++ b/packages/db/migrations/meta/1753466042_snapshot.json @@ -0,0 +1,1722 @@ +{ + "id": "9a9e28e6-0e25-4fc7-a988-4092bea2408b", + "prevId": "8c86add2-bf12-4f10-bef2-0576ad104d03", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.api_key": { + "name": "api_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "api_key_project_id_project_id_fk": { + "name": "api_key_project_id_project_id_fk", + "tableFrom": "api_key", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "api_key_token_unique": { + "name": "api_key_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.chat": { + "name": "chat", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + } + }, + "indexes": {}, + "foreignKeys": { + "chat_user_id_user_id_fk": { + "name": "chat_user_id_user_id_fk", + "tableFrom": "chat", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.installation": { + "name": "installation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "installation_uuid_unique": { + "name": "installation_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lock": { + "name": "lock", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "lock_key_unique": { + "name": "lock_key_unique", + "nullsNotDistinct": false, + "columns": [ + "key" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.log": { + "name": "log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "request_id": { + "name": "request_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "api_key_id": { + "name": "api_key_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "requested_model": { + "name": "requested_model", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "requested_provider": { + "name": "requested_provider", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "used_model": { + "name": "used_model", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "used_provider": { + "name": "used_provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "response_size": { + "name": "response_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reasoning_content": { + "name": "reasoning_content", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tool_calls": { + "name": "tool_calls", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "tools": { + "name": "tools", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "tool_choice": { + "name": "tool_choice", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "finish_reason": { + "name": "finish_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unified_finish_reason": { + "name": "unified_finish_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "prompt_tokens": { + "name": "prompt_tokens", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "completion_tokens": { + "name": "completion_tokens", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "total_tokens": { + "name": "total_tokens", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "reasoning_tokens": { + "name": "reasoning_tokens", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "cached_tokens": { + "name": "cached_tokens", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "messages": { + "name": "messages", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "temperature": { + "name": "temperature", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "max_tokens": { + "name": "max_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "top_p": { + "name": "top_p", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "frequency_penalty": { + "name": "frequency_penalty", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "presence_penalty": { + "name": "presence_penalty", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "has_error": { + "name": "has_error", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "error_details": { + "name": "error_details", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "cost": { + "name": "cost", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "input_cost": { + "name": "input_cost", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "output_cost": { + "name": "output_cost", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "cached_input_cost": { + "name": "cached_input_cost", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "request_cost": { + "name": "request_cost", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "estimated_cost": { + "name": "estimated_cost", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "canceled": { + "name": "canceled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "streamed": { + "name": "streamed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "cached": { + "name": "cached", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "mode": { + "name": "mode", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "used_mode": { + "name": "used_mode", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "log_organization_id_organization_id_fk": { + "name": "log_organization_id_organization_id_fk", + "tableFrom": "log", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "log_project_id_project_id_fk": { + "name": "log_project_id_project_id_fk", + "tableFrom": "log", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "log_api_key_id_api_key_id_fk": { + "name": "log_api_key_id_api_key_id_fk", + "tableFrom": "log", + "tableTo": "api_key", + "columnsFrom": [ + "api_key_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.message": { + "name": "message", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "chat_id": { + "name": "chat_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sequence": { + "name": "sequence", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "message_chat_id_chat_id_fk": { + "name": "message_chat_id_chat_id_fk", + "tableFrom": "message", + "tableTo": "chat", + "columnsFrom": [ + "chat_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization": { + "name": "organization", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_subscription_id": { + "name": "stripe_subscription_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credits": { + "name": "credits", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "auto_top_up_enabled": { + "name": "auto_top_up_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "auto_top_up_threshold": { + "name": "auto_top_up_threshold", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'10'" + }, + "auto_top_up_amount": { + "name": "auto_top_up_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'10'" + }, + "plan": { + "name": "plan", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'free'" + }, + "plan_expires_at": { + "name": "plan_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "subscription_cancelled": { + "name": "subscription_cancelled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "trial_start_date": { + "name": "trial_start_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "trial_end_date": { + "name": "trial_end_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "is_trial_active": { + "name": "is_trial_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "retention_level": { + "name": "retention_level", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'retain'" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organization_stripeCustomerId_unique": { + "name": "organization_stripeCustomerId_unique", + "nullsNotDistinct": false, + "columns": [ + "stripe_customer_id" + ] + }, + "organization_stripeSubscriptionId_unique": { + "name": "organization_stripeSubscriptionId_unique", + "nullsNotDistinct": false, + "columns": [ + "stripe_subscription_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_action": { + "name": "organization_action", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "amount": { + "name": "amount", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "organization_action_organization_id_organization_id_fk": { + "name": "organization_action_organization_id_organization_id_fk", + "tableFrom": "organization_action", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.passkey": { + "name": "passkey", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "public_key": { + "name": "public_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "counter": { + "name": "counter", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "device_type": { + "name": "device_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "backed_up": { + "name": "backed_up", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "transports": { + "name": "transports", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "passkey_user_id_user_id_fk": { + "name": "passkey_user_id_user_id_fk", + "tableFrom": "passkey", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_method": { + "name": "payment_method", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "stripe_payment_method_id": { + "name": "stripe_payment_method_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "payment_method_organization_id_organization_id_fk": { + "name": "payment_method_organization_id_organization_id_fk", + "tableFrom": "payment_method", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project": { + "name": "project", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "caching_enabled": { + "name": "caching_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cache_duration_seconds": { + "name": "cache_duration_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 60 + }, + "mode": { + "name": "mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'credits'" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + } + }, + "indexes": {}, + "foreignKeys": { + "project_organization_id_organization_id_fk": { + "name": "project_organization_id_organization_id_fk", + "tableFrom": "project", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.provider_key": { + "name": "provider_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "base_url": { + "name": "base_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "provider_key_organization_id_organization_id_fk": { + "name": "provider_key_organization_id_organization_id_fk", + "tableFrom": "provider_key", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "provider_key_organizationId_name_unique": { + "name": "provider_key_organizationId_name_unique", + "nullsNotDistinct": false, + "columns": [ + "organization_id", + "name" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_token_unique": { + "name": "session_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.transaction": { + "name": "transaction", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "amount": { + "name": "amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "credit_amount": { + "name": "credit_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'USD'" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'completed'" + }, + "stripe_payment_intent_id": { + "name": "stripe_payment_intent_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_invoice_id": { + "name": "stripe_invoice_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "transaction_organization_id_organization_id_fk": { + "name": "transaction_organization_id_organization_id_fk", + "tableFrom": "transaction", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "onboarding_completed": { + "name": "onboarding_completed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_organization": { + "name": "user_organization", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_organization_user_id_user_id_fk": { + "name": "user_organization_user_id_user_id_fk", + "tableFrom": "user_organization", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_organization_organization_id_organization_id_fk": { + "name": "user_organization_organization_id_organization_id_fk", + "tableFrom": "user_organization", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index d088ae8fe7..4c3b2ffb15 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -211,6 +211,13 @@ "when": 1753404831184, "tag": "1753404831_freezing_sentinel", "breakpoints": true + }, + { + "idx": 30, + "version": "7", + "when": 1753466042913, + "tag": "1753466042_motionless_cardiac", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index 697aeaeeba..7789a26cae 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -264,6 +264,7 @@ export const log = pgTable("log", { reasoningContent: text(), toolCalls: json(), tools: json(), + toolChoice: json(), finishReason: text(), unifiedFinishReason: text(), promptTokens: decimal(), From 821060a7a53642732814d79f6f1bdca6c9d623b2 Mon Sep 17 00:00:00 2001 From: "Luca Steeb (bot)" Date: Fri, 25 Jul 2025 18:06:52 +0000 Subject: [PATCH 03/11] chore(autofix): apply diff --- apps/next/src/lib/api/v1.d.ts | 3 +++ apps/ui/src/lib/api/v1.d.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/apps/next/src/lib/api/v1.d.ts b/apps/next/src/lib/api/v1.d.ts index 93a9ea75b7..76f7630fd6 100644 --- a/apps/next/src/lib/api/v1.d.ts +++ b/apps/next/src/lib/api/v1.d.ts @@ -522,6 +522,9 @@ export interface paths { topP: number | null; frequencyPenalty: number | null; presencePenalty: number | null; + tools?: unknown; + toolChoice?: unknown; + toolCalls?: unknown; hasError: boolean | null; errorDetails: { statusCode: number; diff --git a/apps/ui/src/lib/api/v1.d.ts b/apps/ui/src/lib/api/v1.d.ts index 93a9ea75b7..76f7630fd6 100644 --- a/apps/ui/src/lib/api/v1.d.ts +++ b/apps/ui/src/lib/api/v1.d.ts @@ -522,6 +522,9 @@ export interface paths { topP: number | null; frequencyPenalty: number | null; presencePenalty: number | null; + tools?: unknown; + toolChoice?: unknown; + toolCalls?: unknown; hasError: boolean | null; errorDetails: { statusCode: number; From a1eea2dcd2a293f642b306e2dafd87bae84e2062 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Sat, 26 Jul 2025 00:33:37 +0200 Subject: [PATCH 04/11] fix(chat): update tool tracking in response payload Replaced `toolCalls` with `tools` and `toolChoice` for better clarity and usability in chat response schema. Updated downstream response handling accordingly. --- apps/gateway/src/chat/chat.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/gateway/src/chat/chat.ts b/apps/gateway/src/chat/chat.ts index 79463f1f78..6cc9659f5f 100644 --- a/apps/gateway/src/chat/chat.ts +++ b/apps/gateway/src/chat/chat.ts @@ -2829,7 +2829,6 @@ chat.openapi(completions, async (c) => { responseSize: responseText.length, content: content, reasoningContent: reasoningContent, - toolCalls: toolCalls, finishReason: finishReason, promptTokens: calculatedPromptTokens?.toString() || null, completionTokens: calculatedCompletionTokens?.toString() || null, @@ -2851,6 +2850,8 @@ chat.openapi(completions, async (c) => { cost: costs.totalCost, estimatedCost: costs.estimatedCost, cached: false, + tools, + toolChoice: tool_choice, }); // Transform response to OpenAI format for non-OpenAI providers From b94d41b925e3ff247e2a49eeedfdb545641ca28c Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Sat, 26 Jul 2025 00:45:57 +0200 Subject: [PATCH 05/11] fix(api): remove unused `toolCalls` from schemas Eliminated the `toolCalls` property from v1 API schemas across UI, Next, and API layers as it is no longer required. --- apps/api/src/routes/logs.ts | 1 - apps/next/src/lib/api/v1.d.ts | 1 - apps/ui/src/lib/api/v1.d.ts | 1 - 3 files changed, 3 deletions(-) diff --git a/apps/api/src/routes/logs.ts b/apps/api/src/routes/logs.ts index eaf26871ea..6459708645 100644 --- a/apps/api/src/routes/logs.ts +++ b/apps/api/src/routes/logs.ts @@ -39,7 +39,6 @@ const logSchema = z.object({ presencePenalty: z.number().nullable(), tools: z.any().nullable(), toolChoice: z.any().nullable(), - toolCalls: z.any().nullable(), hasError: z.boolean().nullable(), errorDetails: errorDetails.nullable(), cost: z.number().nullable(), diff --git a/apps/next/src/lib/api/v1.d.ts b/apps/next/src/lib/api/v1.d.ts index 76f7630fd6..754cb99da1 100644 --- a/apps/next/src/lib/api/v1.d.ts +++ b/apps/next/src/lib/api/v1.d.ts @@ -524,7 +524,6 @@ export interface paths { presencePenalty: number | null; tools?: unknown; toolChoice?: unknown; - toolCalls?: unknown; hasError: boolean | null; errorDetails: { statusCode: number; diff --git a/apps/ui/src/lib/api/v1.d.ts b/apps/ui/src/lib/api/v1.d.ts index 76f7630fd6..754cb99da1 100644 --- a/apps/ui/src/lib/api/v1.d.ts +++ b/apps/ui/src/lib/api/v1.d.ts @@ -524,7 +524,6 @@ export interface paths { presencePenalty: number | null; tools?: unknown; toolChoice?: unknown; - toolCalls?: unknown; hasError: boolean | null; errorDetails: { statusCode: number; From eb420288d15dab62078772bbda0a88966b6f6568 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Sat, 26 Jul 2025 01:21:38 +0200 Subject: [PATCH 06/11] fix(schema): remove unused `toolCalls` field Eliminated the unused `toolCalls` property from the schema to maintain consistency and simplify the structure. --- packages/db/src/schema.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index 7789a26cae..723ceb19cd 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -262,7 +262,6 @@ export const log = pgTable("log", { responseSize: integer().notNull(), content: text(), reasoningContent: text(), - toolCalls: json(), tools: json(), toolChoice: json(), finishReason: text(), From e5d33ecab38af96361a17a8a065d090bfa5f9729 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Sat, 26 Jul 2025 01:23:05 +0200 Subject: [PATCH 07/11] feat(migrations): add snapshot for database schema Introduced a new snapshot file for the database schema, reflecting the current structure of tables, columns, indexes, and constraints. Allows for better tracking of schema changes over time. --- .../db/migrations/1753485632_dusty_tarot.sql | 1 + .../migrations/meta/1753485632_snapshot.json | 1716 +++++++++++++++++ packages/db/migrations/meta/_journal.json | 7 + 3 files changed, 1724 insertions(+) create mode 100644 packages/db/migrations/1753485632_dusty_tarot.sql create mode 100644 packages/db/migrations/meta/1753485632_snapshot.json diff --git a/packages/db/migrations/1753485632_dusty_tarot.sql b/packages/db/migrations/1753485632_dusty_tarot.sql new file mode 100644 index 0000000000..1dfd63a278 --- /dev/null +++ b/packages/db/migrations/1753485632_dusty_tarot.sql @@ -0,0 +1 @@ +ALTER TABLE "log" DROP COLUMN "tool_calls"; \ No newline at end of file diff --git a/packages/db/migrations/meta/1753485632_snapshot.json b/packages/db/migrations/meta/1753485632_snapshot.json new file mode 100644 index 0000000000..0af1fa2b48 --- /dev/null +++ b/packages/db/migrations/meta/1753485632_snapshot.json @@ -0,0 +1,1716 @@ +{ + "id": "6ab8b018-6821-49c6-9e4d-927fea1f617d", + "prevId": "9a9e28e6-0e25-4fc7-a988-4092bea2408b", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.api_key": { + "name": "api_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "api_key_project_id_project_id_fk": { + "name": "api_key_project_id_project_id_fk", + "tableFrom": "api_key", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "api_key_token_unique": { + "name": "api_key_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.chat": { + "name": "chat", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + } + }, + "indexes": {}, + "foreignKeys": { + "chat_user_id_user_id_fk": { + "name": "chat_user_id_user_id_fk", + "tableFrom": "chat", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.installation": { + "name": "installation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "installation_uuid_unique": { + "name": "installation_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lock": { + "name": "lock", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "lock_key_unique": { + "name": "lock_key_unique", + "nullsNotDistinct": false, + "columns": [ + "key" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.log": { + "name": "log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "request_id": { + "name": "request_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "api_key_id": { + "name": "api_key_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "requested_model": { + "name": "requested_model", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "requested_provider": { + "name": "requested_provider", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "used_model": { + "name": "used_model", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "used_provider": { + "name": "used_provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "response_size": { + "name": "response_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reasoning_content": { + "name": "reasoning_content", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tools": { + "name": "tools", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "tool_choice": { + "name": "tool_choice", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "finish_reason": { + "name": "finish_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unified_finish_reason": { + "name": "unified_finish_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "prompt_tokens": { + "name": "prompt_tokens", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "completion_tokens": { + "name": "completion_tokens", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "total_tokens": { + "name": "total_tokens", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "reasoning_tokens": { + "name": "reasoning_tokens", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "cached_tokens": { + "name": "cached_tokens", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "messages": { + "name": "messages", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "temperature": { + "name": "temperature", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "max_tokens": { + "name": "max_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "top_p": { + "name": "top_p", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "frequency_penalty": { + "name": "frequency_penalty", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "presence_penalty": { + "name": "presence_penalty", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "has_error": { + "name": "has_error", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "error_details": { + "name": "error_details", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "cost": { + "name": "cost", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "input_cost": { + "name": "input_cost", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "output_cost": { + "name": "output_cost", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "cached_input_cost": { + "name": "cached_input_cost", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "request_cost": { + "name": "request_cost", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "estimated_cost": { + "name": "estimated_cost", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "canceled": { + "name": "canceled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "streamed": { + "name": "streamed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "cached": { + "name": "cached", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "mode": { + "name": "mode", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "used_mode": { + "name": "used_mode", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "log_organization_id_organization_id_fk": { + "name": "log_organization_id_organization_id_fk", + "tableFrom": "log", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "log_project_id_project_id_fk": { + "name": "log_project_id_project_id_fk", + "tableFrom": "log", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "log_api_key_id_api_key_id_fk": { + "name": "log_api_key_id_api_key_id_fk", + "tableFrom": "log", + "tableTo": "api_key", + "columnsFrom": [ + "api_key_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.message": { + "name": "message", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "chat_id": { + "name": "chat_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sequence": { + "name": "sequence", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "message_chat_id_chat_id_fk": { + "name": "message_chat_id_chat_id_fk", + "tableFrom": "message", + "tableTo": "chat", + "columnsFrom": [ + "chat_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization": { + "name": "organization", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_subscription_id": { + "name": "stripe_subscription_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credits": { + "name": "credits", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "auto_top_up_enabled": { + "name": "auto_top_up_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "auto_top_up_threshold": { + "name": "auto_top_up_threshold", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'10'" + }, + "auto_top_up_amount": { + "name": "auto_top_up_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'10'" + }, + "plan": { + "name": "plan", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'free'" + }, + "plan_expires_at": { + "name": "plan_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "subscription_cancelled": { + "name": "subscription_cancelled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "trial_start_date": { + "name": "trial_start_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "trial_end_date": { + "name": "trial_end_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "is_trial_active": { + "name": "is_trial_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "retention_level": { + "name": "retention_level", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'retain'" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organization_stripeCustomerId_unique": { + "name": "organization_stripeCustomerId_unique", + "nullsNotDistinct": false, + "columns": [ + "stripe_customer_id" + ] + }, + "organization_stripeSubscriptionId_unique": { + "name": "organization_stripeSubscriptionId_unique", + "nullsNotDistinct": false, + "columns": [ + "stripe_subscription_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_action": { + "name": "organization_action", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "amount": { + "name": "amount", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "organization_action_organization_id_organization_id_fk": { + "name": "organization_action_organization_id_organization_id_fk", + "tableFrom": "organization_action", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.passkey": { + "name": "passkey", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "public_key": { + "name": "public_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "counter": { + "name": "counter", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "device_type": { + "name": "device_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "backed_up": { + "name": "backed_up", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "transports": { + "name": "transports", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "passkey_user_id_user_id_fk": { + "name": "passkey_user_id_user_id_fk", + "tableFrom": "passkey", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_method": { + "name": "payment_method", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "stripe_payment_method_id": { + "name": "stripe_payment_method_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "payment_method_organization_id_organization_id_fk": { + "name": "payment_method_organization_id_organization_id_fk", + "tableFrom": "payment_method", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project": { + "name": "project", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "caching_enabled": { + "name": "caching_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cache_duration_seconds": { + "name": "cache_duration_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 60 + }, + "mode": { + "name": "mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'credits'" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + } + }, + "indexes": {}, + "foreignKeys": { + "project_organization_id_organization_id_fk": { + "name": "project_organization_id_organization_id_fk", + "tableFrom": "project", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.provider_key": { + "name": "provider_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "base_url": { + "name": "base_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "provider_key_organization_id_organization_id_fk": { + "name": "provider_key_organization_id_organization_id_fk", + "tableFrom": "provider_key", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "provider_key_organizationId_name_unique": { + "name": "provider_key_organizationId_name_unique", + "nullsNotDistinct": false, + "columns": [ + "organization_id", + "name" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_token_unique": { + "name": "session_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.transaction": { + "name": "transaction", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "amount": { + "name": "amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "credit_amount": { + "name": "credit_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'USD'" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'completed'" + }, + "stripe_payment_intent_id": { + "name": "stripe_payment_intent_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_invoice_id": { + "name": "stripe_invoice_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "transaction_organization_id_organization_id_fk": { + "name": "transaction_organization_id_organization_id_fk", + "tableFrom": "transaction", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "onboarding_completed": { + "name": "onboarding_completed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_organization": { + "name": "user_organization", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_organization_user_id_user_id_fk": { + "name": "user_organization_user_id_user_id_fk", + "tableFrom": "user_organization", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_organization_organization_id_organization_id_fk": { + "name": "user_organization_organization_id_organization_id_fk", + "tableFrom": "user_organization", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 4c3b2ffb15..11cb28de7a 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -218,6 +218,13 @@ "when": 1753466042913, "tag": "1753466042_motionless_cardiac", "breakpoints": true + }, + { + "idx": 31, + "version": "7", + "when": 1753485632734, + "tag": "1753485632_dusty_tarot", + "breakpoints": true } ] } \ No newline at end of file From 8db20237b6343371d8713f88a7eec5f214903ebf Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Sat, 26 Jul 2025 01:23:14 +0200 Subject: [PATCH 08/11] fix(chat): replace `toolCalls` with `tools` and `toolChoice` Updated the chat response schema to remove the unused `toolCalls` property and replace it with `tools` and `toolChoice` fields for improved clarity and functionality. --- apps/gateway/src/chat/chat.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/gateway/src/chat/chat.ts b/apps/gateway/src/chat/chat.ts index 6cc9659f5f..54d5e20bc5 100644 --- a/apps/gateway/src/chat/chat.ts +++ b/apps/gateway/src/chat/chat.ts @@ -2571,7 +2571,6 @@ chat.openapi(completions, async (c) => { responseSize: fullContent.length, content: fullContent, reasoningContent: fullReasoningContent || null, - toolCalls: fullToolCalls, finishReason: finishReason, promptTokens: calculatedPromptTokens?.toString() || null, completionTokens: calculatedCompletionTokens?.toString() || null, @@ -2589,6 +2588,8 @@ chat.openapi(completions, async (c) => { cost: costs.totalCost, estimatedCost: costs.estimatedCost, cached: false, + tools, + toolChoice: tool_choice, }); } }); From 461547f4634976ec6ea777b4a48ebd54cb671235 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Sat, 26 Jul 2025 01:28:06 +0200 Subject: [PATCH 09/11] fix(chat): remove unused tool call extraction logic Deleted the `extractToolCallsFromProvider` function and related logic from the chat module as it is no longer required. This simplifies the codebase and eliminates redundant functionality. --- apps/gateway/src/chat/chat.ts | 154 ---------------------------------- 1 file changed, 154 deletions(-) diff --git a/apps/gateway/src/chat/chat.ts b/apps/gateway/src/chat/chat.ts index 54d5e20bc5..a1c23f5d02 100644 --- a/apps/gateway/src/chat/chat.ts +++ b/apps/gateway/src/chat/chat.ts @@ -340,66 +340,6 @@ function extractReasoningContentFromProvider( } } -/** - * Extracts tool calls from streaming data based on provider format - */ -function extractToolCallsFromProvider( - data: any, - provider: Provider, -): Array<{ - id: string; - type: string; - function: { - name: string; - arguments: string; - }; -}> | null { - switch (provider) { - case "anthropic": - // For Anthropic, tool calls come in content_block_start and content_block_delta events - if ( - data.type === "content_block_start" && - data.content_block?.type === "tool_use" - ) { - return [ - { - id: data.content_block.id, - type: "function", - function: { - name: data.content_block.name, - arguments: "", - }, - }, - ]; - } else if ( - data.type === "content_block_delta" && - data.delta?.partial_json - ) { - // Return partial arguments for accumulation - return [ - { - id: "", // Will be matched by index - type: "function", - function: { - name: "", - arguments: data.delta.partial_json, - }, - }, - ]; - } - return null; - case "inference.net": - case "together.ai": - case "groq": - case "deepseek": - case "perplexity": - case "alibaba": - return data.choices?.[0]?.delta?.tool_calls || null; - default: // OpenAI format - return data.choices?.[0]?.delta?.tool_calls || null; - } -} - /** * Extracts token usage information from streaming data based on provider format */ @@ -1955,14 +1895,6 @@ chat.openapi(completions, async (c) => { let totalTokens = null; let reasoningTokens = null; let cachedTokens = null; - let fullToolCalls: Array<{ - id: string; - type: string; - function: { - name: string; - arguments: string; - }; - }> | null = null; let buffer = ""; // Buffer for accumulating partial data across chunks const MAX_BUFFER_SIZE = 10 * 1024 * 1024; // 10MB limit @@ -2056,31 +1988,6 @@ chat.openapi(completions, async (c) => { fullReasoningContent += reasoningContentChunk; } - // Extract tool calls for logging using helper function - const toolCallsChunk = extractToolCallsFromProvider( - data, - usedProvider, - ); - if (toolCallsChunk) { - if (!fullToolCalls) { - fullToolCalls = []; - } - // For Google providers, accumulate tool calls - for (const toolCall of toolCallsChunk) { - const existingIndex = fullToolCalls.findIndex( - (tc) => tc.id === toolCall.id, - ); - if (existingIndex >= 0) { - // Update existing tool call - fullToolCalls[existingIndex].function.arguments += - toolCall.function.arguments; - } else { - // Add new tool call - fullToolCalls.push(toolCall); - } - } - } - // Check for finish reason if (data.candidates && data.candidates[0]?.finishReason) { finishReason = data.candidates[0].finishReason; @@ -2271,67 +2178,6 @@ chat.openapi(completions, async (c) => { fullReasoningContent += reasoningContentChunk; } - // Extract tool calls using helper function - const toolCallsChunk = extractToolCallsFromProvider( - data, - usedProvider, - ); - if (toolCallsChunk) { - if (!fullToolCalls) { - fullToolCalls = []; - } - - if (usedProvider === "anthropic") { - // For Anthropic, handle content_block_start and content_block_delta - for (const toolCall of toolCallsChunk) { - if (data.type === "content_block_start") { - // New tool call - fullToolCalls.push(toolCall); - } else if (data.type === "content_block_delta") { - // Accumulate arguments for the last tool call - const lastIndex = fullToolCalls.length - 1; - if (lastIndex >= 0) { - fullToolCalls[lastIndex].function.arguments += - toolCall.function.arguments; - } - } - } - } else { - // For OpenAI format providers - these have index and delta format - for (const deltaToolCall of toolCallsChunk as any[]) { - const index = deltaToolCall.index || 0; - - // Ensure we have a tool call at this index - while (fullToolCalls.length <= index) { - fullToolCalls.push({ - id: "", - type: "function", - function: { - name: "", - arguments: "", - }, - }); - } - - // Accumulate the tool call data - if (deltaToolCall.id) { - fullToolCalls[index].id = deltaToolCall.id; - } - if (deltaToolCall.type) { - fullToolCalls[index].type = deltaToolCall.type; - } - if (deltaToolCall.function?.name) { - fullToolCalls[index].function.name = - deltaToolCall.function.name; - } - if (deltaToolCall.function?.arguments) { - fullToolCalls[index].function.arguments += - deltaToolCall.function.arguments; - } - } - } - } - // Handle provider-specific finish reason extraction switch (usedProvider) { case "anthropic": From 3b9a3dd85f47328ca1697a0cd47af7dc480e639f Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Sun, 27 Jul 2025 18:31:04 +0200 Subject: [PATCH 10/11] fix(ui): remove unused toolCalls logic Removed `toolCalls` property and related logic from UI components and type definitions to simplify the structure and maintain consistency. Retained `tools` and `toolChoice` fields for better clarity. --- .../src/components/activity/recent-logs.tsx | 6 +-- .../src/components/dashboard/log-card.tsx | 43 ------------------- apps/next/src/types/activity.ts | 5 +-- .../src/components/activity/recent-logs.tsx | 1 - 4 files changed, 4 insertions(+), 51 deletions(-) diff --git a/apps/next/src/components/activity/recent-logs.tsx b/apps/next/src/components/activity/recent-logs.tsx index 9b01593198..91104ce769 100644 --- a/apps/next/src/components/activity/recent-logs.tsx +++ b/apps/next/src/components/activity/recent-logs.tsx @@ -59,9 +59,8 @@ interface RecentLogsProps { topP: number | null; frequencyPenalty: number | null; presencePenalty: number | null; - tools: unknown | null; - toolChoice: unknown | null; - toolCalls: unknown | null; + tools: string | null; + toolChoice: string | null; hasError: boolean | null; errorDetails: { statusCode: number; @@ -295,7 +294,6 @@ export function RecentLogs({ initialData }: RecentLogsProps) { messages: log.messages as any, tools: log.tools, toolChoice: log.toolChoice, - toolCalls: log.toolCalls, errorDetails: log.errorDetails as any, cachedTokens: (log as any).cachedTokens || null, cachedInputCost: (log as any).cachedInputCost || null, diff --git a/apps/next/src/components/dashboard/log-card.tsx b/apps/next/src/components/dashboard/log-card.tsx index 4ccab1e658..16b304b2ab 100644 --- a/apps/next/src/components/dashboard/log-card.tsx +++ b/apps/next/src/components/dashboard/log-card.tsx @@ -312,49 +312,6 @@ export function LogCard({ log }: { log: Log }) {

- {(log.tools || log.toolChoice || log.toolCalls) && ( -
-

Tool Information

-
- {log.tools && ( -
-
- Available Tools -
-
-
-												{JSON.stringify(log.tools, null, 2)}
-											
-
-
- )} - {log.toolChoice && ( -
-
- Tool Choice -
-
-
-												{JSON.stringify(log.toolChoice, null, 2)}
-											
-
-
- )} - {log.toolCalls && ( -
-
- Tool Calls -
-
-
-												{JSON.stringify(log.toolCalls, null, 2)}
-											
-
-
- )} -
-
- )} {log.hasError && !!log.errorDetails && (

diff --git a/apps/next/src/types/activity.ts b/apps/next/src/types/activity.ts index db6dfd40a7..3df73d9e10 100644 --- a/apps/next/src/types/activity.ts +++ b/apps/next/src/types/activity.ts @@ -88,9 +88,8 @@ export interface LogsData { topP: number | null; frequencyPenalty: number | null; presencePenalty: number | null; - tools: unknown | null; - toolChoice: unknown | null; - toolCalls: unknown | null; + tools: string | null; + toolChoice: string | null; hasError: boolean | null; errorDetails: { statusCode: number; diff --git a/apps/ui/src/components/activity/recent-logs.tsx b/apps/ui/src/components/activity/recent-logs.tsx index d2a2003b50..b6f58ad117 100644 --- a/apps/ui/src/components/activity/recent-logs.tsx +++ b/apps/ui/src/components/activity/recent-logs.tsx @@ -159,7 +159,6 @@ export function RecentLogs() { messages: log.messages as any, tools: (log as any).tools, toolChoice: (log as any).toolChoice, - toolCalls: (log as any).toolCalls, errorDetails: log.errorDetails as any, reasoningTokens: log.reasoningTokens, reasoningContent: (log as any).reasoningContent, From 97b42289c87c81037acf3f1e7c6359f93c61b835 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Sun, 27 Jul 2025 19:05:08 +0200 Subject: [PATCH 11/11] feat(dashboard): display tools and toolChoice in log card Added new sections in the dashboard log card to display `tools` and `toolChoice` if available. Updated layout and styles to incorporate the changes. Removed obsolete `toolCalls` logic across related components. --- apps/gateway/src/chat/chat.ts | 47 +------------------ .../src/components/dashboard/log-card.tsx | 32 +++++++++++++ 2 files changed, 34 insertions(+), 45 deletions(-) diff --git a/apps/gateway/src/chat/chat.ts b/apps/gateway/src/chat/chat.ts index 8f5af65096..8881108df3 100644 --- a/apps/gateway/src/chat/chat.ts +++ b/apps/gateway/src/chat/chat.ts @@ -1610,14 +1610,6 @@ chat.openapi(completions, async (c) => { let totalTokens = null; let reasoningTokens = null; let cachedTokens = null; - let fullToolCalls: Array<{ - id: string; - type: string; - function: { - name: string; - arguments: string; - }; - }> = []; for (const chunk of cachedStreamingResponse.chunks) { try { @@ -1634,42 +1626,6 @@ chat.openapi(completions, async (c) => { chunkData.choices[0].delta.reasoning_content; } - // Accumulate tool calls from streaming chunks - if (chunkData.choices?.[0]?.delta?.tool_calls) { - const deltaToolCalls = chunkData.choices[0].delta.tool_calls; - for (const deltaToolCall of deltaToolCalls) { - const index = deltaToolCall.index || 0; - - // Ensure we have a tool call at this index - while (fullToolCalls.length <= index) { - fullToolCalls.push({ - id: "", - type: "function", - function: { - name: "", - arguments: "", - }, - }); - } - - // Accumulate the tool call data - if (deltaToolCall.id) { - fullToolCalls[index].id = deltaToolCall.id; - } - if (deltaToolCall.type) { - fullToolCalls[index].type = deltaToolCall.type; - } - if (deltaToolCall.function?.name) { - fullToolCalls[index].function.name = - deltaToolCall.function.name; - } - if (deltaToolCall.function?.arguments) { - fullToolCalls[index].function.arguments += - deltaToolCall.function.arguments; - } - } - } - // Extract usage information (usually in the last chunks) if (chunkData.usage) { if (chunkData.usage.prompt_tokens) { @@ -1711,6 +1667,8 @@ chat.openapi(completions, async (c) => { top_p, frequency_penalty, presence_penalty, + tools, + tool_choice, ); await insertLog({ @@ -1719,7 +1677,6 @@ chat.openapi(completions, async (c) => { responseSize: JSON.stringify(cachedStreamingResponse).length, content: fullContent || null, reasoningContent: fullReasoningContent || null, - toolCalls: fullToolCalls.length > 0 ? fullToolCalls : null, finishReason: cachedStreamingResponse.metadata.finishReason, promptTokens: promptTokens?.toString() || null, completionTokens: completionTokens?.toString() || null, diff --git a/apps/next/src/components/dashboard/log-card.tsx b/apps/next/src/components/dashboard/log-card.tsx index 16b304b2ab..ed51f55537 100644 --- a/apps/next/src/components/dashboard/log-card.tsx +++ b/apps/next/src/components/dashboard/log-card.tsx @@ -312,6 +312,37 @@ export function LogCard({ log }: { log: Log }) {

+ {((log as any).tools || (log as any).toolChoice) && ( +
+

Tool Information

+
+ {(log as any).tools && ( +
+
+ Available Tools +
+
+
+												{JSON.stringify((log as any).tools, null, 2)}
+											
+
+
+ )} + {(log as any).toolChoice && ( +
+
+ Tool Choice +
+
+
+												{JSON.stringify((log as any).toolChoice, null, 2)}
+											
+
+
+ )} +
+
+ )} {log.hasError && !!log.errorDetails && (

@@ -355,6 +386,7 @@ export function LogCard({ log }: { log: Log }) {

)} + ` )}