Repository navigation
FEAT GUI: Import dataset prompts and conversations into chat (#2751) - #3670
Roman Lutz (romanlutz) merged 8 commits into
Conversation
|
I tried this on head Shouldn't the stored template text appear in the editable input box after this action? I would expect the import to populate it without sending anything. Am I missing a required step here? I have not confirmed the cause of this particular failure. |
… import - Group conversation turns by sequence rather than prompt_group_id (microsoft#3670) - Populate composer with template prompt and avoid collision with clean preserved drafts - Add ConfirmDialog before navigation when destination has an unsent dirty draft - Prepend imported turns to existing history when importing into current conversation - Associate editor with viewed conversation ID to prevent lifecycle discard - Start imported turns as unsaved changes to protect against accidental dismissal - Round-trip editor target and temperature in conversation edit state - Create explicit conversation before navigating for new_conversation destination - Add comprehensive integration tests covering template import from clean chat
…nd target validation - Preserve destination existing messages first and append imported history after them in current_conversation - Handle history loading errors gracefully without consuming pending import - Cover dirty-draft protection and replace confirmation across new_attack, current_conversation, and new_conversation - Track unsaved imported state explicitly in useConversationDraft lifecycle - Validate and report missing conversation targets against registry without silent fallback - Add comprehensive user journey tests for all import flows and edge cases
…and editor lifecycle
|
I have addressed all the feedback and resolved the root cause of the empty input box shown in your screenshot. The changes are organized across the following 3 commits: Commit Breakdown & Issues Addressed1.
|
…uard async history import - Carry imported final user turn explicitly as pendingComposerDraft through editor lifecycle (Model B) and restore to visible composer after Save without duplication or loss - Retain destination attack's actual persisted objective as initialObjective while setting imported objective, emitting expected_objective on same-attack Save - Guard async history-loading continuation against stale closures, superseded imports, destination changes, and user edits/attachment replacements - Preserve pendingComposerDraft across navigation in activeDraft.conversation and clear on discard - Track semantic attachment signature in composer revision to detect same-count file replacements - Scope blockNavigation override to unsaved imports so normal dirty conversation editors retain discard confirmation - Ensure unmount-discard flag is one-shot and reset across composer inputs and inline editor exits
|
Thanks for the thoughtful and detailed review comments. I have addressed all three items along with the related draft lifecycle edge cases in commit 1. Final User Turn Loss During Import → Save (Discussion #4452245053)
2. Objective Baseline & Save Payload (Discussion #4452245058)
3. Guarding Async History Loading Continuation (Discussion #4452245064)
4. Lifecycle & Navigation Polish
Verification
|
There was a problem hiding this comment.
🟡 Changes recommended
Imports can silently save to a different conversation than selected, and stale asynchronous completions can clear drafts, stage outdated content, and navigate to an obsolete destination.
9 open issues
Save imports to the selected conversation · New Ignore stale conversation-creation completions · New Preserve explicitly cleared editor targets · New Keep the final user turn editable before saving · New Resolve conflicting destination setup before saving · New Preserve destination setup when replacing imported content · New Preserve objectives on single-prompt imports · New Preserve media previews across dataset navigation · New Reject multi-turn examples with missing roles · New
What changed in this PR
Adds dataset-to-chat imports using the existing composer, conversation editor, and draft handoff. The changes support selecting a destination and preparing stored prompts or conversations without automatically sending them to a model.
Changes:
- Transforms stored seed records into composer content or ordered conversation drafts.
- Adds import destination controls and extends draft preservation across navigation.
- Expands import tests and documents the GUI workflow.
| File | Description |
|---|---|
frontend/src/utils/seedImport.ts |
Transforms seed records into import drafts. |
frontend/src/utils/seedImport.test.ts |
Tests grouping, roles, and final-user-turn splitting. |
frontend/src/utils/routeParams.ts |
Parses chat destination identifiers. |
frontend/src/utils/messageMapper.ts |
Handles missing attachment MIME types. |
frontend/src/utils/chatDraft.ts |
Adds conversation-aware draft checks and content signatures. |
frontend/src/types/index.ts |
Extends import, editor, and save contracts. |
frontend/src/hooks/useConversationDraft.ts |
Tracks unsaved imports and pending composer content. |
frontend/src/hooks/useChatDraftHandoff.tsx |
Extends attachment handling for conversation handoffs. |
frontend/src/hooks/useChatDraftHandoff.test.tsx |
Tests conversation draft detection. |
frontend/src/components/Datasets/SeedExampleDetail.tsx |
Adds import menu and error display. |
frontend/src/components/Datasets/SeedExampleDetail.test.tsx |
Tests import actions and unavailable destinations. |
frontend/src/components/Datasets/SeedExampleBrowser.tsx |
Coordinates confirmation, staging, and destination navigation. |
frontend/src/components/Datasets/DatasetSelection.tsx |
Passes active chat context to the browser. |
frontend/src/components/Chat/ConversationEditor.tsx |
Adds discard callbacks and navigation-blocking control. |
frontend/src/components/Chat/ConversationEditor.test.tsx |
Tests protection of untouched imported drafts. |
frontend/src/components/Chat/ChatWindow.tsx |
Consumes imports and preserves conversation-editor state. |
frontend/src/App.tsx |
Supplies the last chat destination to Datasets. |
frontend/src/App.drafts.test.tsx |
Adds import, navigation, save, and stale-request coverage. |
doc/gui/0_gui.md |
Documents import shapes, destinations, and no-send behavior. |
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep imported turns visible until save, reuse unsent destinations safely, reconcile setup explicitly, guard stale requests, and preserve draft media. Fix canonical chat navigation and StrictMode handoff replay. Add integration and real-backend browser regressions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>



Description
Closes #2751. Implements work item 7 of 17 in #2744: importing stored dataset prompts, multimodal messages, and multi-turn conversations into Chat without manual copy-pasting, reattaching media, or issuing extra model calls.
Key Changes
666817b276a68eb0cf4ebe32a67ce01b51d3cb43, preserving its media/setup changes. Uses the canonical/attack/chatroute. Prevents StrictMode effect replay from restoring an empty pre-import snapshot over the imported template.doc/gui/0_gui.mdwith editable-turn behavior, destination restrictions, setup conflict choices, preserved pipelines, and no-send guarantees.No backend API or database schema changes are introduced by these repairs.
Tests and Documentation
Regression coverage includes import-to-Save-to-composer text/media, destination reuse and source-piece IDs, objective save payloads, stale requests, setup reconciliation, null targets, uploaded history URL cleanup, ambiguous roles, direct-Datasets entry, and StrictMode replay.
Commands run from
frontendunless otherwise noted:npm test -- --runInBand --silent --runTestsByPath src/App.drafts.test.tsx src/components/Datasets/SeedExampleBrowser.test.tsx src/hooks/useConversationDraft.test.ts src/hooks/useChatDraftHandoff.test.tsx src/utils/seedImport.test.ts src/components/Chat/ConversationEditor.test.tsxnpm test -- --runInBand --silent --runTestsByPath src/components/Chat/ChatWindow.test.tsx src/hooks/useConversationSave.test.ts src/utils/conversationDraft.test.ts src/components/Chat/ChatInputArea.test.tsxnpm run lintnpx tsc --noEmitnpm run buildnpx playwright test e2e/datasets.seeded.spec.ts --project seeded --reporter=listThe production browser run used the following PowerShell environment, set from the repository root before entering
frontend:Also checked the real development app on desktop and mobile, including replacement confirmation with retained system setup. Importing and editing caused no attack POSTs or model calls. The screenshots and recording below use a real isolated backend with the offline browser configuration, not mocked API responses.
Validation limits: the complete frontend and Python suites were not rerun, and no new whole-project coverage-percentage claim is made. The previous description's full-suite result is not presented as validation of these repairs. Documentation changes are prose-only; JupyText was not run.
Screenshots
Fresh captures show the repaired import behavior in
a9360f28de5c28d40a99813a679e3a00811428d3. They replace the earlier empty-composer evidence in this description. The original observation remains in the review conversation for context.Dataset example and import destinations
The stored
wikipedia with titleexample exposes Import into Chat. Without a saved attack, only Import to new attack is available.Imported template visible in the desktop input box
The selected template appears in the editable prompt box immediately, without sending it.
Imported template on mobile
Import and edit recording
Real Datasets-to-Chat import and editing journey, with no automatic send.
fixed-dataset-import.webm