taprosoft commited on
Commit
9cc036c
·
unverified ·
1 Parent(s): d7bf9d0

fix: update new TOCBuilder interface

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -223,7 +223,7 @@ def convert_document(
223
  toc_text = (
224
  "<details open='true'><summary><big>Table-of-Content</big></summary>\n\n"
225
  )
226
- new_chunks = TOCBuilder.run(
227
  chunks,
228
  use_llm=True,
229
  model=MODEL_NAME,
@@ -232,17 +232,17 @@ def convert_document(
232
  if chunk.ctype != CType.Header:
233
  continue
234
 
235
- chunk_page = chunk.origin["location"]["page"]
236
- chunk_bbox = chunk.origin["location"]["bbox"]
237
  chunk_text = (
238
- "<h4>" + "".join(["&nbsp;&nbsp;&nbsp;"] * level) + chunk.content
239
  )
240
  ref_link = (
241
  f" <a class='chunk-ref' id='{chunk_page}-{chunk_bbox}'>[↗]</a>"
242
  if add_reference_links
243
  else ""
244
  )
245
- chunk_text += ref_link + "</h4>"
246
  toc_text += chunk_text + "\n\n"
247
 
248
  toc_text += "</details>\n\n---\n\n"
 
223
  toc_text = (
224
  "<details open='true'><summary><big>Table-of-Content</big></summary>\n\n"
225
  )
226
+ new_chunks = TOCHierarchyBuilder.run(
227
  chunks,
228
  use_llm=True,
229
  model=MODEL_NAME,
 
232
  if chunk.ctype != CType.Header:
233
  continue
234
 
235
+ chunk_page = chunk.origin.location["page"]
236
+ chunk_bbox = chunk.origin.location["bbox"]
237
  chunk_text = (
238
+ "<h5>" + "".join(["&nbsp;&nbsp;&nbsp;"] * level) + chunk.content
239
  )
240
  ref_link = (
241
  f" <a class='chunk-ref' id='{chunk_page}-{chunk_bbox}'>[↗]</a>"
242
  if add_reference_links
243
  else ""
244
  )
245
+ chunk_text += ref_link + "</h5>"
246
  toc_text += chunk_text + "\n\n"
247
 
248
  toc_text += "</details>\n\n---\n\n"