Skip to content

Add export chat history as JSON/Markdown #6

Description

@cheapestinference

Description

There is currently no way to export or download a chat session's history from the dashboard. Users who want to save conversations, share them, or analyze them offline have no built-in option to do so.

This issue is about adding an "Export" or "Download" button to the session/chat view that allows users to download the conversation in JSON format (raw structured data) and/or Markdown format (human-readable).

Where to look

  • src/components/views/ChatView.tsx — The main chat view component. This is where the export button should be placed, likely in the header area or as a toolbar action. The chat messages are available as chatMessages (array of ChatMessage objects).
  • src/components/views/SessionDetailView.tsx — The session detail wrapper that renders ChatView. An export button could alternatively be placed in this component's header/toolbar area.
  • src/types/openclaw.ts — Defines the ChatMessage interface (line ~286) with fields like role, content, timestamp, model, runId, etc. This is the data structure you will be serializing.
  • src/lib/utils.ts — Good place to add export helper functions (e.g., exportAsJSON(), exportAsMarkdown()).
  • src/lib/browser-utils.ts — May already contain browser-related utilities; file download logic could go here.

Acceptance criteria

  • A download/export button is visible in the session or chat view (icon button or dropdown with format options)
  • Users can export the chat history as JSON (preserving all message metadata: role, content, timestamp, model) and as Markdown (formatted with ## User / ## Assistant headers and readable content)
  • The exported file is named descriptively (e.g., chat-{agentName}-{sessionKey}-{date}.json) and triggers a browser file download

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions