fix ollama stream response unmarshall error
fix ollama stream response body unmarshall error
This commit is contained in:
parent
c936198ac8
commit
3db8eb6de3
@ -119,7 +119,9 @@ func StreamHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusC
|
||||
|
||||
for scanner.Scan() {
|
||||
data := strings.TrimPrefix(scanner.Text(), "}")
|
||||
if !strings.HasSuffix(data, "}") {
|
||||
data = data + "}"
|
||||
}
|
||||
|
||||
var ollamaResponse ChatResponse
|
||||
err := json.Unmarshal([]byte(data), &ollamaResponse)
|
||||
|
Loading…
Reference in New Issue
Block a user