mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-04-10 21:23:39 +00:00
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:
parent
6d74c88014
commit
6445b3b0cf
@ -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')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user