MCPcopy Index your code
hub / github.com/VectifyAI/PageIndex / add_preface_if_needed

Function add_preface_if_needed

pageindex/utils.py:372–383  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

370 return [clean_node(node) for node in root_nodes]
371
372def add_preface_if_needed(data):
373 if not isinstance(data, list) or not data:
374 return data
375
376 if data[0]['physical_index'] is not None and data[0]['physical_index'] > 1:
377 preface_node = {
378 "structure": "0",
379 "title": "Preface",
380 "physical_index": 1,
381 }
382 data.insert(0, preface_node)
383 return data
384
385
386

Callers 1

tree_parserFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected