FEAT: Add conversation export button to the GUI chat view#2259
Open
varunj-msft wants to merge 1 commit into
Open
FEAT: Add conversation export button to the GUI chat view#2259varunj-msft wants to merge 1 commit into
varunj-msft wants to merge 1 commit into
Conversation
Add an Export control to the CoPyRIT chat ribbon that downloads the currently displayed conversation as Markdown or JSON. The file is serialized client-side from the in-view messages (WYSIWYG), including the system prompt shown in the banner; no conversation data is sent to the server. - conversationExport.ts: pure Markdown/JSON serializers, filename builder, and Blob-based download helper - ChatWindow.tsx: Export menu button (Markdown / JSON) enabled only for a viewable, settled conversation - Unit tests plus a real-browser Playwright E2E; GUI docs updated
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a frontend-only “Export conversation” control to the CoPyRIT chat ribbon, enabling users to download the currently displayed conversation as Markdown (readable transcript) or JSON (structured data) entirely client-side.
Changes:
- Added a new
conversationExport.tsutility to serialize conversations (Markdown/JSON), build safe filenames, and trigger Blob-based downloads. - Integrated an Export menu into
ChatWindowwith gating logic so export is only enabled for a stable, viewable conversation. - Added unit tests (serializer + UI) and Playwright E2E coverage for real downloads; updated GUI documentation.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/utils/conversationExport.ts | New export/serialization and download helper utilities for Markdown/JSON exports. |
| frontend/src/utils/conversationExport.test.ts | Unit tests covering serialization, filename building, and download helper behavior. |
| frontend/src/components/Chat/ChatWindow.tsx | Adds export menu button to the ribbon and enables/disables it based on conversation state. |
| frontend/src/components/Chat/ChatWindow.test.tsx | Integration tests for export gating and menu-driven export behavior. |
| frontend/e2e/chat.spec.ts | Playwright tests validating actual downloaded bytes for Markdown and JSON exports. |
| doc/gui/0_gui.md | Documents the new Export button and its behavior/security note. |
Comment on lines
+22
to
+26
| /** | ||
| * Serialize, name, and download the currently viewed conversation in one call. | ||
| * Markdown and JSON share a single timestamp so the filename and the document | ||
| * body agree. | ||
| */ |
Comment on lines
+189
to
+201
| function longestBacktickRun(content: string): number { | ||
| const runs = content.match(/`+/g) | ||
| if (!runs) { | ||
| return 0 | ||
| } | ||
| let longest = 0 | ||
| for (const run of runs) { | ||
| if (run.length > longest) { | ||
| longest = run.length | ||
| } | ||
| } | ||
| return longest | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an Export control to the CoPyRIT chat ribbon that downloads the currently
displayed conversation as Markdown or JSON. Serialization is fully
client-side (from the in-view messages) — no backend changes and no
conversation data leaves the browser.
conversationExport.ts(new): pure Markdown/JSON serializers, timestampedfilename builder, and a Blob-based download helper. Hardened for safety —
dynamically-sized code fences, sanitized filenames, strips non-serializable
Filehandles and in-flight loading placeholders, and revokes the object URL.ChatWindow.tsx: Export menu button (Markdown / JSON) enabled only when aviewable, settled conversation is shown; exports the displayed branch. Uses a
Fluent
Tooltiplabel to match the sibling ribbon buttons.Frontend-only; no Python/API changes.
Tests and Documentation
Tests
(
conversationExport.test.ts).ChatWindowexport menu (gating, format selection,Markdown/JSON output).
actual downloaded Markdown/JSON bytes (
chat.spec.ts).Documentation
doc/gui/0_gui.mdto document the export button and itsbehavior (including the system prompt shown in the banner).
needed.