From bc589398433839f4538bc0b005ebd37654ab3c49 Mon Sep 17 00:00:00 2001 From: Timothy Carambat Date: Mon, 9 Mar 2026 11:10:17 -0700 Subject: [PATCH] Strip thinking from copy message outputs (#5179) --- frontend/src/hooks/useCopyText.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/hooks/useCopyText.js b/frontend/src/hooks/useCopyText.js index 04519b2e..2f17d6c1 100644 --- a/frontend/src/hooks/useCopyText.js +++ b/frontend/src/hooks/useCopyText.js @@ -1,11 +1,15 @@ +import { THOUGHT_REGEX_COMPLETE } from "@/components/WorkspaceChat/ChatContainer/ChatHistory/ThoughtContainer"; import { useState } from "react"; export default function useCopyText(delay = 2500) { const [copied, setCopied] = useState(false); const copyText = async (content) => { if (!content) return; - navigator?.clipboard?.writeText(content); - setCopied(content); + + // Filter thinking blocks from the content if they exist + const nonThinkingContent = content.replace(THOUGHT_REGEX_COMPLETE, ""); + navigator?.clipboard?.writeText(nonThinkingContent); + setCopied(nonThinkingContent); setTimeout(() => { setCopied(false); }, delay);