fix: restore image outputs from tool calls (#1640)

This commit is contained in:
Bradley Axen
2025-03-12 14:46:02 -07:00
committed by GitHub
parent 99f8126c2c
commit 9b5964e343

View File

@@ -130,12 +130,23 @@ function ToolResultView({ result }: ToolResultViewProps) {
)}
{(isExpanded || !shouldMinimize) && (
<>
{item.text && (
{item.type === 'text' && item.text && (
<MarkdownContent
content={item.text}
className="whitespace-pre-wrap p-2 max-w-full overflow-x-auto"
/>
)}
{item.type === 'image' && (
<img
src={`data:${item.mimeType};base64,${item.data}`}
alt="Tool result"
className="max-w-full h-auto rounded-md my-2"
onError={(e) => {
console.error('Failed to load image: Invalid MIME-type encoded image data');
e.currentTarget.style.display = 'none';
}}
/>
)}
</>
)}
</div>