diff --git a/coder.py b/coder.py index 258eb4f71..3768b59e4 100755 --- a/coder.py +++ b/coder.py @@ -117,7 +117,10 @@ class Coder: files_messages = [ dict(role="user", content=files_content), dict(role="assistant", content="Ok."), - dict(role="system", content=prompts.files_content_suffix), + dict( + role="system", + content=prompts.files_content_suffix + prompts.system_reminder, + ), ] return files_messages @@ -149,7 +152,9 @@ class Coder: # self.show_messages(self.cur_messages, "cur") messages = [ - dict(role="system", content=prompts.main_system), + dict( + role="system", content=prompts.main_system + prompts.system_reminder + ), ] messages += self.done_messages messages += self.get_files_messages() diff --git a/prompts.py b/prompts.py index 545f2bb2c..c00eff383 100644 --- a/prompts.py +++ b/prompts.py @@ -40,6 +40,15 @@ some/dir/example.py >>>>>>> UPDATED ''' +system_reminder = """ +NEVER REPLY WITH AN ENTIRE FILE IN THE TRIPLE-QUOTED FORMAT LIKE THE USER MESSAGES! +ANY CODE YOU INCLUDE IN A REPLY *MUST* BE IN THE ORIGINAL/UPDATED FORMAT! +EVERY ORIGINAL/UPDATED BLOCK MUST START WITH THE FILENAME! +THE ORIGINAL BLOCK MUST BE THE *EXACT* LINES FROM THE FILE! +THE ORIGINAL BLOCK MUST INCLUDE ALL THE ORIGINAL LEADING SPACES AND INDENTATION! +""" + + returned_code = """ It looks like you tried to return a code block. Don't do that! @@ -48,8 +57,6 @@ Be selective! Only return the parts of the code which need changes! """ -system_reminder = "REMEMBER, ONLY RETURN CODE USING THE ORIGINAL/UPDATED FORMAT!" - ### FILES files_content_gpt_edits = "I made your suggested changes to the files." @@ -58,14 +65,7 @@ files_content_local_edits = "I made some changes to the files myself." files_content_prefix = "Here is the current content of the files:\n\n" -files_content_suffix = """BASE ANY EDITS ON THE CURRENT CONTENTS OF THE FILES AS SHOWN IN THE USER'S LAST MESSAGE. -NEVER REPLY WITH AN ENTIRE FILE IN THE TRIPLE-QUOTED FORMAT LIKE THAT! -ANY CODE YOU INCLUDE IN A REPLY MUST BE IN THE ORIGINAL/UPDATED FORMAT! -THE ORIGINAL BLOCK MUST BE THE *EXACT* LINES FROM THE FILE! -INCLUDE ALL THE LEADING SPACES!! -Be sure to include the correct path and filename for each edit, exactly as specified by the user. -DO NOT REPLY WITH diff OUTPUT! -""" +files_content_suffix = """Base any edits on the current contents of the files as shown in the user's last message.""" ### EDITOR