fix: restrict file attachments to images only

The OpenClaw gateway only supports image attachments in chat.send;
non-image files were silently dropped, confusing users (fixes #24).

- Filter non-image files in addFiles handler
- Update file input accept to image/* only
- Remove unused fileToBase64 helper
- Update i18n labels from 'Attach file' to 'Attach image' (all 8 langs)

Fixes #24
This commit is contained in:
Nicolas Varrot
2026-03-11 09:04:35 +00:00
parent c4eb7dd844
commit bc3e507a77
2 changed files with 16 additions and 35 deletions

View File

@@ -49,7 +49,7 @@ const en = {
'chat.loadingHistory': 'Loading messages…',
'chat.inputPlaceholder': 'Type a message…',
'chat.inputLabel': 'Message',
'chat.attachFile': 'Attach file',
'chat.attachFile': 'Attach image',
'chat.send': 'Send',
'chat.stop': 'Stop',
'chat.showPreview': 'Preview markdown',
@@ -245,7 +245,7 @@ const fr: Record<keyof typeof en, string> = {
'chat.loadingHistory': 'Chargement des messages…',
'chat.inputPlaceholder': 'Tapez un message…',
'chat.inputLabel': 'Message',
'chat.attachFile': 'Joindre un fichier',
'chat.attachFile': 'Joindre une image',
'chat.send': 'Envoyer',
'chat.stop': 'Arrêter',
'chat.showPreview': 'Aperçu markdown',
@@ -428,7 +428,7 @@ const es: Record<keyof typeof en, string> = {
'chat.loadingHistory': 'Cargando mensajes…',
'chat.inputPlaceholder': 'Escribe un mensaje…',
'chat.inputLabel': 'Mensaje',
'chat.attachFile': 'Adjuntar archivo',
'chat.attachFile': 'Adjuntar imagen',
'chat.send': 'Enviar',
'chat.stop': 'Detener',
'chat.showPreview': 'Vista previa markdown',
@@ -613,7 +613,7 @@ const de: Record<keyof typeof en, string> = {
'chat.loadingHistory': 'Nachrichten werden geladen…',
'chat.inputPlaceholder': 'Nachricht eingeben…',
'chat.inputLabel': 'Nachricht',
'chat.attachFile': 'Datei anhängen',
'chat.attachFile': 'Bild anhängen',
'chat.send': 'Senden',
'chat.stop': 'Stoppen',
'chat.showPreview': 'Markdown-Vorschau',
@@ -796,7 +796,7 @@ const ja: Record<keyof typeof en, string> = {
'chat.loadingHistory': 'メッセージを読み込み中…',
'chat.inputPlaceholder': 'メッセージを入力…',
'chat.inputLabel': 'メッセージ',
'chat.attachFile': 'ファイルを添付',
'chat.attachFile': '画像を添付',
'chat.send': '送信',
'chat.stop': '停止',
'chat.showPreview': 'Markdownプレビュー',
@@ -979,7 +979,7 @@ const pt: Record<keyof typeof en, string> = {
'chat.loadingHistory': 'Carregando mensagens…',
'chat.inputPlaceholder': 'Digite uma mensagem…',
'chat.inputLabel': 'Mensagem',
'chat.attachFile': 'Anexar arquivo',
'chat.attachFile': 'Anexar imagem',
'chat.send': 'Enviar',
'chat.stop': 'Parar',
'chat.showPreview': 'Pré-visualizar markdown',
@@ -1162,7 +1162,7 @@ const zh: Record<keyof typeof en, string> = {
'chat.loadingHistory': '加载消息中…',
'chat.inputPlaceholder': '输入消息…',
'chat.inputLabel': '消息',
'chat.attachFile': '添加附件',
'chat.attachFile': '添加图片',
'chat.send': '发送',
'chat.stop': '停止',
'chat.showPreview': '预览 Markdown',
@@ -1345,7 +1345,7 @@ const it: Record<keyof typeof en, string> = {
'chat.loadingHistory': 'Caricamento messaggi…',
'chat.inputPlaceholder': 'Scrivi un messaggio…',
'chat.inputLabel': 'Messaggio',
'chat.attachFile': 'Allega file',
'chat.attachFile': 'Allega immagine',
'chat.send': 'Invia',
'chat.stop': 'Ferma',
'chat.showPreview': 'Anteprima markdown',