feat: include supporting data in all export formats

Query supporting data in the export endpoint and pass to markdown, text,
HTML, and PSA export generators. Each format renders text snippets and
screenshot placeholders in its native style.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-17 00:39:01 -04:00
parent 312024e143
commit f7271e22ae
2 changed files with 76 additions and 8 deletions

View File

@@ -407,18 +407,35 @@ async def export_session(
headers={"Content-Disposition": f'attachment; filename="session-export-{session_id}.pdf"'},
)
# Query supporting data for non-PDF formats
from app.models.supporting_data import SessionSupportingData
sd_result = await db.execute(
select(SessionSupportingData)
.where(SessionSupportingData.session_id == session_id)
.order_by(SessionSupportingData.sort_order)
)
supporting_data_items = [
{
"label": sd.label,
"data_type": sd.data_type,
"content": sd.content,
"content_type": sd.content_type,
}
for sd in sd_result.scalars().all()
]
# Generate export based on format
if export_options.format == "markdown":
content = generate_markdown_export(session, export_options)
content = generate_markdown_export(session, export_options, supporting_data=supporting_data_items)
media_type = "text/markdown"
elif export_options.format == "html":
content = generate_html_export(session, export_options)
content = generate_html_export(session, export_options, supporting_data=supporting_data_items)
media_type = "text/html"
elif export_options.format == "psa":
content = generate_psa_export(session, export_options)
content = generate_psa_export(session, export_options, supporting_data=supporting_data_items)
media_type = "text/plain"
else: # text
content = generate_text_export(session, export_options)
content = generate_text_export(session, export_options, supporting_data=supporting_data_items)
media_type = "text/plain"
# Resolve variables in export output