Fix extracting source file with type specification.

This commit is contained in:
Oleksandr Kozachuk 2023-09-09 11:53:32 +02:00
parent ed567afbea
commit 3ef1339cc0

View File

@ -55,9 +55,10 @@ def message_to_chat(message: dict[str, str],
def display_source_code(content: str) -> None:
try:
content_start = content.index('```')
content_start = content.index('\n', content_start) + 1
content_end = content.rindex('```')
if content_start + 3 < content_end:
print(content[content_start + 3:content_end].strip())
if content_start < content_end:
print(content[content_start:content_end].strip())
except ValueError:
pass