Skip to content

UI-03: Export thread as downloadable Markdown transcript#20

Merged
Killea merged 2 commits intoKillea:mainfrom
bertheto:feat/export-thread-markdown
Mar 1, 2026
Merged

UI-03: Export thread as downloadable Markdown transcript#20
Killea merged 2 commits intoKillea:mainfrom
bertheto:feat/export-thread-markdown

Conversation

@bertheto
Copy link
Contributor

@bertheto bertheto commented Mar 1, 2026

Summary

Adds a one-click Markdown export for any AgentChatBus thread, accessible from two entry points in the web UI.

Changes

Backend

  • New GET /api/threads/{id}/export endpoint (src/main.py) returning text/markdown; charset=utf-8 with Content-Disposition: attachment; filename={slug}.md. Returns 404 if thread not found.
  • New thread_export_markdown() in src/db/crud.py: fetches up to 10,000 messages (system-prompt excluded). Structured header (status, created_at, message count, export timestamp) + one ### Author — timestamp block per message.

Web UI

  • acb-thread-header.js: export button (#export-thread-btn) with SVG download icon between thread title and online-presence badge.
  • acb-thread-context-menu.js: "Export .md" item (#ctx-export) above the divider/Delete button.
  • index.html: exportFromHeader() and exportThreadFromMenu() wired to window.AcbThreads.exportThread().
  • shared-threads.js: exportThread({ threadId, topic }) using native fetch() + Blob download pattern.
  • main.css: #export-thread-btn styled (28px, border-radius 8px, hover state, dark + light theme).

Tests

  • tests/test_export_markdown.py: 6 pytest integration tests (empty thread, with messages, 404, Content-Type, Content-Disposition, special chars).
  • frontend/src/__tests__/export-thread.test.js: 8 Vitest unit tests — 5 DOM/visual (button exists, aria-label, SVG icon, context menu item, text) + 3 logic (Blob download, filename slug, error handling).

All tests pass: 60/60 pytest + 32/32 Vitest (including pre-existing tests)

Test plan

  • Select a thread → verify export button visible in header (between title and online badge)
  • Right-click a thread → verify "Export .md" in context menu above divider
  • Click export button → .md file downloaded with correct thread content
  • Test on empty thread → file contains header only, no message sections
  • Test on thread with special chars in topic/content → no corruption

bertheto and others added 2 commits March 1, 2026 16:51
Add GET /api/threads/{id}/export endpoint (text/markdown, Content-Disposition attachment)
Add thread_export_markdown() in crud.py (10k msg limit, system-prompt excluded)
Add export button in acb-thread-header with SVG download icon
Add Export .md item in acb-thread-context-menu
Wire exportFromHeader() and exportThreadFromMenu() in index.html
Add exportThread() to window.AcbThreads (Blob download, graceful error)
Style export button in main.css (28px, dark/light theme)
Add 6 pytest integration tests and 8 Vitest unit tests (5 DOM + 3 logic)
@Killea Killea merged commit e7e93e5 into Killea:main Mar 1, 2026
1 check 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.

2 participants