mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-11 19:03:43 +08:00
fix: Improve OpenAI stream data parsing
This commit is contained in:
@@ -21,3 +21,11 @@ func ErrorWrapper(err error, code string, statusCode int) *model.ErrorWithStatus
|
||||
StatusCode: statusCode,
|
||||
}
|
||||
}
|
||||
|
||||
func NormalizeDataLine(data string) string {
|
||||
if strings.HasPrefix(data, "data:") {
|
||||
content := strings.TrimLeft(data[len("data:"):], " ")
|
||||
return "data: " + content
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user