Add copy button to assistant messages

This commit is contained in:
2026-04-26 17:30:25 -04:00
parent 8a436c4170
commit 9881dd35df
+33 -5
View File
@@ -60,11 +60,39 @@ export default function MessageList() {
<span style={{ whiteSpace: 'pre-wrap' }}>{m.content}</span>
)}
</div>
{m.sources && m.sources.length > 0 && (
<div className="text-xs mt-1.5 italic" style={{ color: 'var(--text3)' }}>
Sources: {[...new Set(m.sources)].join(', ')}
</div>
)}
<div className="flex items-center gap-2 mt-1.5">
{m.role === 'assistant' && (
<button
onPointerUp={() => {
navigator.clipboard.writeText(m.content);
}}
style={{
background: 'none',
border: 'none',
cursor: 'pointer',
padding: '2px 6px',
borderRadius: '4px',
color: 'var(--text3)',
fontSize: '11px',
display: 'flex',
alignItems: 'center',
gap: '4px',
}}
title="Copy response"
>
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
Copy
</button>
)}
{m.sources && m.sources.length > 0 && (
<div className="text-xs italic" style={{ color: 'var(--text3)' }}>
Sources: {[...new Set(m.sources)].join(', ')}
</div>
)}
</div>
</div>
))}