mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-20 00:18:55 +00:00
fix(antigravity): exclude Signature-only events from meaningful data check
MALFORMED_FUNCTION_CALL responses from upstream contain only thoughtSignature without any text, thinking, or tool calls. The previous fix still treated delta.Signature and block.Signature as meaningful data, so the empty-stream failover was never triggered. - Remove Signature from isMeaningfulAntigravityCompatEvent checks - Let hasMeaningfulData() also consult processor.HasContent() as a secondary guard for edge cases
This commit is contained in:
@@ -141,7 +141,7 @@ func (s *antigravityCompatStreamSession) consume(line string) {
|
||||
}
|
||||
|
||||
func (s *antigravityCompatStreamSession) hasMeaningfulData() bool {
|
||||
return s.meaningfulData
|
||||
return s.meaningfulData || s.processor.HasContent()
|
||||
}
|
||||
|
||||
func (s *antigravityCompatStreamSession) finish() (*antigravityStreamResult, error) {
|
||||
@@ -223,23 +223,18 @@ func isMeaningfulAntigravityCompatEvent(event *apicompat.AnthropicStreamEvent) b
|
||||
if event == nil {
|
||||
return false
|
||||
}
|
||||
if event.Type == "message_stop" {
|
||||
return true
|
||||
}
|
||||
if event.ContentBlock != nil {
|
||||
block := event.ContentBlock
|
||||
return block.Type == "tool_use" ||
|
||||
block.Text != "" ||
|
||||
block.Thinking != "" ||
|
||||
block.Signature != "" ||
|
||||
block.Source != nil
|
||||
}
|
||||
if event.Delta != nil {
|
||||
delta := event.Delta
|
||||
return delta.Text != "" ||
|
||||
delta.PartialJSON != "" ||
|
||||
delta.Thinking != "" ||
|
||||
delta.Signature != ""
|
||||
delta.Thinking != ""
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user