fix custom closing tags for code blocks

This commit is contained in:
LeonOstrez
2025-06-20 14:37:00 +02:00
committed by Zvonimir Sabljic
parent 4d88708329
commit 9ee580da4c
4 changed files with 4 additions and 4 deletions

View File

@@ -59,7 +59,7 @@ class FileDescription(BaseModel):
def extract_code_blocks(content):
# Use regex to find all <code> blocks with file attribute and their content
# Use regex to find all <pythagoracode> blocks with file attribute and their content
code_blocks = re.findall(r'<pythagoracode\s+file="(.*?)">(.*?)</pythagoracode>', content, re.DOTALL)
# Convert matches into a list of dictionaries
return [{"file_name": file_name, "file_content": file_content} for file_name, file_content in code_blocks]

View File

@@ -85,7 +85,7 @@ def has_correct_num_of_tags(response: str) -> bool:
"""
Checks if the response has the correct number of opening and closing tags.
"""
return response.count("</code>") == response.count("<code file")
return response.count("</pythagoracode>") == response.count("<pythagoracode file")
class Developer(ChatWithBreakdownMixin, RelevantFilesMixin, BaseAgent):

View File

@@ -45,4 +45,4 @@ If you think we should add more logs around the code to better understand the pr
If you want code to be written, write **ALL NEW CODE** that needs to be written. If you want to create a new file, write the entire content of that file and if you want to update an existing file, write the new code that needs to be written/updated. You cannot answer with "Ensure that...", "Make sure that...", etc. In these cases, explain how should the reader of your message ensure what you want them to ensure. In most cases, they will need to add some logs to ensure something in which case tell them where to add them.
** IMPORTANT - labels around code **
Always address code that needs to be changed by files and add labels <pythagoracode file="client/src/api/api.ts"> and </code> around changes for a specific file. (in this case client/src/api/api.ts) - you can mention multiple changes for a single file but never mix changes for multiple files in a single <pythagoracode> block. Never use any other markers around the code like backticks.
Always address code that needs to be changed by files and add labels <pythagoracode file="client/src/api/api.ts"> and </pythagoracode> around changes for a specific file. (in this case client/src/api/api.ts) - you can mention multiple changes for a single file but never mix changes for multiple files in a single <pythagoracode> block. Never use any other markers around the code like backticks.

View File

@@ -33,7 +33,7 @@ Whenever you add an API request from the frontend, make sure to wrap the request
Pay close attention to the currently implemented files, and DO NOT tell me to implement something that is already implemented. Similarly, do not change the current implementation if you think it is working correctly. It is not necessary for you to change files - you can leave the files as they are and just tell me that they are correctly implemented.
** IMPORTANT - labels around code **
Always address code that needs to be changed by files and add labels <pythagoracode file="client/src/api/api.ts"> and </code> around changes for a specific file. (in this case client/src/api/api.ts) - you can mention multiple changes for a single file but never mix changes for multiple files in a single <pythagoracode> block. Never use any other markers around the code like backticks.
Always address code that needs to be changed by files and add labels <pythagoracode file="client/src/api/api.ts"> and </pythagoracode> around changes for a specific file. (in this case client/src/api/api.ts) - you can mention multiple changes for a single file but never mix changes for multiple files in a single <pythagoracode> block. Never use any other markers around the code like backticks.
~~END_OF_DEVELOPMENT_INSTRUCTIONS~~
~~DEVELOPMENT_PLAN~~