feat: ✨ allow changing the summary prompt

This commit is contained in:
Nate Sesti 2023-09-01 14:43:51 -07:00
parent 0408723816
commit 5c8b28b7fd
2 changed files with 14 additions and 8 deletions

View file

@ -208,6 +208,8 @@ class DefaultModelEditCodeStep(Step):
_new_contents: str = ""
_prompt_and_completion: str = ""
summary_prompt: str = "Please give brief a description of the changes made above using markdown bullet points. Be concise:"
async def describe(self, models: Models) -> Coroutine[str, None, None]:
if self._previous_contents.strip() == self._new_contents.strip():
description = "No edits were made"
@ -227,7 +229,7 @@ class DefaultModelEditCodeStep(Step):
{changes}
```
Please give brief a description of the changes made above using markdown bullet points. Be concise:"""
{self.summary_prompt}"""
)
)
name = await models.medium.complete(

View file

@ -245,6 +245,8 @@ class EditHighlightedCodeStep(Step):
hide = True
description: str = "Change the contents of the currently highlighted code or open file. You should call this function if the user asks seems to be asking for a code change."
summary_prompt: Optional[str] = None
async def describe(self, models: Models) -> Coroutine[str, None, None]:
return "Editing code"
@ -293,13 +295,15 @@ class EditHighlightedCodeStep(Step):
self.description = "Please accept or reject the change before making another edit in this file."
return
await sdk.run_step(
DefaultModelEditCodeStep(
user_input=self.user_input,
range_in_files=range_in_files,
model=self.model,
)
)
args = {
"user_input": self.user_input,
"range_in_files": range_in_files,
"model": self.model,
}
if self.summary_prompt:
args["summary_prompt"] = self.summary_prompt
await sdk.run_step(DefaultModelEditCodeStep(**args))
class UserInputStep(Step):