do not parse unused body
This commit is contained in:
@@ -4,23 +4,15 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Message struct {
|
|
||||||
Content string `json:"content"`
|
|
||||||
Role string `json:"role"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RequestBody struct {
|
type RequestBody struct {
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
Messages []Message `json:"messages"`
|
|
||||||
Stream bool `json:"stream"`
|
Stream bool `json:"stream"`
|
||||||
Temperature float64 `json:"temperature"`
|
|
||||||
TopP int64 `json:"top_p"`
|
|
||||||
PresencePenalty float64 `json:"presence_penalty"`
|
|
||||||
FrequencyPenalty float64 `json:"frequency_penalty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseRequestBody(data []byte) (RequestBody, error) {
|
func ParseRequestBody(data []byte) (RequestBody, error) {
|
||||||
ret := RequestBody{}
|
ret := RequestBody{
|
||||||
|
Stream: false,
|
||||||
|
}
|
||||||
|
|
||||||
var requestBody RequestBody
|
var requestBody RequestBody
|
||||||
err := json.Unmarshal(data, &requestBody)
|
err := json.Unmarshal(data, &requestBody)
|
||||||
|
|||||||
Reference in New Issue
Block a user