MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / report_del_chapter

Function report_del_chapter

functions/function_calling/deep_research.py:511–532  ·  view source on GitHub ↗

Delete a chapter and its content.

(
    title: Annotated[str, ParamMeta(description="Chapter title to delete (supports multi-level index e.g. 'Intro/Background')")],
    _context: Dict[str, Any] | None = None,
)

Source from the content-addressed store, hash-verified

509
510
511def report_del_chapter(
512 title: Annotated[str, ParamMeta(description="Chapter title to delete (supports multi-level index e.g. 'Intro/Background')")],
513 _context: Dict[str, Any] | None = None,
514) -> str:
515 """
516 Delete a chapter and its content.
517 """
518 ctx = FileToolContext(_context)
519 _, report_file = _get_files(ctx)
520 _, report_lock = _get_locks(ctx)
521
522 with FileLock(report_lock):
523 lines = _read_report_lines(report_file)
524
525 start, end = _find_chapter_range(lines, title)
526 if start == -1:
527 return f"Chapter '{title}' not found."
528
529 del lines[start:end]
530
531 _save_report(report_file, lines)
532 return f"Deleted chapter '{title}'"
533
534def report_export_pdf(
535 _context: Dict[str, Any] | None = None,

Callers

nothing calls this directly

Calls 7

ParamMetaClass · 0.90
FileToolContextClass · 0.90
_get_filesFunction · 0.85
_get_locksFunction · 0.85
_read_report_linesFunction · 0.85
_find_chapter_rangeFunction · 0.85
_save_reportFunction · 0.85

Tested by

no test coverage detected