mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2026-01-20 22:14:20 +01:00
⭐ fix: content extraction
This commit is contained in:
@@ -46,7 +46,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()
|
||||
|
||||
Reference in New Issue
Block a user