Skip to content

feat(memos-local): add data export endpoint and UI (closes #1474)#1475

Open
owensun6 wants to merge 1 commit intoMemTensor:mainfrom
owensun6:feat/export-memories
Open

feat(memos-local): add data export endpoint and UI (closes #1474)#1475
owensun6 wants to merge 1 commit intoMemTensor:mainfrom
owensun6:feat/export-memories

Conversation

@owensun6
Copy link
Copy Markdown

Summary

Implements the data export feature requested in #1474.

  • GET /api/export?format=json — downloads a full backup of all memories, tasks, and skills as a single JSON file (memos-export-YYYY-MM-DDTHH-MM-SS.json)
  • GET /api/export?format=csv — downloads memories only as CSV with ISO 8601 timestamps (memos-memories-YYYY-MM-DDTHH-MM-SS.csv)
  • Settings → General tab — two export buttons added under a new "Export Data" section, with i18n support (English + Chinese)

Changes

File What changed
src/storage/sqlite.ts SqliteStore.exportAll() and exportMemoriesAsCsv() methods
src/viewer/server.ts GET /api/export route + handleExport() handler
src/viewer/html.ts Export UI section, exportData() JS helper, i18n keys

Test plan

  • Open Memory Viewer → Settings → General, scroll to "Export Data"
  • Click "Export JSON (full backup)" — verify file downloads with memories, tasks, skills arrays
  • Click "Export CSV (memories only)" — verify file opens in spreadsheet with correct columns
  • Verify filenames include timestamp
  • Verify existing tests still pass: npx vitest run

Context

I'm an OpenClaw user and ran into the lack of backup/export while working with the plugin daily. The pre-existing test failures (embedding fetch errors, update-install) are network-dependent and present on main before this PR.

- SqliteStore.exportAll(): dump all memories/tasks/skills as JSON
- SqliteStore.exportMemoriesAsCsv(): memories-only CSV with ISO timestamps
- GET /api/export?format=json|csv endpoint in ViewerServer
- Export buttons in Settings → General tab (i18n: en + zh)
- exportData() JS helper triggers file download via <a> click

Closes MemTensor#1474
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.

1 participant