Skip to content

Commit 567738f

Browse files
xuyaqistCopilot
andauthored
Update sdk/nexent/core/agents/core_agent.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f4edb4d commit 567738f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

sdk/nexent/core/agents/core_agent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ def parse_code_blobs(text: str) -> str:
4646
ValueError: If no valid code block is found in the text.
4747
"""
4848
# Match standard python code blocks: ```python or ```py
49-
pattern = r"```(?:py|python)\s*\n(.*?)\n```"
49+
# Allow the closing fence to appear either on its own line or immediately
50+
# after the final code token.
51+
pattern = r"```(?:py|python)\s*\n(.*?)\n?```"
5052
matches = re.findall(pattern, text, re.DOTALL)
5153
if matches:
5254
return "\n\n".join(match.strip() for match in matches)

0 commit comments

Comments
 (0)