Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 18, 2025

This PR implements general file attachment support to replace the current image-only attachment system while maintaining full backward compatibility.

🎯 Overview

Replaces the camera icon with a paperclip icon and extends file support beyond images to include documents, code files, data files, archives, and configuration files.

✨ Key Features

  • Comprehensive File Processing: New process-files.ts module with intelligent MIME type detection
  • Multiple File Categories: Support for images, documents, code, data, archives, and config files
  • Smart Content Handling: Text files as content, binary files as base64
  • File Size Validation: 10MB limit with user-friendly error messages
  • UI Updates: Paperclip icon replaces camera icon with updated tooltips
  • Internationalization: Added "attachFiles" translation key across all languages
  • Backward Compatibility: Existing image functionality continues to work seamlessly

🔧 Technical Implementation

  • Added selectFiles message types to WebviewMessage.ts and ExtensionMessage.ts
  • Updated webviewMessageHandler.ts to handle file selection workflow
  • Modified ChatTextArea.tsx and ChatView.tsx for new file attachment UI
  • Comprehensive file processing with MIME type detection and categorization

🧪 Testing

  • Maintains existing image attachment functionality
  • Supports all major file types with appropriate processing
  • Validates file sizes and provides clear error feedback

📝 Files Changed

  • src/integrations/misc/process-files.ts (new)
  • src/shared/WebviewMessage.ts
  • src/shared/ExtensionMessage.ts
  • src/core/webview/webviewMessageHandler.ts
  • webview-ui/src/components/chat/ChatTextArea.tsx
  • webview-ui/src/components/chat/ChatView.tsx
  • Translation files across all languages

Resolves #5532


Important

This PR replaces image-only attachment with general file attachment support, updates UI components, and adds internationalization for file attachments.

  • Behavior:
    • Replaces image-only attachment with general file attachment support, maintaining backward compatibility.
    • Supports images, documents, code, data, archives, and config files.
    • Text files are processed as content, binary files as base64.
    • File size limit set to 10MB with error messages.
  • UI Updates:
    • Replaces camera icon with paperclip icon in ChatTextArea.tsx and ChatView.tsx.
    • Updates tooltips and adds attachFiles translation key.
  • Technical Implementation:
    • Adds process-files.ts for file processing with MIME type detection.
    • Updates webviewMessageHandler.ts to handle file selection.
    • Adds selectFiles message types to WebviewMessage.ts and ExtensionMessage.ts.
  • Internationalization:
    • Adds "attachFiles" translation key across all languages.

This description was created by Ellipsis for 53422d3. You can customize this summary. It will automatically update as commits are pushed.

- Add comprehensive file processing system with MIME type detection
- Support multiple file categories (images, documents, code, data, archives, config)
- Implement 10MB file size limit and intelligent text/binary handling
- Replace camera icon with paperclip icon in chat interface
- Add selectFiles message types and handlers
- Update translations for attachFiles across all languages
- Maintain backward compatibility with existing image functionality

Resolves #5532
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 18, 2025 17:36
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request UI/UX UI/UX related or focused labels Jul 18, 2025
"selectApiConfig": "選取 API 設定",
"enhancePrompt": "使用額外內容增強提示",
"addImages": "新增圖片到訊息中",
"attachFiles": "Attach files to message",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'attachFiles' key still contains English text ('Attach files to message'). Please provide a proper Traditional Chinese translation (e.g., '將檔案附加到訊息') to maintain consistency with the localized content.

Suggested change
"attachFiles": "Attach files to message",
"attachFiles": "將檔案附加到訊息",

"selectApiConfig": "Seleccioneu la configuració de l'API",
"enhancePrompt": "Millora la sol·licitud amb context addicional",
"addImages": "Afegeix imatges al missatge",
"attachFiles": "Attach files to message",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that the new key "attachFiles" still uses an English phrase ('Attach files to message') in a Catalan locale file. Please update it to a Catalan translation.

Suggested change
"attachFiles": "Attach files to message",
"attachFiles": "Adjunta fitxers al missatge",

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

"selectApiConfig": "API-Konfiguration auswählen",
"enhancePrompt": "Prompt mit zusätzlichem Kontext verbessern",
"addImages": "Bilder zur Nachricht hinzufügen",
"attachFiles": "Attach files to message",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typographical Note: The value for the key "attachFiles" is in English, which is inconsistent with the rest of the German locale file. Consider providing the correct German translation, e.g., "Dateien zur Nachricht anhängen".

Suggested change
"attachFiles": "Attach files to message",
"attachFiles": "Dateien zur Nachricht anhängen",

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

"selectApiConfig": "Sélectionner la configuration de l'API",
"enhancePrompt": "Améliorer la requête avec un contexte supplémentaire",
"addImages": "Ajouter des images au message",
"attachFiles": "Attach files to message",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new key 'attachFiles' has an English string in a French localization file. Consider translating it to French (e.g. "Joindre des fichiers au message") for consistency.

Suggested change
"attachFiles": "Attach files to message",
"attachFiles": "Joindre des fichiers au message",

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

"description": "Gespecialiseerde persona's die het gedrag van Roo aanpassen."
},
"addImages": "Afbeeldingen toevoegen aan bericht",
"attachFiles": "Attach files to message",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The translation for 'attachFiles' is still in English ('Attach files to message') while the rest of the file is in Dutch. Please verify if this is intentional or if it should be translated (e.g., "Bestanden toevoegen aan bericht").

Suggested change
"attachFiles": "Attach files to message",
"attachFiles": "Bestanden toevoegen aan bericht",

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

"selectApiConfig": "Wybierz konfigurację API",
"enhancePrompt": "Ulepsz podpowiedź dodatkowym kontekstem",
"addImages": "Dodaj obrazy do wiadomości",
"attachFiles": "Attach files to message",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new entry, "Attach files to message," appears in English in a Polish locale file. This seems out of place given the other translations. Please consider providing the appropriate Polish translation (e.g., "Załącz pliki do wiadomości").

Suggested change
"attachFiles": "Attach files to message",
"attachFiles": "Załącz pliki do wiadomości",

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

"selectApiConfig": "Selecionar configuração da API",
"enhancePrompt": "Aprimorar prompt com contexto adicional",
"addImages": "Adicionar imagens à mensagem",
"attachFiles": "Attach files to message",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typographical note: The value for attachFiles is in English ('Attach files to message') while the rest of the translations are in Portuguese. Consider translating it (e.g., 'Anexar arquivos à mensagem') for language consistency.

Suggested change
"attachFiles": "Attach files to message",
"attachFiles": "Anexar arquivos à mensagem",

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

"selectApiConfig": "API yapılandırmasını seçin",
"enhancePrompt": "Ek bağlamla istemi geliştir",
"addImages": "Mesaja resim ekle",
"attachFiles": "Attach files to message",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new translation for "attachFiles" is in English. Considering this file is for Turkish locales, please provide a Turkish translation for consistency (e.g., "Mesaja dosya ekle").

Suggested change
"attachFiles": "Attach files to message",
"attachFiles": "Mesaja dosya ekle",

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 18, 2025
@daniel-lxs
Copy link
Member

Closing, see #5570 (comment)

@daniel-lxs daniel-lxs closed this Jul 19, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 19, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Replace image-only attachment with general file attachment support using paperclip icon

4 participants