(text: str)
| 44 | |
| 45 | |
| 46 | def extract_code(text: str) -> str: |
| 47 | pattern = r'```([^\n]*)\n(.*?)```' |
| 48 | matches = re.findall(pattern, text, re.DOTALL) |
| 49 | print(matches) |
| 50 | return matches[-1][1] |
| 51 | |
| 52 | |
| 53 | # Append a conversation into history, while show it in a new markdown block |