fix(site-import): crawl 层注记并入草稿包 warnings(Task8 评审折入,spec §3.1)
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -402,7 +402,9 @@ def build(gen: dict, analysis: dict, crawl: dict, source_text: str) -> dict:
|
||||
gen = dict(gen or {})
|
||||
analysis = dict(analysis or {})
|
||||
crawl = dict(crawl or {})
|
||||
warnings: list[str] = []
|
||||
# crawl 层注记(logo 格式/大小跳过、薄子页跳过——Task 8 评审折入:
|
||||
# spec §3.1 要求 logo 跳过进 warnings 注记,此前被静默丢弃)
|
||||
warnings: list[str] = [str(w) for w in (crawl.get("warnings") or []) if w]
|
||||
src = source_text or crawl.get("pages_text") or ""
|
||||
missing: list[str] = []
|
||||
|
||||
|
||||
@@ -419,3 +419,16 @@ class TestSpecsStrictBool:
|
||||
facts = draft["prompts"]["company_facts"]
|
||||
assert ("参数未公布" in facts) or ("兜底" in facts)
|
||||
assert any(w.startswith("规格判定:不公开") for w in draft["warnings"])
|
||||
|
||||
|
||||
class TestCrawlWarningsMerge:
|
||||
def test_crawl层注记并入草稿包warnings(self):
|
||||
"""Task 8 评审:logo 跳过/薄子页跳过等 crawl 层注记必须进 warnings(spec §3.1)。"""
|
||||
gen = dict(_MIN_GEN) if "_MIN_GEN" in globals() else {
|
||||
"身份描述": "你是销售", "产品统称": "产品", "产品统称EN": "products",
|
||||
"产品类别清单": "产品", "规格追问三要素": "场景", "好差示例组": "示例",
|
||||
"关注信息": "信息", "固定追问句": "问句", "推荐建议": "建议"}
|
||||
crawl = dict(CRAWL, warnings=["logo 为不支持的格式,已跳过", "子页过薄已跳过:/thin"])
|
||||
draft = generator.build(gen, ANALYSIS_JSON, crawl, SOURCE_TEXT)
|
||||
assert "logo 为不支持的格式,已跳过" in draft["warnings"]
|
||||
assert "子页过薄已跳过:/thin" in draft["warnings"]
|
||||
|
||||
Reference in New Issue
Block a user