Skip to content

Commit cf3635f

Browse files
committed
fix: Full message copy to clipboard not working
1 parent 2421afe commit cf3635f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/client/components/ChatV2/Conversation.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import FormatQuoteIcon from '@mui/icons-material/FormatQuote'
1818
import useLocalStorageState from '../../hooks/useLocalStorageState'
1919
import { BlueButton } from './general/Buttons'
2020
import type { ToolCallResultEvent, ToolCallStatusEvent } from '../../../shared/chat'
21-
import { useMemo } from 'react'
21+
import { useId, useMemo } from 'react'
2222

2323
const UserMessage = ({ content, attachements }: { content: string; attachements?: string }) => (
2424
<Box
@@ -160,9 +160,12 @@ const AssistantMessage = ({
160160
setActiveToolResult(toolResult)
161161
}
162162

163+
const msgId = useId()
164+
163165
return (
164166
<Box
165167
data-testid="assistant-message"
168+
id={msgId}
166169
sx={{
167170
position: 'relative',
168171
pr: 4,
@@ -184,7 +187,7 @@ const AssistantMessage = ({
184187
borderRadius: 4,
185188
}}
186189
>
187-
<CopyToClipboardButton id={`assistant-message`} copied={content} />
190+
<CopyToClipboardButton id={msgId} copied={content} />
188191
</Box>
189192
<ReactMarkdown
190193
remarkPlugins={[remarkGfm, [remarkMath, { singleDollarTextMath: false }]]}

0 commit comments

Comments
 (0)