Skip to content

feat: allow users to export all their conversations#438

Merged
chenyme merged 4 commits into
DEEIX-AI:devfrom
fengshao1227:feat/user-export-all
Jul 7, 2026
Merged

feat: allow users to export all their conversations#438
chenyme merged 4 commits into
DEEIX-AI:devfrom
fengshao1227:feat/user-export-all

Conversation

@fengshao1227

Copy link
Copy Markdown
Contributor

Summary

Closes #423

Adds a streaming NDJSON export for the authenticated user's own conversations, mirroring the admin bulk export but scoped to the current user.

Changes

Backend (5 files):

  • GET /api/v1/conversations/export — new user-scoped streaming NDJSON endpoint
  • ListUserConversationsAfterID — cursor-based pagination filtered by user_id
  • ExportUserConversationData — reuses ExportConversationData with ownership check

Frontend (6 files):

  • Download button (⬇) in the All Conversations toolbar
  • exportAllConversations() API function — fetches blob and triggers browser download
  • Full i18n (zh-CN + en-US)

Design

  • Same NDJSON format as admin export (_type: "export_manifest" trailer)
  • User can only export their own conversations (enforced by WHERE user_id = ?)
  • Streaming via cursor pagination (batch size 50) — works for large conversation counts
  • No new dependencies

Test plan

  • Go to All Conversations page, click ⬇ button
  • Browser downloads .jsonl file with all user conversations
  • File contains one JSON object per line + manifest trailer
  • Admin export still works independently
  • User with 0 conversations gets an empty file with manifest only

Add a streaming NDJSON export endpoint for the authenticated user's
conversations, mirroring the admin bulk export but scoped to the
current user.

Backend:
- GET /conversations/export — streams user's conversations as NDJSON
- ListUserConversationsAfterID repo + service methods (cursor pagination)
- ExportUserConversationData with user ownership check
- 4 unit tests: ownership rejection, default message IDs, run ID
  deduplication, empty run ID filtering

Frontend:
- Download button in the All Conversations toolbar
- exportAllConversations API function (blob download)
- Full i18n (zh-CN + en-US)

Closes DEEIX-AI#423
@fengshao1227
fengshao1227 force-pushed the feat/user-export-all branch from 865879c to 8dd3736 Compare July 7, 2026 03:09
Comment thread backend/internal/transport/http/conversation/router.go
fengshao1227 and others added 3 commits July 7, 2026 11:54
- Move GET /conversations/export before /:id to avoid Gin route
  conflict between static and parameterized paths
- Parse NDJSON manifest trailer in frontend to detect partial
  failures (complete=false or failed>0) and show accurate toast
- Add exportAllPartial i18n key with exported/failed counts
@chenyme
chenyme merged commit d1d4dd6 into DEEIX-AI:dev Jul 7, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: 允许用户导出自己的全部对话

2 participants