fix: reasoning_content None guard in openai_source think part parsing

This commit is contained in:
LIghtJUNction
2026-04-29 07:10:45 +08:00
parent c7cfb81756
commit e875709147

View File

@@ -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.