Description
When document structure is auto-generated via the no-TOC fallback (process_no_toc → generate_toc_init), nodes derived from content that has no natural short heading (e.g. a bare numbered list item or a full sentence) end up with their entire original sentence copied verbatim into the title field, rather than a concise synthesized title.
Root cause
The generate_toc_init prompt (pageindex/index/page_index.py:549) instructs: "For the title, you need to extract the original title from the text, only fix the space inconsistency." This works fine when the underlying text has a genuine short heading to extract, but gives the model no instruction to shorten or synthesize a title when the source is a long sentence with no natural short label — so it just copies the whole sentence as the "title."
Reproduction
31-page PDF with no embedded TOC. Numbered list items became nodes whose title is the entire original sentence, e.g.:
1.1 The iOS version of the software requires that the device's running memory is not less than 2GB (iPhone 6S and later models, iPad Air2 and later models, iPad Mini4 and later models, and iPad Pro all series meet the requirements); In addition, the version of the system is not lower than iOS13.0.
Downstream, this gets rendered as a single Markdown heading line (e.g. ### 1.1 The iOS version of the software requires...), which is unreadable as a heading/table-of-contents entry.
Suggested fix
Update the generate_toc_init prompt to explicitly ask for a short, concise title (with a max length or word-count guideline) synthesized from the content when no natural short heading exists, rather than defaulting to a verbatim full-sentence copy.
Description
When document structure is auto-generated via the no-TOC fallback (
process_no_toc→generate_toc_init), nodes derived from content that has no natural short heading (e.g. a bare numbered list item or a full sentence) end up with their entire original sentence copied verbatim into thetitlefield, rather than a concise synthesized title.Root cause
The
generate_toc_initprompt (pageindex/index/page_index.py:549) instructs: "For the title, you need to extract the original title from the text, only fix the space inconsistency." This works fine when the underlying text has a genuine short heading to extract, but gives the model no instruction to shorten or synthesize a title when the source is a long sentence with no natural short label — so it just copies the whole sentence as the "title."Reproduction
31-page PDF with no embedded TOC. Numbered list items became nodes whose
titleis the entire original sentence, e.g.:Downstream, this gets rendered as a single Markdown heading line (e.g.
### 1.1 The iOS version of the software requires...), which is unreadable as a heading/table-of-contents entry.Suggested fix
Update the
generate_toc_initprompt to explicitly ask for a short, concise title (with a max length or word-count guideline) synthesized from the content when no natural short heading exists, rather than defaulting to a verbatim full-sentence copy.