From e875709147a2df1c57cc7611b64f77267c38f670 Mon Sep 17 00:00:00 2001 From: LIghtJUNction Date: Wed, 29 Apr 2026 07:10:45 +0800 Subject: [PATCH] fix: reasoning_content None guard in openai_source think part parsing --- astrbot/core/provider/sources/openai_source.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/astrbot/core/provider/sources/openai_source.py b/astrbot/core/provider/sources/openai_source.py index 6e79cba61..83e696b91 100644 --- a/astrbot/core/provider/sources/openai_source.py +++ b/astrbot/core/provider/sources/openai_source.py @@ -1012,7 +1012,9 @@ class ProviderOpenAIOfficial(Provider): for part in message["content"]: if part.get("type") == "think": reasoning_content_present = True - reasoning_content += str(part.get("think")) + reasoning_content = (reasoning_content or "") + str( + part.get("think") + ) else: new_content.append(part) # Some providers (Grok, etc.) reject empty content lists.