Improved data process logic

This commit is contained in:
MotorBottle 2024-07-26 17:41:19 -04:00 committed by GitHub
parent f655976994
commit 816f5fc9f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -121,6 +121,9 @@ func StreamHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusC
for scanner.Scan() {
data := scanner.Text()
if strings.HasPrefix(data, "}") {
data = strings.TrimPrefix(data, "}") + "}"
}
var ollamaResponse ChatResponse
err := json.Unmarshal([]byte(data), &ollamaResponse)