Skip to content

Commit

Permalink
fix(docs)📝: Ensure content is cleared at the correct stage when writi…
Browse files Browse the repository at this point in the history
…ng from scratch

- Move content clearing to start of write function if from_scratch is true.
  • Loading branch information
ericmjl committed Aug 31, 2024
1 parent a2f9a06 commit 2cfe7fe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llamabot/cli/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ def write(file_path: Path, from_scratch: bool = False):
"""
src_file = MarkdownSourceFile(file_path)

if from_scratch:
src_file.post.content = ""

docwriter = StructuredBot(
system_prompt=docwriter_sysprompt(),
pydantic_model=DocumentationContent,
Expand All @@ -172,9 +175,6 @@ def write(file_path: Path, from_scratch: bool = False):
)
result: DocumentationOutOfDate = ood_checker(documentation_information(src_file))

if from_scratch:
src_file.post.content = ""

if not src_file.post.content or result.is_out_of_date:
response: DocumentationContent = docwriter(
documentation_information(src_file) + "\nNow please write the docs."
Expand Down

0 comments on commit 2cfe7fe

Please sign in to comment.