Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion astrbot/core/provider/sources/openai_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,21 @@ def _finally_convert_payload(self, payloads: dict):
):
reasoning_content = ""
new_content = [] # not including think part
text_parts = []
has_non_text = False
for part in message["content"]:
if part.get("type") == "think":
reasoning_content += str(part.get("think"))
else:
new_content.append(part)
message["content"] = new_content
if part.get("type") == "text":
text_parts.append(str(part.get("text", "")))
else:
has_non_text = True
if not has_non_text:
message["content"] = "".join(text_parts)
else:
message["content"] = new_content
# reasoning key is "reasoning_content"
if reasoning_content:
message["reasoning_content"] = reasoning_content
Expand Down