Merge pull request #947 from trheyi/main

fix: Improve result handling in Assistant API streamChat method
This commit is contained in:
Max 2025-05-09 12:09:47 +08:00 committed by GitHub
commit 6599a24ffb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -591,11 +591,17 @@ func (ast *Assistant) streamChat(
}
// has result
if res != nil && res.Result != nil && cb != nil {
if res != nil && res.Result != nil {
output.SetResult(res.Result)
if cb != nil {
output.Callback(cb).Write(c.Writer)
return 0 // break
}
// Send the result to the client
output.Write(c.Writer)
return 0 // break
}
output.Callback(cb).Write(c.Writer)
return 0 // break
}