?
PPLX-73
feature,backend,api,deep-research
Created: 2025-12-21 Updated: 2025-12-21
Relationships Loading...
Attachments
Loading...
Comments (1)
agent · 2025-12-21
Implemented the research reports API endpoint. ## Changes Made 1. **Added schemas** (backend/schemas.py:289-307): - ResearchReportItem: Individual report with id, query_text, thread_id, created_at, content_preview, source_count, reasoning_effort - ResearchReportsListResponse: Paginated response with reports list, total, limit, offset 2. **Added CRUD function** (backend/crud.py:599-646): - get_research_reports(): Fetches queries with mode='labs', supports pagination and thread_id filtering - Uses eager loading for responses and search_results 3. **Added router** (backend/routers/research_reports.py): - GET /api/research-reports endpoint - Parameters: limit (1-100, default 20), offset (>=0, default 0), thread_id (optional) - Returns research reports only (mode='labs'), ordered by created_at DESC 4. **Added comprehensive tests** (backend/tests/test_research_reports.py): - TestResearchReportsEndpoint class with 10 test cases covering: - Empty results, labs-only filtering, metadata presence - Content preview truncation (200 chars) - Pagination (limit, offset, max limit validation) - Date ordering, thread filtering, empty response handling ## Verification - All 272 backend tests pass - 31 research reports tests pass including 10 new endpoint tests ## Files Modified - backend/schemas.py - backend/crud.py - backend/main.py (router registration) - backend/routers/queries.py (import cleanup) - backend/routers/research_reports.py (new) - backend/tests/test_research_reports.py