🐛 fix: Handle empty openaiResponse.Choices in HandlerChatStream

This commit is contained in:
Martial BE 2024-04-27 17:17:58 +08:00
parent 58a0b6f9bc
commit c6a0c87ad1
No known key found for this signature in database
GPG Key ID: D06C32DF0EDB9084

View File

@ -109,6 +109,11 @@ func (h *OpenAIStreamHandler) HandlerChatStream(rawLine *[]byte, dataChan chan s
return
}
if len(openaiResponse.Choices) == 0 {
*rawLine = nil
return
}
dataChan <- string(*rawLine)
if h.isAzure {