Skip to content

[FEATURE] Export single or selected messages (#357)#360

Merged
imDarshanGK merged 4 commits into
imDarshanGK:mainfrom
adikulkarni006:feature/export-selected-messages
Jun 11, 2026
Merged

[FEATURE] Export single or selected messages (#357)#360
imDarshanGK merged 4 commits into
imDarshanGK:mainfrom
adikulkarni006:feature/export-selected-messages

Conversation

@adikulkarni006

Copy link
Copy Markdown
Collaborator

Closes #357 – Export single or selected messages (not entire session)

🎯 Problem

Currently, the export feature exports the entire chat session. Users often want to share or save only one specific message or a Q&A pair (e.g., a helpful assistant response). This PR solves that.

🚀 Solution Implemented

Backend

  • New POST /api/export/messages endpoint in backend/routes/export.py
  • Accepts { message_ids: string[], format: "markdown"|"json"|"txt" }
  • Fetches messages via db_service.get_messages_by_ids()
  • Reuses existing Markdown/JSON/TXT formatters for consistency
  • Returns downloadable file with proper headers

Frontend

  • Checkbox per message – select any combination of messages
  • Export selection bar – appears when ≥1 message selected
    • Format dropdown (Markdown / JSON / TXT)
    • "Export Selected" button
    • "Clear" button to deselect all
  • Per‑message export button (↓) – one‑click export of a single message
  • Works alongside existing session‑level export buttons

🧪 Testing Performed

Test Status
Select 1 message → export as MD/JSON/TXT
Select multiple messages (user + assistant) → export
Per‑message ↓ button → downloads single message
Empty selection → export bar hidden
Clear button → deselects all
Existing session export untouched
Backend error handling (invalid IDs)

📁 Files Changed

File Change
frontend/src/components/ChatWindow.jsx + checkboxes, selection state, export bar, per‑message button
backend/routes/export.py + POST /messages endpoint
backend/services/db_service.py + get_messages_by_ids() helper

🔥 Why Merge?

  • User‑requested feature – no workaround without this PR
  • Clean UI – matches existing design system (Tailwind + shadcn-like styling)
  • Reuses existing code – same formatters as session export
  • Fully backward compatible – session export still works exactly as before
  • No external dependencies – pure addition, no breaking changes

🖼️ Screenshots / Demo

(Optional: attach a screenshot or screen recording showing checkboxes + export bar)


Ready for review – please merge.

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

@adikulkarni006 is attempting to deploy a commit to the Darshan's projects Team on Vercel.

A member of the Team first needs to authorize it.

@imDarshanGK

Copy link
Copy Markdown
Owner

@adikulkarni006 CI failing

@adikulkarni006

Copy link
Copy Markdown
Collaborator Author

Wait , i do right @imDarshanGK

@adikulkarni006

Copy link
Copy Markdown
Collaborator Author

@imDarshanGK All CI checks are green (Vercel failure is just authorization – not a blocker). Please review and approve so this can be merged. Thanks!

@adikulkarni006 adikulkarni006 added SSoC26 Part of Social Summer of Code 2026 python labels Jun 9, 2026
@adikulkarni006

Copy link
Copy Markdown
Collaborator Author

@imDarshanGK Conflicts resolved, CI is green. Please merge when ready. Thanks!

@imDarshanGK

Copy link
Copy Markdown
Owner

@adikulkarni006 resolve conflicts

@adikulkarni006 adikulkarni006 force-pushed the feature/export-selected-messages branch from cdff0cc to 913384d Compare June 10, 2026 17:42
@adikulkarni006 adikulkarni006 added the Hard Larger or more advanced changes label Jun 10, 2026
@imDarshanGK imDarshanGK added Medium Feature or backend work with moderate scope and removed Hard Larger or more advanced changes labels Jun 11, 2026
@imDarshanGK imDarshanGK merged commit d9c1dde into imDarshanGK:main Jun 11, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Medium Feature or backend work with moderate scope SSoC26 Part of Social Summer of Code 2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Export a single message or selected range of messages (not entire session)

2 participants