Skip to content

Issue #18 - [FEATURE] Add Export Sessions to JSON #25

@codepath-open-source-ci

Description

@codepath-open-source-ci

Current Behavior

Sessions are stored in electron-store and are only accessible within the application. There is no functionality to export sessions to external files.

Reproduction Steps:

  1. Launch the Chatbox application
  2. Create several chat sessions with message history
  3. Look in the session list sidebar for export options
  4. Right-click or open the menu for a session (the three-dot menu)
  5. Observe: No "Export" or "Save" option exists

Expected Behavior

Users should be able to export individual sessions to JSON files through the session context menu. The export should open a native file save dialog and create a well-formatted, human-readable JSON file containing all session data.

Acceptance Criteria:

  • An "Export" option is added to the session context menu (three-dot menu) for individual sessions
  • Clicking Export opens a native save file dialog with a suggested filename (e.g., "session-name.json")
  • The save dialog defaults to an appropriate location (e.g., user's Documents or Downloads folder)
  • The exported JSON file is properly formatted with indentation for readability
  • The exported JSON includes all session data: id, name, and all messages
  • Each message in the export includes: id, role, and content fields
  • The export uses Electron's dialog API and IPC for file operations
  • A success notification appears after successful export (using the existing toast system)
  • Appropriate error handling if the save operation fails

Steps To Test

  1. Start the application and create a test chat session with at least 5 messages
  2. Include different message types: user messages, assistant responses, and optionally a system message
  3. Name the session "Test Export Session"
  4. Right-click or open the three-dot menu for this session
  5. Verify an "Export" option is present in the menu
  6. Click Export and verify a native save file dialog appears
  7. Verify the suggested filename is based on the session name
  8. Save the session to your desktop as "test-session.json"
  9. Verify a success notification appears (e.g., "Session exported successfully")
  10. Open the JSON file in a text editor and verify it contains:
    • The session ID and name at the top level
    • A messages array with all messages from the session
    • Each message has id, role, and content fields
    • The JSON is properly formatted with indentation (not minified)

Submission

Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below.

Guide to submitting pull requests: https://hackmd.io/@timothy1ee/Hky8kV3hlx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions