-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Summary
Users should be able to export the full chat conversation as a Markdown (.md) file or a PDF directly from the chat UI — no backend changes needed.
Current Behavior
The Navbar has a Share button for sending conversations via email or public link. There is no option to download or export the conversation locally.
Expected Behavior
A dropdown export button in the Navbar (next to the Share button) with two options:
- Export as Markdown — downloads a
.mdfile with all messages formatted cleanly. - Export as PDF — triggers the browser's native print/save-as-PDF dialog with a readable layout.
Where to Look
Primary file: app/(main)/chat/[chatId]/components/Navbar.tsx
- The Share button lives around line 334. Add the export dropdown in the same button group.
- The
conversationIdis already derivable fromusePathname()— same pattern used on line 69. - The chat title is available in the
displayTitlestate (line 63) — use it for the filename.
Fetching messages: services/ChatService.ts
ChatService.loadMessages(conversationId, start, limit)(line 569) fetches existing conversation messages. Use this to retrieve the full conversation before exporting.
UI component: components/ui/dropdown-menu.tsx is already available for the dropdown.
For Markdown — format the messages into text, create a Blob, and trigger a download via a temporary anchor element.
For PDF — no external library needed. Build a styled HTML representation of the conversation and use the browser's built-in print functionality.
Files to Change
| File | What changes |
|---|---|
app/(main)/chat/[chatId]/components/Navbar.tsx |
Add export dropdown button and the two export handler functions |
No backend changes. No new npm dependencies.