mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-06 08:18:58 +00:00
Handle signature_delta streaming event for Anthropic thinking blocks
The Anthropic streaming API sends thinking block signatures via a signature_delta event, not in content_block_start or content_block_stop. The parser was ignoring this event type, falling back to the empty placeholder signature from content_block_start, causing "Invalid signature in thinking block" errors on multi-turn conversations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9342b5be76
commit
6071bb0aa7
1 changed files with 13 additions and 0 deletions
|
|
@ -800,6 +800,19 @@ impl StreamAccumulator {
|
|||
delta: thinking.to_string(),
|
||||
}]
|
||||
}
|
||||
"signature_delta" => {
|
||||
let signature = delta
|
||||
.and_then(|d| d.get("signature"))
|
||||
.and_then(serde_json::Value::as_str)
|
||||
.map(String::from);
|
||||
if let Some(ContentBlockKind::Thinking {
|
||||
signature: ref mut sig,
|
||||
}) = self.current_block
|
||||
{
|
||||
*sig = signature;
|
||||
}
|
||||
vec![]
|
||||
}
|
||||
_ => vec![],
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue