fix(helpers): repair corrupted split_message and ensure content never None

Fix accidental line corruption in split_message() where 'break' was
merged with unrelated code during manual editing.

The actual fix: build_assistant_message() now returns content or ""
instead of content (which could be None), preventing providers like
MiMo V2 Omni from rejecting tool-call messages with missing text field.

Fixes #2519
This commit is contained in:
Alfredo Arenas 2026-04-02 09:03:19 -06:00 committed by Xubin Ren
parent 6d74c88014
commit 6445b3b0cf

View File

@ -252,7 +252,7 @@ def split_message(content: str, max_len: int = 2000) -> list[str]:
while content:
if len(content) <= max_len:
chunks.append(content)
breakmsg: dict[str, Any] = {"role": "assistant", "content": content}
break
cut = content[:max_len]
# Try to break at newline first, then space, then hard break
pos = cut.rfind('\n')