From 19d561a0f265e866479378a1064b1da79c799677 Mon Sep 17 00:00:00 2001 From: Joschka Braun Date: Wed, 3 May 2023 16:39:46 +0200 Subject: [PATCH] :bug: fix: pattern to extract --- src/options/generate/generator.py | 2 +- src/options/generate/templates_user.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/options/generate/generator.py b/src/options/generate/generator.py index 00f4a80..22fe0be 100644 --- a/src/options/generate/generator.py +++ b/src/options/generate/generator.py @@ -48,7 +48,7 @@ class Generator: def extract_content_from_result(self, plain_text, file_name, match_single_block=False, can_contain_code_block=True): optional_line_break = '\n' if can_contain_code_block else '' # the \n at the end makes sure that ``` within the generated code is not matched because it is not right before a line break - pattern = fr"\*?\*?{file_name}\*?\*?\n```(?:\w+\n)?([\s\S]*?){optional_line_break}```" + pattern = fr"^\*?\*?{file_name}\*?\*?\n```(?:\w+\n)?([\s\S]*?){optional_line_break}```" matches = re.findall(pattern, plain_text, re.MULTILINE) if matches: return matches[-1].strip() diff --git a/src/options/generate/templates_user.py b/src/options/generate/templates_user.py index c7412cc..9bb1f65 100644 --- a/src/options/generate/templates_user.py +++ b/src/options/generate/templates_user.py @@ -203,9 +203,9 @@ template_summarize_error = PromptTemplate.from_template( "{error}" Your task is to summarize the error message as compact and informative as possible \ while maintaining all information necessary to debug the core issue (100 words). +It should also provide some additional context regarding the specific file and line number where the error occurred. \ Note that you must not suggest a solution to the error. -Warnings are not worth mentioning. -Your response should be concise and informative, highlighting the core issue while omitting any warnings. It should also provide some additional context regarding the specific file and line number where the error occurred. The actual core error message should also be included.''' +Warnings are not worth mentioning.''' )