fix: show follow-up suggestions when the task model adds text around its JSON (#32323)

This commit is contained in:
G30 2026-10-13 08:46:17 -04:00 • committed by GitHub
parent 99a9f60b9f
commit 1c5f101d0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -348,7 +348,7 @@ async def follow_up_generation_template(
def parse_follow_ups(content: str, max_count: int = 5) -> list[str]:
if not isinstance(content, str):
return []
content = re.sub(r'^```(?:json)?\s*|\s*```$', '', content.strip())
content = content[content.find('{') : content.rfind('}') + 1]
try:
data = JSONCodec.loads(content)
except (ValueError, TypeError):