legco_ai_assistant/backend/app/test
Woody 3b868a0133 feat(prompts): integrate filter_per_subq with PromptService, fix seed bugs, restructure UI
Break the hardcoded per-sub-q filter prompt into 3 editable PromptService templates (filter_intro, filter_section, filter_outro) with placeholders for the for-loop iteration pattern. Refactor RelevanceFilter._build_per_subq_prompt() to compose them at runtime, falling back to built-in defaults when PromptService is unavailable.

Fix two latent bugs from Package 4:
- generate_per_subq was called by rag.py but never added to _VALID_STEPS or DB seed (would ValueError at runtime)
- _SEED_GENERATE placeholder mismatch: flat generate_response() expects {question}/{context} but Package 4 changed it to {context_sections}. Restored flat template; generate_per_subq now holds {context_sections}.

Add database backfill migration in seed_default_profiles() to INSERT OR IGNORE missing steps into existing profile rows, ensuring all 7 steps exist on restart.

Restructure System Prompts UI: remove unused flat filter/generate steps, replace with Step 2.1-2.3 (filter_intro/section/outro) and Step 3 (generate_per_subq). Update PlaceholderDocs with {context_sections}, {subq_idx}, {subq_question}.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-27 11:14:27 +08:00
..
acceptance test(backend): add Phase 4 integration and acceptance tests 2026-04-26 23:29:09 +08:00
conftest.py feat(prompts): integrate filter_per_subq with PromptService, fix seed bugs, restructure UI 2026-04-27 11:14:27 +08:00
test_phase1_chunk_serving.py feat: add chunk PDF serving endpoint and frontend clickable source links (1.5.6) 2026-04-24 11:49:39 +08:00
test_phase1_chunking.py feat: Phase 1.2 ingestion pipeline with chunking and metadata 2026-04-22 16:49:52 +08:00
test_phase1_config.py feat: Phase 1.1 project setup with config, database, and models 2026-04-22 16:13:52 +08:00
test_phase1_database.py feat(history): Phase 3.5 — Query History backend (service, API, timing, XML capture) 2026-04-25 22:59:53 +08:00
test_phase1_documents_router.py feat(backend): add documents CRUD endpoints and tests 2026-04-23 19:02:28 +08:00
test_phase1_enhanced_metadata.py feat(backend): add page_number, chunk_file_path, document_id to chunk metadata 2026-04-24 10:30:40 +08:00
test_phase1_ingest.py feat(backend): refactor ingest pipeline for page-aware chunking with PDF generation 2026-04-24 10:53:17 +08:00
test_phase1_ingest_page_aware.py feat(backend): refactor ingest pipeline for page-aware chunking with PDF generation 2026-04-24 10:53:17 +08:00
test_phase1_llm_client.py test(backend): update unit tests for LLM monitoring changes 2026-04-23 14:52:41 +08:00
test_phase1_metadata.py feat: Phase 1.2 ingestion pipeline with chunking and metadata 2026-04-22 16:49:52 +08:00
test_phase1_page_aware_chunking.py feat(backend): add page-aware chunking with adjacent-page overlap 2026-04-24 10:30:18 +08:00
test_phase1_parsers.py feat: Phase 1.2 ingestion pipeline with chunking and metadata 2026-04-22 16:49:52 +08:00
test_phase1_pdf_extractor.py feat(backend): add PDF page extractor and chunk PDF storage config 2026-04-24 10:52:57 +08:00
test_phase1_pdf_parser_pages.py feat(backend): add page-aware PDF parsing with per-page text extraction 2026-04-24 10:30:04 +08:00
test_phase1_query.py feat(history): Phase 3.5 — Query History backend (service, API, timing, XML capture) 2026-04-25 22:59:53 +08:00
test_phase1_query_decomposer.py feat(history): Phase 3.5 — Query History backend (service, API, timing, XML capture) 2026-04-25 22:59:53 +08:00
test_phase1_rag_service.py test(backend): extend existing tests for per-sub-q methods and templates 2026-04-26 23:29:27 +08:00
test_phase1_relevance_filter.py test(backend): extend existing tests for per-sub-q methods and templates 2026-04-26 23:29:27 +08:00
test_phase2_asr_client.py init: project setup with AGENTS.md, test structure, and plan directory 2026-04-22 15:22:29 +08:00
test_phase2_video_upload.py init: project setup with AGENTS.md, test structure, and plan directory 2026-04-22 15:22:29 +08:00
test_phase2_ws_asr.py init: project setup with AGENTS.md, test structure, and plan directory 2026-04-22 15:22:29 +08:00
test_phase3_history_router.py feat(history): Phase 3.5 — Query History backend (service, API, timing, XML capture) 2026-04-25 22:59:53 +08:00
test_phase3_history_service.py feat(db): update history schema and generate prompt template for Package 4 2026-04-26 23:28:28 +08:00
test_phase3_prompt_injection.py test(backend): extend existing tests for per-sub-q methods and templates 2026-04-26 23:29:27 +08:00
test_phase3_prompt_service.py feat(prompts): integrate filter_per_subq with PromptService, fix seed bugs, restructure UI 2026-04-27 11:14:27 +08:00
test_phase3_prompts_router.py feat(prompts): integrate filter_per_subq with PromptService, fix seed bugs, restructure UI 2026-04-27 11:14:27 +08:00
test_phase3_query_history_integration.py test(backend): extend existing tests for per-sub-q methods and templates 2026-04-26 23:29:27 +08:00
test_phase3_sqlite_db.py feat(prompts): integrate filter_per_subq with PromptService, fix seed bugs, restructure UI 2026-04-27 11:14:27 +08:00
test_phase4_generate_per_subq.py test(backend): add Phase 4 unit tests for generate, format, history, prompts 2026-04-26 23:28:58 +08:00
test_phase4_history_format.py test(backend): add Phase 4 unit tests for generate, format, history, prompts 2026-04-26 23:28:58 +08:00
test_phase4_integration_query_pipeline.py test(backend): add Phase 4 integration and acceptance tests 2026-04-26 23:29:09 +08:00
test_phase4_prompt_templates.py feat(prompts): integrate filter_per_subq with PromptService, fix seed bugs, restructure UI 2026-04-27 11:14:27 +08:00
test_phase4_query_router_filter.py test(backend): add Phase 4 unit tests for retrieval and filtering 2026-04-26 23:28:45 +08:00
test_phase4_query_router_retrieval.py test(backend): add Phase 4 unit tests for retrieval and filtering 2026-04-26 23:28:45 +08:00
test_phase4_relevance_filter_per_subq.py test(backend): add Phase 4 unit tests for retrieval and filtering 2026-04-26 23:28:45 +08:00
test_phase4_response_format.py test(backend): add Phase 4 unit tests for generate, format, history, prompts 2026-04-26 23:28:58 +08:00
test_phase4_retrieve_per_subquestion.py test(backend): add Phase 4 unit tests for retrieval and filtering 2026-04-26 23:28:45 +08:00