feat(search): add structured filters to AI session list endpoint and frontend
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -424,18 +424,43 @@ async def export_session(
|
||||
for sd in sd_result.scalars().all()
|
||||
]
|
||||
|
||||
# Query file upload evidence for non-PDF formats
|
||||
from app.models.file_upload import FileUpload
|
||||
from app.services import storage_service as _storage_service
|
||||
from app.core.config import settings as _export_settings
|
||||
upload_items: list[dict] = []
|
||||
if _export_settings.STORAGE_ENDPOINT:
|
||||
try:
|
||||
uploads_result = await db.execute(
|
||||
select(FileUpload)
|
||||
.where(FileUpload.session_id == session_id)
|
||||
.order_by(FileUpload.created_at)
|
||||
)
|
||||
for u in uploads_result.scalars().all():
|
||||
try:
|
||||
url = _storage_service.get_presigned_url(u.storage_key)
|
||||
upload_items.append({
|
||||
"filename": u.filename,
|
||||
"url": url,
|
||||
"is_image": u.content_type.startswith("image/"),
|
||||
})
|
||||
except Exception:
|
||||
pass # Skip uploads that fail URL generation
|
||||
except Exception:
|
||||
pass # Storage errors should not fail the export
|
||||
|
||||
# Generate export based on format
|
||||
if export_options.format == "markdown":
|
||||
content = generate_markdown_export(session, export_options, supporting_data=supporting_data_items)
|
||||
content = generate_markdown_export(session, export_options, supporting_data=supporting_data_items, uploads=upload_items)
|
||||
media_type = "text/markdown"
|
||||
elif export_options.format == "html":
|
||||
content = generate_html_export(session, export_options, supporting_data=supporting_data_items)
|
||||
content = generate_html_export(session, export_options, supporting_data=supporting_data_items, uploads=upload_items)
|
||||
media_type = "text/html"
|
||||
elif export_options.format == "psa":
|
||||
content = generate_psa_export(session, export_options, supporting_data=supporting_data_items)
|
||||
content = generate_psa_export(session, export_options, supporting_data=supporting_data_items, uploads=upload_items)
|
||||
media_type = "text/plain"
|
||||
else: # text
|
||||
content = generate_text_export(session, export_options, supporting_data=supporting_data_items)
|
||||
content = generate_text_export(session, export_options, supporting_data=supporting_data_items, uploads=upload_items)
|
||||
media_type = "text/plain"
|
||||
|
||||
# Resolve variables in export output
|
||||
|
||||
Reference in New Issue
Block a user