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

Function report_continue_chapter

functions/function_calling/deep_research.py:421–445  ·  view source on GitHub ↗

Append content to an existing chapter.

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

Source from the content-addressed store, hash-verified

419
420
421def report_continue_chapter(
422 title: Annotated[str, ParamMeta(description="Chapter title to append to (supports multi-level index e.g. 'Intro/Background')")],
423 content: Annotated[str, ParamMeta(description="Content to append")],
424 _context: Dict[str, Any] | None = None,
425) -> str:
426 """
427 Append content to an existing chapter.
428 """
429 ctx = FileToolContext(_context)
430 _, report_file = _get_files(ctx)
431 _, report_lock = _get_locks(ctx)
432
433 with FileLock(report_lock):
434 lines = _read_report_lines(report_file)
435
436 start, end = _find_chapter_range(lines, title)
437 if start == -1:
438 return f"Chapter '{title}' not found."
439
440 # Append content before 'end' (which is the start of next section or end of file)
441 new_lines = content.splitlines() + [""]
442 lines[end:end] = new_lines
443
444 _save_report(report_file, lines)
445 return f"Appended content to chapter '{title}'"
446
447
448def report_reorder_chapters(

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