Skip to content

Commit

Permalink
fix: fixed bug in how examples were generated for patch tool
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Sep 11, 2024
1 parent 2e08a3a commit c8489ec
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gptme/tools/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@
mode: Literal["markdown", "xml"] = "markdown"


def patch_to_markdown(patch: str, filename: str, append: bool = False) -> str:
def patch_to_markdown(filename: str, patch: str, append: bool = False) -> str:
_tool = "patch" if not append else "append"
return f"```{_tool} {filename}\n{patch}\n```"


def patch_to_xml(patch: str, filename: str, append: bool = False) -> str:
def patch_to_xml(filename: str, patch: str, append: bool = False) -> str:
_tool = "patch" if not append else "append"
return f"<{_tool} filename='{filename}'>\n{patch}\n</patch>"


def patch_to_output(patch: str, filename: str, append: bool = False) -> str:
def patch_to_output(filename: str, patch: str, append: bool = False) -> str:
if mode == "markdown":
return patch_to_markdown(patch, filename, append)
return patch_to_markdown(filename, patch, append)
elif mode == "xml":
return patch_to_xml(patch, filename, append)
return patch_to_xml(filename, patch, append)
else:
raise ValueError(f"Invalid mode: {mode}")

Expand Down

0 comments on commit c8489ec

Please sign in to comment.