fix error on accumulating final chat response

This commit is contained in:
Jeffrey Morgan 2023-12-10 11:24:39 -05:00
parent 32064a0646
commit 045b855db9

View file

@ -1025,7 +1025,10 @@ func ChatHandler(c *gin.Context) {
for resp := range ch {
switch r := resp.(type) {
case api.ChatResponse:
sb.WriteString(r.Message.Content)
if r.Message != nil {
sb.WriteString(r.Message.Content)
}
final = r
case gin.H:
if errorMsg, ok := r["error"].(string); ok {