mirror of
https://github.com/coaidev/coai.git
synced 2025-05-19 21:10:18 +09:00
fix: filter empty chunk
This commit is contained in:
parent
6259937347
commit
e14fb02fb9
5
globals/method.go
Normal file
5
globals/method.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package globals
|
||||||
|
|
||||||
|
func (c *Chunk) IsEmpty() bool {
|
||||||
|
return len(c.Content) == 0 && c.ToolCall == nil && c.FunctionCall == nil
|
||||||
|
}
|
@ -198,7 +198,10 @@ func sendStreamTranshipmentResponse(c *gin.Context, form RelayForm, messages []g
|
|||||||
cache, buffer, group, getChatProps(form, messages, buffer, plan),
|
cache, buffer, group, getChatProps(form, messages, buffer, plan),
|
||||||
func(data *globals.Chunk) error {
|
func(data *globals.Chunk) error {
|
||||||
buffer.WriteChunk(data)
|
buffer.WriteChunk(data)
|
||||||
partial <- getStreamTranshipmentForm(id, created, form, data, buffer, false, nil)
|
|
||||||
|
if !data.IsEmpty() {
|
||||||
|
partial <- getStreamTranshipmentForm(id, created, form, data, buffer, false, nil)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user