(text: str)
| 206 | |
| 207 | |
| 208 | def extract_code(text: str) -> str: |
| 209 | pattern = r'```([^\n]*)\n(.*?)```' |
| 210 | matches = re.findall(pattern, text, re.DOTALL) |
| 211 | return matches[-1][1] |
| 212 | |
| 213 | |
| 214 | # Append a conversation into history, while show it in a new markdown block |