Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

fix error on accumulating final chat response

Jeffrey Morgan045b855db9dc
diff --git a/server/routes.go b/server/routes.go
index 3c3e77cc0..8821d9cf6 100644
--- a/server/routes.go
+++ b/server/routes.go
@@ -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 {