from decimal import Decimal from finrep_algo_agent.prompts.builders import ( build_outline_l1_user_prompt, build_outline_l2_user_prompt, build_section_user_prompt, ) from finrep_algo_agent.schemas.outline import ChapterCandidate, OutlineL1Request, OutlineL2Request from finrep_algo_agent.schemas.section import SectionRequest def test_outline_l1_template_renders() -> None: req = OutlineL1Request( report_type="项目融资", agreement_amount=Decimal("100"), chapter_candidates=[ChapterCandidate(chapter_id="c1", chapter_name="测试章")], ) text = build_outline_l1_user_prompt(req) assert "项目融资" in text assert "c1" in text assert "一级章节候选清单" in text def test_outline_l2_template_renders() -> None: l1 = OutlineL1Request( report_type="项目融资", agreement_amount=Decimal("50"), chapter_candidates=[], ) req = OutlineL2Request( chapter_name="融资方案", chapter_no="3", chapter_paragraph_count_enum="P2", chapter_reason="保留", overall_logic="总逻辑", leaf_chapter_candidates=[{"name": "末级1", "知识单元类型": "单元呈现型"}], l1_task_snapshot=l1, ) text = build_outline_l2_user_prompt(req) assert "融资方案" in text assert "末级1" in text assert "判断说明" in text def test_section_template_renders() -> None: req = SectionRequest( knowledge_unit_id="ku1", report_type="财务顾问", template_type="info", overall_logic="整体", chapter_logic="章逻辑", paragraph_position="定位", task_input={"a": 1}, data_package={"b": 2}, paragraph_logic="撰写", ) text = build_section_user_prompt(req) assert "财务顾问" in text assert "撰写" in text