The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(dashboard): move the copy-last button into a chat-copy-last-button sibling
Austin Pickett5e836abd90d4
diff --git a/web/src/lib/chat-copy-last-button.tsx b/web/src/lib/chat-copy-last-button.tsxnew file mode 100644index 00000000000..3c9b7163f3e--- /dev/null+++ b/web/src/lib/chat-copy-last-button.tsx@@ -0,0 +1,44 @@+import { Button } from "@nous-research/ui/ui/components/button";+import { Copy } from "lucide-react";+import { cn } from "@/lib/utils";++/**+ * Floating "copy last response" overlay on the chat terminal: sends `/copy` over+ * the PTY (see chat-copy-last.ts) and shows "copied" for the 1.5s reset window.+ */+export function CopyLastButton({+ onClick,+ copied,+ color,+}: {+ onClick: () => void;+ copied: boolean;+ color: string;+}) {+ return (+ <Button+ ghost+ onClick={onClick}+ title="Copy last assistant response as raw markdown"+ aria-label="Copy last assistant response"+ className={cn(+ "absolute z-10",+ "normal-case tracking-normal font-normal",+ "rounded border border-current/30",+ "bg-black/20",+ "opacity-70 hover:opacity-100 hover:border-current/60",+ "transition-opacity duration-150",+ "bottom-2 right-2 px-2 py-1 text-xs sm:bottom-3 sm:right-3 sm:px-2.5 sm:py-1.5",+ "lg:bottom-4 lg:right-4",+ )}+ style={{ color }}+ >+ <span className="inline-flex items-center gap-1.5">+ <Copy className="h-3 w-3 shrink-0" />+ <span className="hidden min-[400px]:inline tracking-wide">+ {copied ? "copied" : "copy last response"}+ </span>+ </span>+ </Button>+ );+}diff --git a/web/src/pages/ChatPage.tsx b/web/src/pages/ChatPage.tsxindex 7a0f69c6b49..328b99ba38b 100644--- a/web/src/pages/ChatPage.tsx+++ b/web/src/pages/ChatPage.tsx@@ -25,7 +25,7 @@ import "@xterm/xterm/css/xterm.css";import { Button } from "@nous-research/ui/ui/components/button";import { Typography } from "@nous-research/ui/ui/components/typography/index";import { cn } from "@/lib/utils";-import { Copy, PanelRight, RotateCcw, X } from "lucide-react";+import { PanelRight, RotateCcw, X } from "lucide-react";import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";import { createPortal } from "react-dom";import { useNavigate, useSearchParams } from "react-router";@@ -97,6 +97,7 @@ import {} from "@/lib/terminal-font-refit";import { generateChannelId } from "@/lib/chat-channel-id";import { sendCopyLastCommand } from "@/lib/chat-copy-last";+import { CopyLastButton } from "@/lib/chat-copy-last-button";import {probeWebglSupport,shouldUseWebglRenderer,@@ -1984,30 +1985,11 @@ export default function ChatPage({ isActive = true }: { isActive?: boolean }) {</div>)}- <Button- ghost+ <CopyLastButtononClick={handleCopyLast}- title="Copy last assistant response as raw markdown"- aria-label="Copy last assistant response"- className={cn(- "absolute z-10",- "normal-case tracking-normal font-normal",- "rounded border border-current/30",- "bg-black/20",- "opacity-70 hover:opacity-100 hover:border-current/60",- "transition-opacity duration-150",- "bottom-2 right-2 px-2 py-1 text-xs sm:bottom-3 sm:right-3 sm:px-2.5 sm:py-1.5",- "lg:bottom-4 lg:right-4",- )}- style={{ color: terminalFg }}- >- <span className="inline-flex items-center gap-1.5">- <Copy className="h-3 w-3 shrink-0" />- <span className="hidden min-[400px]:inline tracking-wide">- {copyState === "copied" ? "copied" : "copy last response"}- </span>- </span>- </Button>+ copied={copyState === "copied"}+ color={terminalFg}+ />{chatPanelCollapsed && (<Button