Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
feat(web): support paste-to-attach images and files in chat input (#52)
Jacky7c0a40ca028d
diff --git a/src/web/src/components/agent-chat/agent-chat-view.tsx b/src/web/src/components/agent-chat/agent-chat-view.tsxindex 4f1fefa74..c8c25c72e 100644--- a/src/web/src/components/agent-chat/agent-chat-view.tsx+++ b/src/web/src/components/agent-chat/agent-chat-view.tsx@@ -889,6 +889,37 @@ export function AgentChatView() {}}, []);+ const handlePaste = useCallback((e: React.ClipboardEvent) => {+ const items = e.clipboardData?.items;+ if (!items) return;++ const files: File[] = [];+ for (let i = 0; i < items.length; i++) {+ const item = items[i];+ if (item.kind === "file") {+ const file = item.getAsFile();+ if (file) files.push(file);+ }+ }++ if (files.length === 0) return;++ // Prevent default only when we have files to handle+ e.preventDefault();++ const valid: File[] = [];+ for (const file of files) {+ if (file.size > MAX_FILE_SIZE) {+ toast.error(`"${file.name}" exceeds 10 MB limit`);+ } else {+ valid.push(file);+ }+ }+ if (valid.length > 0) {+ setPendingFiles((prev) => [...prev, ...valid]);+ }+ }, []);+const handleStop = async () => {if (!conversation || cancelling) return;setCancelling(true);@@ -1367,6 +1398,7 @@ export function AgentChatView() {});}}onKeyDown={handleKeyDown}+ onPaste={handlePaste}onKeyUp={(e) => setCaretIndex((e.target as HTMLTextAreaElement).selectionStart)}onClick={(e) => setCaretIndex((e.target as HTMLTextAreaElement).selectionStart)}onSelect={(e) => setCaretIndex((e.target as HTMLTextAreaElement).selectionStart)}