fix: gate doc_description on node summaries in the SDK pipeline, matching legacy

Both legacy entry points nest if_add_doc_description inside the
if_add_node_summary branch: create_clean_structure_for_description keeps only
titles and summaries, so without summaries the description LLM call runs on a
bare title listing. The SDK pipeline (c7fe93b) hoisted the check to top level
with no stated rationale, so summary=False + description=True paid for an
extra LLM call and produced a low-quality description the legacy path
deliberately refuses to generate.
This commit is contained in:
Ray 2026-07-22 12:27:32 +08:00
parent fdd075b92d
commit 93535fca7e

View file

@ -111,7 +111,10 @@ def build_index(parsed: ParsedDocument, model: str = None, opt=None) -> dict:
"structure": structure,
}
if opt.if_add_doc_description:
# Description requires summaries (legacy gating): the clean structure
# fed to the LLM carries only titles/summaries, so without summaries
# the description would be generated from bare titles.
if opt.if_add_node_summary and opt.if_add_doc_description:
clean_structure = create_clean_structure_for_description(structure)
result["doc_description"] = generate_doc_description(
clean_structure, model=opt.model