mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
14 lines
388 B
Go
14 lines
388 B
Go
package handler
|
|
|
|
import "github.com/tidwall/gjson"
|
|
|
|
const invalidStreamFieldTypeMessage = "invalid stream field type"
|
|
|
|
func parseOpenAICompatibleStream(body []byte) (bool, bool) {
|
|
streamResult := gjson.GetBytes(body, "stream")
|
|
if streamResult.Exists() && streamResult.Type != gjson.True && streamResult.Type != gjson.False {
|
|
return false, false
|
|
}
|
|
return streamResult.Bool(), true
|
|
}
|