diff --git a/apps/web/src/app/dashboard/agents/[id]/chat/[chatId]/page.tsx b/apps/web/src/app/dashboard/agents/[id]/chat/[chatId]/page.tsx index 7842c18..8735a60 100644 --- a/apps/web/src/app/dashboard/agents/[id]/chat/[chatId]/page.tsx +++ b/apps/web/src/app/dashboard/agents/[id]/chat/[chatId]/page.tsx @@ -17,6 +17,12 @@ interface Agent { modelId: string; } +interface MessageToolCall { + toolCallId: string; + toolName: string; + args?: Record; +} + interface Message { id: string; role: 'USER' | 'ASSISTANT' | 'TOOL'; @@ -24,6 +30,7 @@ interface Message { toolName?: string; toolCallId?: string; toolResult?: unknown; + toolCalls?: MessageToolCall[] | null; createdAt: string; } @@ -608,35 +615,66 @@ export default function AgentChatPage(): React.ReactElement { } }; + // Check if this ASSISTANT message has embedded tool calls + const hasEmbeddedToolCalls = + message.role === 'ASSISTANT' && + message.toolCalls && + Array.isArray(message.toolCalls) && + message.toolCalls.length > 0; + return ( -
- {message.role === 'TOOL' ? ( -
- toggleToolCall(message.toolCallId || message.id)} - /> -
- ) : ( -
-

{message.content}

+
+ {/* Render embedded tool calls from ASSISTANT messages */} + {hasEmbeddedToolCalls && ( +
+ {message.toolCalls!.map((tc) => ( +
+
+ toggleToolCall(tc.toolCallId)} + /> +
+
+ ))}
)} + + {/* Render the message content */} +
+ {message.role === 'TOOL' ? ( +
+ toggleToolCall(message.toolCallId || message.id)} + /> +
+ ) : ( +
+

{message.content}

+
+ )} +
); })}