From 57a8700825e4a0ed28f15b70635a74ccbd913ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Ahlb=C3=A4ck?= Date: Sun, 18 Jun 2023 14:54:04 +0200 Subject: [PATCH] fix to_files --- gpt_engineer/chat_to_files.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gpt_engineer/chat_to_files.py b/gpt_engineer/chat_to_files.py index ec6b755..9a7f8de 100644 --- a/gpt_engineer/chat_to_files.py +++ b/gpt_engineer/chat_to_files.py @@ -1,6 +1,5 @@ import re - def parse_chat(chat): # -> List[Tuple[str, str]]: # Split the chat into sections by the "*CODEBLOCKSBELOW*" token split_chat = chat.split("*CODEBLOCKSBELOW*") @@ -15,7 +14,7 @@ def parse_chat(chat): # -> List[Tuple[str, str]]: code_blocks = split_chat[1] if is_token_found else chat # Get all ``` blocks and preceding filenames - regex = r"\[(.*?)\]\s*```.*?\n(.*?)```" + regex = r"(\S+?)\n```\S+\n(.+?)```" matches = re.finditer(regex, code_blocks, re.DOTALL) files = []