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:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user