mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-05 05:39:11 +00:00
Make generated code block extractor less strict to improve code tool
This commit is contained in:
@@ -161,7 +161,7 @@ async def generate_python_code(
|
||||
)
|
||||
|
||||
# Extract python code wrapped in markdown code blocks from the response
|
||||
code_blocks = re.findall(r"```(?:python)?\n(.*?)\n```", response, re.DOTALL)
|
||||
code_blocks = re.findall(r"```(?:python)?\n(.*?)```", response, re.DOTALL)
|
||||
|
||||
if not code_blocks:
|
||||
raise ValueError("No Python code blocks found in response")
|
||||
|
||||
Reference in New Issue
Block a user