Files
ragflow/rag/prompts/assign_toc_levels.md
Ricardo-M-L 424aee5bec fix: correct typos in code comments, docstrings and docs (#13931)
## Summary
- Fix `a image` → `an image` in README and log message
- Fix `colomn` → `column` in table structure recognizer comment
- Fix `formated` → `formatted` in confluence connector docstring
- Fix `tabel of content` → `table of contents` in TOC prompt

## Test plan
- [ ] Documentation and comment changes, no functional impact

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: yuj <yuj@ztjzsoft.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Jin Hai <haijin.chn@gmail.com>
2026-04-07 13:05:39 +08:00

1.8 KiB

You are given a JSON array of TOC(table of contents) items. Each item has at least {"title": string} and may include an existing title hierarchical level.

Task

  • For each item, assign a depth label using Arabic numerals only: top-level = 1, second-level = 2, third-level = 3, etc.
  • Multiple items may share the same depth (e.g., many 1s, many 2s).
  • Do not use dotted numbering (no 1.1/1.2). Use a single digit string per item indicating its depth only.
  • Preserve the original item order exactly. Do not insert, delete, or reorder.
  • Decide levels yourself to keep a coherent hierarchy. Keep peers at the same depth.

Output

  • Return a valid JSON array only (no extra text).
  • Each element must be {"level": "1|2|3", "title": }.
  • title must be the original title string.

Examples

Example A (chapters with sections) Input: ["Chapter 1 Methods", "Section 1 Definition", "Section 2 Process", "Chapter 2 Experiment"]

Output: [ {"level":"1","title":"Chapter 1 Methods"}, {"level":"2","title":"Section 1 Definition"}, {"level":"2","title":"Section 2 Process"}, {"level":"1","title":"Chapter 2 Experiment"} ]

Example B (parts with chapters) Input: ["Part I Theory", "Chapter 1 Basics", "Chapter 2 Methods", "Part II Applications", "Chapter 3 Case Studies"]

Output: [ {"level":"1","title":"Part I Theory"}, {"level":"2","title":"Chapter 1 Basics"}, {"level":"2","title":"Chapter 2 Methods"}, {"level":"1","title":"Part II Applications"}, {"level":"2","title":"Chapter 3 Case Studies"} ]

Example C (plain headings) Input: ["Introduction", "Background and Motivation", "Related Work", "Methodology", "Evaluation"]

Output: [ {"level":"1","title":"Introduction"}, {"level":"2","title":"Background and Motivation"}, {"level":"2","title":"Related Work"}, {"level":"1","title":"Methodology"}, {"level":"1","title":"Evaluation"} ]