From 07b86bb95bb2305dbfe95375ddbd6b790bfb6d87 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Tue, 18 Jul 2023 18:54:00 +0800 Subject: [PATCH] fix --- record.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/record.go b/record.go index 53e5da6..b0cdff8 100644 --- a/record.go +++ b/record.go @@ -65,8 +65,8 @@ func recordAssistantResponse(contentType string, db *gorm.DB, trackID uuid.UUID, // stream mode if strings.HasPrefix(contentType, "text/event-stream") { resp := string(body) - var chunk StreamModeChunk for _, line := range strings.Split(resp, "\n") { + chunk := StreamModeChunk{} line = strings.TrimPrefix(line, "data:") line = strings.TrimSpace(line) if line == "" {