Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(report): skip single-subsection entries in TOC to match body (#3588)

LearningCircuit8257d475d2cc
diff --git a/src/local_deep_research/report_generator.py b/src/local_deep_research/report_generator.py
index dea3cb3280..133c129ef2 100644
--- a/src/local_deep_research/report_generator.py
+++ b/src/local_deep_research/report_generator.py
@@ -549,10 +549,11 @@ class IntegratedReportGenerator:
toc = ["# Table of Contents\n"]
for i, section in enumerate(structure, 1):
toc.append(f"{i}. **{section['name']}**")
- for j, subsection in enumerate(section["subsections"], 1):
- toc.append(
- f" {i}.{j} {subsection['name']} | _{subsection['purpose']}_"
- )
+ if len(section["subsections"]) > 1:
+ for j, subsection in enumerate(section["subsections"], 1):
+ toc.append(
+ f" {i}.{j} {subsection['name']} | _{subsection['purpose']}_"
+ )
# Combine TOC and sections
report_parts = ["\n".join(toc), ""]
diff --git a/tests/test_report_generator_coverage.py b/tests/test_report_generator_coverage.py
index 1ce3aeac32..1abc92a4c0 100644
--- a/tests/test_report_generator_coverage.py
+++ b/tests/test_report_generator_coverage.py
@@ -204,7 +204,8 @@ class TestFormatFinalReportDetailed:
{
"name": "S",
"subsections": [
- {"name": "Detail", "purpose": "explain details"}
+ {"name": "Detail", "purpose": "explain details"},
+ {"name": "Extra", "purpose": "additional info"},
],
}
]