fix: handle null response in LLM and improve JSON parsing in agent (#13187)

Fixes AttributeError in _remove_reasoning_content() when LLM returns
None, and improves JSON parsing regex for markdown code fences in
agent_with_tools.py
This commit is contained in:
tuandang-diag
2026-02-24 12:15:09 +07:00
committed by GitHub
parent 67befc9119
commit d89ad8b79d
2 changed files with 6 additions and 1 deletions

View File

@ -265,6 +265,8 @@ class LLMBundle(LLM4Tenant):
generation.end()
def _remove_reasoning_content(self, txt: str) -> str:
if txt is None:
return None
first_think_start = txt.find("<think>")
if first_think_start == -1:
return txt