diff --git a/frontend/src/components/thread/content/ThreadContent.tsx b/frontend/src/components/thread/content/ThreadContent.tsx index aa66837c..e41e5ea4 100644 --- a/frontend/src/components/thread/content/ThreadContent.tsx +++ b/frontend/src/components/thread/content/ThreadContent.tsx @@ -116,34 +116,53 @@ export function renderMarkdownContent( toolCalls.forEach((toolCall, index) => { const toolName = toolCall.functionName.replace(/_/g, '-'); - const IconComponent = getToolIcon(toolName); - // Extract primary parameter for display - let paramDisplay = ''; - if (toolCall.parameters.file_path) { - paramDisplay = toolCall.parameters.file_path; - } else if (toolCall.parameters.command) { - paramDisplay = toolCall.parameters.command; - } else if (toolCall.parameters.query) { - paramDisplay = toolCall.parameters.query; - } else if (toolCall.parameters.url) { - paramDisplay = toolCall.parameters.url; + if (toolName === 'ask') { + // Handle ask tool specially - extract text and attachments + const askText = toolCall.parameters.text || ''; + const attachments = toolCall.parameters.attachments || []; + + // Convert single attachment to array for consistent handling + const attachmentArray = Array.isArray(attachments) ? attachments : + (typeof attachments === 'string' ? attachments.split(',').map(a => a.trim()) : []); + + // Render ask tool content with attachment UI + contentParts.push( +
+ {askText} + {renderAttachments(attachmentArray, fileViewerHandler, sandboxId, project)} +
+ ); + } else { + const IconComponent = getToolIcon(toolName); + + // Extract primary parameter for display + let paramDisplay = ''; + if (toolCall.parameters.file_path) { + paramDisplay = toolCall.parameters.file_path; + } else if (toolCall.parameters.command) { + paramDisplay = toolCall.parameters.command; + } else if (toolCall.parameters.query) { + paramDisplay = toolCall.parameters.query; + } else if (toolCall.parameters.url) { + paramDisplay = toolCall.parameters.url; + } + + contentParts.push( +
+ +
+ ); } - - contentParts.push( -
- -
- ); }); lastIndex = match.index + match[0].length;