🐛 fix: pattern to extract

This commit is contained in:
Joschka Braun
2023-05-03 16:39:46 +02:00
parent e8e6bea087
commit 19d561a0f2
2 changed files with 3 additions and 3 deletions

View File

@@ -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()

View File

@@ -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.'''
)