fix: display image attachments in user message bubbles

Images sent by the user were transmitted to the gateway correctly but
not shown in the chat UI, making it appear as if attachments were lost.

Now image blocks are included in the user message for immediate visual
feedback.

Closes #14
This commit is contained in:
Nicolas Varrot
2026-02-27 13:31:39 +00:00
parent 88c98f4a66
commit e77a1c8dcb
3 changed files with 7 additions and 4 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "pinchchat",
"version": "1.67.2",
"version": "1.67.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "pinchchat",
"version": "1.67.2",
"version": "1.67.3",
"license": "MIT",
"dependencies": {
"@tailwindcss/vite": "^4.1.18",

View File

@@ -1,6 +1,6 @@
{
"name": "pinchchat",
"version": "1.67.2",
"version": "1.67.3",
"description": "A sleek, dark-themed webchat UI for OpenClaw — monitor sessions, stream responses, and inspect tool calls in real-time.",
"type": "module",
"repository": {

View File

@@ -427,12 +427,15 @@ export function useGateway() {
const sendMessage = useCallback(async (text: string, attachments?: Array<{ mimeType: string; fileName: string; content: string }>) => {
const msgId = 'user-' + Date.now();
const imageBlocks: MessageBlock[] = (attachments ?? [])
.filter(a => a.mimeType.startsWith('image/'))
.map(a => ({ type: 'image' as const, mediaType: a.mimeType, data: a.content }));
const userMsg: ChatMessage = {
id: msgId,
role: 'user',
content: text,
timestamp: Date.now(),
blocks: [{ type: 'text', text }],
blocks: [...imageBlocks, { type: 'text', text }],
sendStatus: 'sending',
};
setMessages(prev => [...prev, userMsg]);