diff --git a/internal/tui/components/chat/chat.go b/internal/tui/components/chat/chat.go index 211808b88b1291ed2359dc137e14d1eeea8f2c14..d994c1ffd608ba42eeabb01a510c6a04fe67a2df 100644 --- a/internal/tui/components/chat/chat.go +++ b/internal/tui/components/chat/chat.go @@ -501,7 +501,8 @@ func (m *messageListCmp) convertAssistantMessage(msg message.Message, toolResult // If this tool call is the agent tool, fetch nested tool calls if tc.Name == agent.AgentToolName { nestedMessages, _ := m.app.Messages.List(context.Background(), tc.ID) - nestedUIMessages := m.convertMessagesToUI(nestedMessages, make(map[string]message.ToolResult)) + nestedToolResultMap := m.buildToolResultMap(nestedMessages) + nestedUIMessages := m.convertMessagesToUI(nestedMessages, nestedToolResultMap) nestedToolCalls := make([]messages.ToolCallCmp, 0, len(nestedUIMessages)) for _, nestedMsg := range nestedUIMessages { if toolCall, ok := nestedMsg.(messages.ToolCallCmp); ok {