Skip to content
This repository was archived by the owner on Feb 25, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions packages/ui/src/components/message-part.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,6 @@
[data-component="text-part"] {
width: 100%;

[data-slot="text-part-body"] {
position: relative;
margin-top: 32px;
}

[data-slot="text-part-copy-wrapper"] {
position: absolute;
top: -28px;
right: 8px;
opacity: 0;
transition: opacity 0.15s ease;
z-index: 1;
}

[data-slot="text-part-body"]:hover [data-slot="text-part-copy-wrapper"] {
opacity: 1;
}

[data-component="markdown"] {
margin-top: 0;
font-size: var(--font-size-base);
Expand Down
30 changes: 1 addition & 29 deletions packages/ui/src/components/message-part.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -668,42 +668,14 @@ PART_MAPPING["tool"] = function ToolPartDisplay(props) {

PART_MAPPING["text"] = function TextPartDisplay(props) {
const data = useData()
const i18n = useI18n()
const part = props.part as TextPart
const displayText = () => relativizeProjectPaths((part.text ?? "").trim(), data.directory)
const throttledText = createThrottledValue(displayText)
const [copied, setCopied] = createSignal(false)

const handleCopy = async () => {
const content = displayText()
if (!content) return
await navigator.clipboard.writeText(content)
setCopied(true)
setTimeout(() => setCopied(false), 2000)
}

return (
<Show when={throttledText()}>
<div data-component="text-part">
<div data-slot="text-part-body">
<Markdown text={throttledText()} cacheKey={part.id} />
<div data-slot="text-part-copy-wrapper">
<Tooltip
value={copied() ? i18n.t("ui.message.copied") : i18n.t("ui.message.copy")}
placement="top"
gutter={8}
>
<IconButton
icon={copied() ? "check" : "copy"}
size="small"
variant="secondary"
onMouseDown={(e) => e.preventDefault()}
onClick={handleCopy}
aria-label={copied() ? i18n.t("ui.message.copied") : i18n.t("ui.message.copy")}
/>
</Tooltip>
</div>
</div>
<Markdown text={throttledText()} cacheKey={part.id} />
</div>
</Show>
)
Expand Down