Merge pull request #674 from escapade-mckv/tool-views-1a

Tool views 1a
This commit is contained in:
Bobbie 2025-06-06 21:05:55 +05:30 committed by GitHub
commit 93691deb1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 46 additions and 27 deletions

View File

@ -116,6 +116,24 @@ export function renderMarkdownContent(
toolCalls.forEach((toolCall, index) => {
const toolName = toolCall.functionName.replace(/_/g, '-');
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(
<div key={`ask-${match.index}-${index}`} className="space-y-3">
<Markdown className="text-sm prose prose-sm dark:prose-invert chat-markdown max-w-none break-words [&>:first-child]:mt-0 prose-headings:mt-3">{askText}</Markdown>
{renderAttachments(attachmentArray, fileViewerHandler, sandboxId, project)}
</div>
);
} else {
const IconComponent = getToolIcon(toolName);
// Extract primary parameter for display
@ -144,6 +162,7 @@ export function renderMarkdownContent(
</button>
</div>
);
}
});
lastIndex = match.index + match[0].length;