From 53107c668311b27250ba197fc8dc1590e32206d6 Mon Sep 17 00:00:00 2001 From: moranfong Date: Tue, 7 Apr 2026 23:12:10 +0800 Subject: [PATCH] fix(provider): support StepFun Plan API reasoning field fallback StepFun Plan API returns response content in the 'reasoning' field when the model is in thinking mode and 'content' is empty. OpenAICompatProvider previously only checked 'content' and 'reasoning_content', missing this field. This patch adds a fallback: if content is empty and 'reasoning' is present, extract text from reasoning to populate content, ensuring StepFun models (step-3.5-flash, step-3.5-flash-2603) work correctly with tool calls. Co-authored-by: moranfong --- nanobot/providers/openai_compat_provider.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nanobot/providers/openai_compat_provider.py b/nanobot/providers/openai_compat_provider.py index 706268585..f644628b6 100644 --- a/nanobot/providers/openai_compat_provider.py +++ b/nanobot/providers/openai_compat_provider.py @@ -455,6 +455,9 @@ class OpenAICompatProvider(LLMProvider): finish_reason = str(choice0.get("finish_reason") or "stop") raw_tool_calls: list[Any] = [] + # StepFun Plan: fallback to reasoning field when content is empty + if not content and msg0.get("reasoning"): + content = self._extract_text_content(msg0.get("reasoning")) reasoning_content = msg0.get("reasoning_content") for ch in choices: ch_map = self._maybe_mapping(ch) or {}