terminate stream with "[DONE]" message

see
https://platform.openai.com/docs/api-reference/chat/create#chat/create-stream
This commit is contained in:
Robert Hambrock 2023-05-21 13:15:36 +02:00
parent eb5190fdab
commit e011328c4f
No known key found for this signature in database
GPG key ID: 9722A2F186201D91

View file

@ -360,6 +360,7 @@ func chatEndpoint(cm *ConfigMerger, debug bool, loader *model.ModelLoader, threa
respData, _ := json.Marshal(resp)
w.WriteString(fmt.Sprintf("data: %s\n\n", respData))
w.WriteString("data: [DONE]\n\n")
w.Flush()
}))
return nil