add copy conversation to clipboard button in settings
This commit is contained in:
@@ -85,6 +85,18 @@ export default function SettingsPanel() {
|
|||||||
a.click();
|
a.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function copyConversation() {
|
||||||
|
const messages = useStore.getState().messages;
|
||||||
|
if (!messages.length) { alert('No messages to copy.'); return; }
|
||||||
|
let md = `# Conversation Export\n\nExported: ${new Date().toLocaleString()}\n\n---\n\n`;
|
||||||
|
messages.forEach(m => {
|
||||||
|
md += `**${m.role === 'user' ? 'You' : 'Aaron AI'}**\n\n${m.content}\n\n`;
|
||||||
|
if (m.sources?.length) md += `*Sources: ${m.sources.join(', ')}*\n\n`;
|
||||||
|
md += '---\n\n';
|
||||||
|
});
|
||||||
|
await navigator.clipboard.writeText(md);
|
||||||
|
}
|
||||||
|
|
||||||
async function logout() {
|
async function logout() {
|
||||||
await auth.logout();
|
await auth.logout();
|
||||||
window.location.href = '/login';
|
window.location.href = '/login';
|
||||||
@@ -218,8 +230,11 @@ export default function SettingsPanel() {
|
|||||||
{status?.conversation_count || 0}
|
{status?.conversation_count || 0}
|
||||||
</span>
|
</span>
|
||||||
</Row>
|
</Row>
|
||||||
<Row label="Export current" desc="Download as markdown">
|
<Row label="Export current" desc="Download or copy as markdown">
|
||||||
|
<div style={{ display: 'flex', gap: '6px' }}>
|
||||||
<SBtn onClick={exportConversation}>Export</SBtn>
|
<SBtn onClick={exportConversation}>Export</SBtn>
|
||||||
|
<SBtn onClick={copyConversation}>Copy</SBtn>
|
||||||
|
</div>
|
||||||
</Row>
|
</Row>
|
||||||
<Row label="Clear all" desc="Permanently delete history">
|
<Row label="Clear all" desc="Permanently delete history">
|
||||||
<SBtn danger onClick={clearAll}>Clear</SBtn>
|
<SBtn danger onClick={clearAll}>Clear</SBtn>
|
||||||
|
|||||||
Reference in New Issue
Block a user