diff --git a/apps/web/src/components/v2/manager-chat.tsx b/apps/web/src/components/v2/manager-chat.tsx new file mode 100644 index 00000000..51c94d8e --- /dev/null +++ b/apps/web/src/components/v2/manager-chat.tsx @@ -0,0 +1,157 @@ +import { ScrollToBottom, StickyToBottomContent } from "@/utils/scroll-utils"; +import { Message } from "@langchain/langgraph-sdk"; +import { getMessageContentString } from "@open-swe/shared/messages"; +import { useState } from "react"; +import { StickToBottom } from "use-stick-to-bottom"; +import { TooltipIconButton } from "../ui/tooltip-icon-button"; +import { AnimatePresence, motion } from "framer-motion"; +import { Bot, Copy, CopyCheck, Send, User } from "lucide-react"; +import { Textarea } from "../ui/textarea"; +import { Button } from "../ui/button"; + +function MessageCopyButton({ content }: { content: string }) { + const [copied, setCopied] = useState(false); + + const handleCopy = (e: React.MouseEvent) => { + e.stopPropagation(); + navigator.clipboard.writeText(content); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + }; + + return ( + handleCopy(e)} + variant="ghost" + tooltip="Copy content" + className="size-6 p-1" + > + + {copied ? ( + + + + ) : ( + + + + )} + + + ); +} + +interface ManagerChatProps { + messages: Message[]; + chatInput: string; + setChatInput: (input: string) => void; + handleSendMessage: () => void; +} + +export function ManagerChat({ + messages, + chatInput, + setChatInput, + handleSendMessage, +}: ManagerChatProps) { + return ( +
+
+ + + {messages.map((message) => ( +
+
+ {message.type === "human" ? ( +
+ +
+ ) : ( +
+ +
+ )} +
+
+
+ + {message.type === "human" ? "You" : "Agent"} + +
+
+ {getMessageContentString(message.content)} +
+
+ +
+
+
+ ))} + + } + footer={ +
+ +
+ } + /> +
+
+ +
+
+