diff --git a/frontend/components/ChatBox.tsx b/frontend/components/ChatBox.tsx index 15c89fd..bcc7e46 100644 --- a/frontend/components/ChatBox.tsx +++ b/frontend/components/ChatBox.tsx @@ -4,7 +4,7 @@ import { Input } from "@/components/ui/input"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { ScrollArea } from "@/components/ui/scroll-area"; import { MarkdownRenderer } from "@/components/markdown-renderer"; -import { MessageSquare, Send, Bot, User, Loader2 } from "lucide-react"; +import { MessageSquare, Send, Bot, User, Loader2, Copy, Check } from "lucide-react"; interface Message { id: string; @@ -95,6 +95,16 @@ export const ChatBox: React.FC = ({ } }, [startMessage, isInitialLoading]); + const [copiedId, setCopiedId] = useState(null); + + const handleCopy = (id: string, content: string) => { + navigator.clipboard.writeText(content); + setCopiedId(id); + setTimeout(() => { + setCopiedId(null); + }, 1500); + }; + // Helper function to format biomodel IDs as hyperlinks const formatBiomodelIds = (content: string, bmkeys: string[]): string => { if (!bmkeys || bmkeys.length === 0) return content; @@ -266,8 +276,8 @@ export const ChatBox: React.FC = ({ )} -
= ({ {message.content}
) : ( - +
+ +
+ )} + + {/* hover Copy button */} + {message.role === "assistant" && ( + )}