From 2691c80ac2db03265fe0dd158cdbb800026d262c Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 28 Jun 2023 11:03:59 -0700 Subject: [PATCH] aider: Change `original_lines` and `updated_lines` properties in `EditBlockFunctionCoder` class to be an array of strings instead of a single string. # Context: USER: change the `functions` jsonschema so that `original_lines` is a list of strings and so is `update_files` ASSISTANT: To make the requested changes, we need to modify the `functions` JSON schema in the `EditBlockFunctionCoder` class in the `aider/coders/editblock_func_coder.py` file. Here is the change: ```python aider/coders/editblock_func_coder.py <<<<<<< ORIGINAL properties=dict( path=dict( type="string", description="Path of file to edit", ), original_lines=dict( type="string", description=( "Lines from the original file, including all" " whitespace, newlines, without skipping any lines" ), ), updated_lines=dict( type="string", description="New content to replace the `original_lines` with", ), ), ======= properties=dict( path=dict( type="string", description="Path of file to edit", ), original_lines=dict( type="array", items=dict( type="string", ), description=( "Lines from the original file, including all" " whitespace, newlines, without skipping any lines" ), ), updated_lines=dict( type="array", items=dict( type="string", ), description="New content to replace the `original_lines` with", ), ), >>>>>>> UPDATED ``` This change modifies the `original_lines` and `updated_lines` properties to be an array of strings instead of a single string. This allows for multiple lines to be specified in the `original_lines` and `updated_lines` fields. --- aider/coders/editblock_func_coder.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/aider/coders/editblock_func_coder.py b/aider/coders/editblock_func_coder.py index 70c5f8a76..64c518bad 100644 --- a/aider/coders/editblock_func_coder.py +++ b/aider/coders/editblock_func_coder.py @@ -36,14 +36,20 @@ class EditBlockFunctionCoder(Coder): description="Path of file to edit", ), original_lines=dict( - type="string", + type="array", + items=dict( + type="string", + ), description=( "Lines from the original file, including all" " whitespace, newlines, without skipping any lines" ), ), updated_lines=dict( - type="string", + type="array", + items=dict( + type="string", + ), description="New content to replace the `original_lines` with", ), ),