Fix: agent toolcall null response & schema validation & DeepSeek think history (#14425)

### What problem does this PR solve?
agent toolcall null response & schema validation & DeepSeek think
history

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
buua436
2026-04-28 17:09:08 +08:00
committed by GitHub
parent f670913bb4
commit e6e80041f5
3 changed files with 59 additions and 25 deletions

View File

@@ -67,6 +67,19 @@ class LLMToolPluginCallSession(ToolCallSession):
else:
resp = await thread_pool_exec(tool_obj.invoke, **arguments)
if resp is None and hasattr(tool_obj, "output") and callable(tool_obj.output):
try:
fallback_output = tool_obj.output()
if isinstance(fallback_output, dict) and fallback_output.get("content") not in (None, ""):
resp = fallback_output["content"]
elif fallback_output not in (None, ""):
resp = fallback_output
else:
resp = fallback_output
logging.warning(f"[ToolCall] resp is None, fallback to output name={name} output_keys={list(fallback_output.keys()) if isinstance(fallback_output, dict) else type(fallback_output).__name__}")
except Exception as e:
logging.warning(f"[ToolCall] resp is None and output fallback failed name={name} err={e}")
elapsed = timer() - st
logging.info(f"[ToolCall] done name={name} elapsed={elapsed:.2f}s result={str(resp)[:200]}")
self.callback(name, arguments, resp, elapsed_time=elapsed)