fix chunk merge bug in ai-search (#1895)

This commit is contained in:
澄潭
2025-03-14 21:52:49 +08:00
committed by GitHub
parent 5e7e20ff7e
commit f09e029a6b

View File

@@ -572,10 +572,8 @@ func onStreamingResponseBody(ctx wrapper.HttpContext, config Config, chunk []byt
} else {
ctx.SetContext(PARTIAL_MESSAGE_CONTEXT_KEY, nil)
}
if len(newMessages) == 1 {
return []byte(fmt.Sprintf("%s\n\n", newMessages[0]))
} else if len(newMessages) > 1 {
return []byte(strings.Join(newMessages, "\n\n"))
if len(newMessages) > 0 {
return []byte(fmt.Sprintf("%s\n\n", strings.Join(newMessages, "\n\n")))
} else {
return []byte("")
}