feat(webui): add file attachment support to WebSocket channel#3361
Open
dividduang wants to merge 1 commit intoHKUDS:mainfrom
Open
feat(webui): add file attachment support to WebSocket channel#3361dividduang wants to merge 1 commit intoHKUDS:mainfrom
dividduang wants to merge 1 commit intoHKUDS:mainfrom
Conversation
Users can now attach files to messages in the webui composer. Files are encoded as base64 data URLs in the WebSocket message envelope, decoded and saved server-side by the WebSocket channel, then passed to the agent loop as media paths. Backend: - Add _save_media_data_urls() to WebSocketChannel for base64 → disk - Extend _dispatch_envelope to handle optional "media" field - Enforce per-file (10MB), per-message (25MB), and count (20) limits Frontend: - Add paperclip attachment button to ThreadComposer - Read files as base64 data URLs, show preview badges with remove - Pass media through useNanobotStream → NanobotClient → WS - Support attachments in both thread and hero (welcome) composer modes - Add i18n keys for attach/remove in en and zh-CN Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
b870e29 to
c2cd63c
Compare
Collaborator
|
Thanks for the PR ;) Marked. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Backend (
nanobot/channels/websocket.py):_save_media_data_urls()static method: base64 data URLs → on-disk files_dispatch_envelopeto handle optionalmediafield in message envelopesFrontend (
webui/src/):ThreadComposer.tsx: Add paperclip attachment button, file input, preview badges with removeThreadShell.tsx: Support media in welcome (hero) send flowuseNanobotStream.ts: Pass media through to NanobotClientnanobot-client.ts: Accept optionalmediaparameter insendMessagetypes.ts: Addmedia?: string[]toOutboundmessage typesendMessagesignatureTest plan
🤖 Generated with Claude Code