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:
@@ -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