renamed func -> wholefile_func

This commit is contained in:
Paul Gauthier 2023-06-22 08:15:20 -07:00
parent fa1158d8a8
commit 985e362544
4 changed files with 10 additions and 9 deletions

View file

@ -1,6 +1,6 @@
from .base_coder import Coder
from .editblock_coder import EditBlockCoder
from .func_coder import FunctionCoder
from .wholefile_coder import WholeFileCoder
from .wholefile_func_coder import WholeFileFunctionCoder
__all__ = [Coder, EditBlockCoder, WholeFileCoder, FunctionCoder]
__all__ = [Coder, EditBlockCoder, WholeFileCoder, WholeFileFunctionCoder]

View file

@ -49,7 +49,7 @@ class Coder:
openai_api_base="https://api.openai.com/v1",
**kwargs,
):
from . import EditBlockCoder, FunctionCoder, WholeFileCoder
from . import EditBlockCoder, WholeFileCoder, WholeFileFunctionCoder
openai.api_key = openai_api_key
openai.api_base = openai_api_base
@ -70,8 +70,8 @@ class Coder:
return EditBlockCoder(main_model, io, **kwargs)
elif edit_format == "whole":
return WholeFileCoder(main_model, io, **kwargs)
elif edit_format == "func":
return FunctionCoder(main_model, io, **kwargs)
elif edit_format == "whole-func":
return WholeFileFunctionCoder(main_model, io, **kwargs)
else:
raise ValueError(f"Unknown edit format {edit_format}")

View file

@ -5,10 +5,10 @@ from aider import diffs
from ..dump import dump # noqa: F401
from .base_coder import Coder
from .func_prompts import FunctionPrompts
from .wholefile_func_prompts import WholeFileFunctionPrompts
class FunctionCoder(Coder):
class WholeFileFunctionCoder(Coder):
functions = [
dict(
name="write_file",
@ -47,7 +47,7 @@ class FunctionCoder(Coder):
]
def __init__(self, *args, **kwargs):
self.gpt_prompts = FunctionPrompts()
self.gpt_prompts = WholeFileFunctionPrompts()
super().__init__(*args, **kwargs)
def update_cur_messages(self, content, edited):

View file

@ -3,7 +3,7 @@
from .prompts_base import EditorPrompts
class FunctionPrompts(EditorPrompts):
class WholeFileFunctionPrompts(EditorPrompts):
main_system = """Act as an expert software developer.
Take requests for changes to the supplied code.
If the request is ambiguous, ask questions.
@ -21,6 +21,7 @@ NEVER return code outside the `write_file` function.
redacted_edit_message = "No changes are needed."
# TODO: make this optional, since this Coder doesn't use it
repo_content_prefix = (
"Below here are summaries of other files! Do not propose changes to these *read-only*"
" files without asking me first.\n"