Drop whitespace-only content nodes from parser output
Content between tags (e.g. newlines between </think> and <tool_call>) was creating empty Content nodes. Now trimmed before creating the node. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
1b6664ee1c
commit
01bbc39a31
1 changed files with 1 additions and 1 deletions
|
|
@ -623,7 +623,7 @@ impl ResponseParser {
|
|||
fn flush_content(&mut self, ctx: &mut ContextState) {
|
||||
if !self.content_parts.is_empty() {
|
||||
let text: String = self.content_parts.drain(..).collect();
|
||||
if !text.is_empty() {
|
||||
if !text.trim().is_empty() {
|
||||
self.push_child(ctx, AstNode::content(text));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue