From 65269b59fd9bb4a4cdc20dbc953853b267ac03c8 Mon Sep 17 00:00:00 2001 From: Pratik Desai <94686836+Iampd2002@users.noreply.github.com> Date: Thu, 12 Oct 2023 16:25:35 +0530 Subject: [PATCH] Update AgentConvo.py --- pilot/helpers/AgentConvo.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pilot/helpers/AgentConvo.py b/pilot/helpers/AgentConvo.py index 68f11df71..d662eeef2 100644 --- a/pilot/helpers/AgentConvo.py +++ b/pilot/helpers/AgentConvo.py @@ -168,6 +168,9 @@ def replace_files(self): def replace_file_content(self, message, file_path, new_content): escaped_file_path = re.escape(file_path) + # Escape any \U in the file path + escaped_file_path = escaped_file_path.replace("\\U", "\\\\U") + pattern = rf'\*\*{{ {escaped_file_path} }}\*\*\n```\n(.*?)\n```' new_section_content = f'**{{ {file_path} }}**\n```\n{new_content}\n```'