Skip to content

Export Conversations via Multi Step Modal from Chat Ellipse Menu with Multi Select Support #667

@paullizer

Description

@paullizer

Add an export capability for conversations directly from the Chats experience. Users can export one or multiple conversations through the ellipse menu. A multi step modal wizard guides users through selecting conversations, choosing export format, selecting output packaging, and downloading the final file.

This enables users to archive, share, or externally analyze chat history in JSON or Markdown format with optional file content inclusion.


Problem Statement

Currently there is no native way to export conversations from SimpleChat. Users must rely on manual copy or external tooling, which is inefficient for multi conversation workflows, auditing, or offline analysis.


Proposed Solution

Introduce a multi conversation export workflow triggered from the ellipse menu in Chats.html. Support single conversation export and multi select export via sidebar selection mode. Provide a guided modal wizard to configure export options and generate downloadable files.


User Experience

Entry Points

  • Ellipse menu on each conversation includes Export option for single conversation
  • Sidebar multi select mode enables Export Selected action button

Modal Wizard Steps

Step 1:
List selected conversations
Show title, last updated timestamp, and message count

Step 2:
Select export format

  • JSON
  • Markdown
    Optional checkbox
  • Exclude file content

Step 3:
Select output packaging

  • Single combined file
  • One file per conversation archived as zip

Step 4:
Progress and download

  • Progress indicator
  • Status messages
  • Download button
  • Close button

Admin Configuration

Add new system setting to control export limits.

Setting:
max_export_conversations
Default 25
Range 1 to 100

Exposed in Admin Settings General tab under System Settings.


Backend API

Endpoint:
POST /api/conversations/export

Request:

{
  "conversation_ids": ["id1", "id2", "..."]
}

Validation:

  • Enforce max_export_conversations limit
  • Return validation error if exceeded

Response:

{
  "conversations": [...],
  "messages": {
    "conversation_id": [...]
  }
}

Include full message metadata:

  • thread_info
  • user_info
  • token_usage
  • roles including user, assistant, file, image

Frontend Implementation Plan

Based on proposed Copilot implementation plan.

  1. Add max_export_conversations to functions_settings.py
  2. Add admin UI number input in admin_settings.html
  3. Wire setting in route_frontend_admin_settings.py
  4. Add export modal HTML to chats.html
  5. Bundle JSZip locally under static/js/libs/jszip.min.js
  6. Create static/js/chat/chat-export.js
    • Modal stepper controller
    • Fetch conversation metadata
    • Execute export workflow
    • Generate filenames
  7. Add Export option to ellipse dropdown in chat-sidebar-conversations.js
  8. Add Export Selected button in _sidebar_nav.html and _sidebar_short_nav.html
  9. Add backend export API endpoint

Format Details

JSON

  • Full structured export of conversations and messages

Markdown

  • Conversation headers
  • Messages formatted with role labels
  • Preserve thread relationships via thread_id references

Progress and Error Handling

  • Step 4 shows progress states
    • Fetching conversations
    • Generating files
    • Creating archive
  • Partial failure handling
    • List failed conversation IDs
    • Allow download of successful exports

Plan: Multi-Conversation Export Modal Feature

Add a multi-step export wizard allowing users to export conversations with all messages (including file content), with admin-configurable limit (default 25), local JSZip bundling, and JSON/Markdown format options.

Steps

  1. Add max_export_conversations setting to functions_settings.py

    • Add 'max_export_conversations': 25 to default_settings dict (around line 50, near other limit settings like conversation_history_limit)
    • Setting allows values 1-100, default 25
  2. Add export limit UI to admin_settings.html General tab

    • Add "Conversation Export" card after #system-settings-section in #general tab (around line 1408)
    • Include number input with id max_export_conversations, min=1, max=100, default=25
    • Add descriptive text explaining the limit applies to multi-conversation export
  3. Update route_frontend_admin_settings.py to handle the setting

    • Add default check in GET handler: if 'max_export_conversations' not in settings: settings['max_export_conversations'] = 25
    • Add form extraction in POST handler: max_export_conversations = int(form_data.get('max_export_conversations', 25))
    • Include in new_settings dict construction
  4. Add Export Modal HTML to chats.html

    • Create 4-step wizard modal #export-conversations-modal after existing modals (around line 720)
    • Step 1: List selected conversations (title, last_updated, message count indicator)
    • Step 2: Format selection (JSON/Markdown radios) + "Exclude file content" checkbox
    • Step 3: Output type (Single file / Zip archive with one file per conversation)
    • Step 4: Progress bar, status text, download button, close button
  5. Bundle JSZip locally at static/js/libs/jszip.min.js

    • Download JSZip 3.10.1 from GitHub releases
    • Add <script src="/static/js/libs/jszip.min.js"></script> to chats.html before chat scripts
  6. Create static/js/chat/chat-export.js module

    • Implement ExportModalStepper class with currentStep, selectedIds, format, excludeFileContent, outputType state
    • Step navigation methods: nextStep(), prevStep(), goToStep(), updateStepIndicator()
    • populateStep1(): fetch conversation metadata, display list with titles/dates
    • executeExport(): call API, generate content, handle progress, trigger download
    • Generate filenames as simplechat_export_YYYY-MM-DD_HHmmss.json|md|zip
    • Expose via window.chatExport = { openExportModal, addConversationToExport }
  7. Add "Export" option to ellipse menu in chat-sidebar-conversations.js

    • Add <li><a class="dropdown-item export-btn"><i class="bi bi-download me-2"></i>Export</a></li> to dropdown menu
    • Handle click: open export modal with single conversation pre-selected
    • Add "Export Selected" button #sidebar-export-selected-btn to #conversations-actions div
  8. Update sidebar templates for export button

    • In _sidebar_nav.html add export button in #conversations-actions
    • In _sidebar_short_nav.html add matching export button
  9. Create backend API endpoint POST /api/conversations/export

    • Add route in route_api_conversations.py or appropriate API routes file
    • Accept { conversation_ids: string[] }, validate against max_export_conversations setting
    • Return { conversations: [...], messages: { [conversation_id]: [...] } }
    • Include full message metadata: thread_info, user_info, token_usage, all roles (user, assistant, file, image)

Further Considerations

  1. Format details: JSON exports full structure; Markdown uses headers for conversations with message content formatted as blockquotes/code blocks. Thread relationships preserved via thread_id references.

  2. Progress tracking: Step 4 shows "Fetching conversation X of Y..." then "Generating files..." then "Creating archive..." for zip output.

  3. Error handling: If any conversation fails to fetch, show partial success with list of failed IDs and option to download successful ones.

Sub-issues

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions