mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Fix image generation skeleton
This commit is contained in:
1 file changed
+19
-14
@@ -328,7 +328,24 @@ export function ToolCallDisplay({ toolName, toolArgs, state, result }: ToolCallD
|
|||||||
|
|
||||||
// Special rendering for generate_image - always show image below the tool
|
// Special rendering for generate_image - always show image below the tool
|
||||||
const renderImageBelowTool = () => {
|
const renderImageBelowTool = () => {
|
||||||
if (toolName !== 'generate_image' || !result) return null;
|
if (toolName !== 'generate_image') return null;
|
||||||
|
|
||||||
|
// Show placeholder while generating (calling or waiting states)
|
||||||
|
if (state === 'calling' || state === 'waiting') {
|
||||||
|
return (
|
||||||
|
<div className="mt-1 p-3 bg-muted/30 rounded border max-w-xs">
|
||||||
|
<div className="relative w-full aspect-square">
|
||||||
|
<div className="w-full h-full rounded bg-muted/50" />
|
||||||
|
<div className="absolute inset-0 flex items-center justify-center">
|
||||||
|
<Loader2 className="h-12 w-12 text-muted-foreground/30 animate-spin" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// For completed state, we need the result
|
||||||
|
if (!result) return null;
|
||||||
|
|
||||||
// Parse "Generated image: /tmp/filename.png" from result
|
// Parse "Generated image: /tmp/filename.png" from result
|
||||||
const match = result.match(/Generated image:\s*(\/tmp\/[^\s\n]+)/);
|
const match = result.match(/Generated image:\s*(\/tmp\/[^\s\n]+)/);
|
||||||
@@ -350,21 +367,9 @@ export function ToolCallDisplay({ toolName, toolArgs, state, result }: ToolCallD
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (state === 'completed') {
|
} else {
|
||||||
// Image generation failed - show error in place
|
// Image generation failed - show error in place
|
||||||
return <ImageGenerationError />;
|
return <ImageGenerationError />;
|
||||||
} else if (state === 'calling' || state === 'waiting') {
|
|
||||||
// Show placeholder while generating
|
|
||||||
return (
|
|
||||||
<div className="mt-1 p-3 bg-muted/30 rounded border max-w-xs">
|
|
||||||
<div className="relative w-full aspect-square">
|
|
||||||
<div className="w-full h-full rounded bg-muted/50" />
|
|
||||||
<div className="absolute inset-0 flex items-center justify-center">
|
|
||||||
<Loader2 className="h-12 w-12 text-muted-foreground/30 animate-spin" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user