Skip to content

Commit

Permalink
Reintroduce copy button for AI text output (#615)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigadsoleiman authored Dec 5, 2024
1 parent 4cd3cda commit b9ba6e3
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import {
Container,
Spinner,
TextContent,
Button,
Popover,
StatusIndicator,
} from "@cloudscape-design/components";
import { useContext, useEffect, useState, useCallback } from "react";
import ReactMarkdown from "react-markdown";
Expand Down Expand Up @@ -212,6 +215,30 @@ export default function ChatMessage(props: ChatMessageProps) {
)
}
>
{props.message.content.length > 0 && (
<div className={styles.btn_chabot_message_copy}>
<Popover
data-locator="copy-clipboard"
size="medium"
position="top"
triggerType="custom"
dismissButton={false}
content={
<StatusIndicator type="success">
Copied to clipboard
</StatusIndicator>
}
>
<Button
variant="inline-icon"
iconName="copy"
onClick={() => {
navigator.clipboard.writeText(props.message.content);
}}
/>
</Popover>
</div>
)}
{loading ||
(content.length === 0 && !processingAsyncFiles && !files.length) ? (
<Box>
Expand Down

0 comments on commit b9ba6e3

Please sign in to comment.