Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

feat: add copy functionality to system message component

Salman-Ahamede11d2b0cd9e6
diff --git a/packages/app/src/react/features/ai-chat/components/chat/message/system.tsx b/packages/app/src/react/features/ai-chat/components/chat/message/system.tsx
index f288d0bd..ddb1773d 100644
--- a/packages/app/src/react/features/ai-chat/components/chat/message/system.tsx
+++ b/packages/app/src/react/features/ai-chat/components/chat/message/system.tsx
@@ -1,4 +1,6 @@
-import { FC, useEffect } from 'react';
+import { FC, useEffect, useState } from 'react';
+import { FaCheck } from 'react-icons/fa';
+import { FaRegCopy } from 'react-icons/fa6';
import { MarkdownRenderer } from '@react/features/ai-chat/components';
import { TMessageProps } from '@react/features/ai-chat/types';
@@ -7,16 +9,36 @@ type TProps = TMessageProps & { onUpdate?: () => void };
export const System: FC<TProps> = (props) => {
const { message, onUpdate } = props || {};
+ const [isCopied, setIsCopied] = useState(false);
useEffect(() => {
onUpdate?.();
}, [message, onUpdate]);
+ const handleCopy = async () => {
+ if (!message) return;
+ try {
+ await navigator.clipboard.writeText(message);
+ setIsCopied(true);
+ setTimeout(() => setIsCopied(false), 2000);
+ } catch {
+ // Silently fail - user can retry
+ }
+ };
+
if (!message) return null;
return (
- <div className="system-message-bubble relative chat-rich-text-response rounded-lg px-3 text-[#141414]">
+ <div className="system-message-bubble relative chat-rich-text-response rounded-lg px-3 text-[#141414] group">
<MarkdownRenderer message={message} />
+ <button
+ onClick={handleCopy}
+ className="absolute -bottom-5 left-2 p-1.5 rounded-md text-slate-400 opacity-0 group-hover:opacity-100 transition-opacity"
+ title={isCopied ? 'Copied!' : 'Copy response'}
+ aria-label={isCopied ? 'Copied!' : 'Copy response'}
+ >
+ {isCopied ? <FaCheck className="size-4" /> : <FaRegCopy className="size-4" />}
+ </button>
</div>
);
};