chore: update impl
This commit is contained in:
parent
cb3d43768e
commit
9afcbf556e
@ -65,7 +65,7 @@ var ModelRatio = map[string]float64{
|
|||||||
"text-moderation-stable": 0.1,
|
"text-moderation-stable": 0.1,
|
||||||
"text-moderation-latest": 0.1,
|
"text-moderation-latest": 0.1,
|
||||||
"dall-e-2": 8, // $0.016 - $0.020 / image
|
"dall-e-2": 8, // $0.016 - $0.020 / image
|
||||||
"dall-e-3": 20, // ¥0.040 - ¥0.120 / image
|
"dall-e-3": 20, // $0.040 - $0.120 / image
|
||||||
"claude-instant-1": 0.815, // $1.63 / 1M tokens
|
"claude-instant-1": 0.815, // $1.63 / 1M tokens
|
||||||
"claude-2": 5.51, // $11.02 / 1M tokens
|
"claude-2": 5.51, // $11.02 / 1M tokens
|
||||||
"ERNIE-Bot": 0.8572, // ¥0.012 / 1k tokens
|
"ERNIE-Bot": 0.8572, // ¥0.012 / 1k tokens
|
||||||
|
@ -37,7 +37,6 @@ func relayImageHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode
|
|||||||
group := c.GetString("group")
|
group := c.GetString("group")
|
||||||
|
|
||||||
var imageRequest ImageRequest
|
var imageRequest ImageRequest
|
||||||
|
|
||||||
if consumeQuota {
|
if consumeQuota {
|
||||||
err := common.UnmarshalBodyReusable(c, &imageRequest)
|
err := common.UnmarshalBodyReusable(c, &imageRequest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -82,7 +81,7 @@ func relayImageHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode
|
|||||||
|
|
||||||
// Number of generated images validation
|
// Number of generated images validation
|
||||||
if isWithinRange(imageModel, imageRequest.N) == false {
|
if isWithinRange(imageModel, imageRequest.N) == false {
|
||||||
return errorWrapper(errors.New("invalud value of n"), "n_not_within_range", http.StatusBadRequest)
|
return errorWrapper(errors.New("invalid value of n"), "n_not_within_range", http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
// map model name
|
// map model name
|
||||||
|
@ -77,6 +77,7 @@ type TextRequest struct {
|
|||||||
//Stream bool `json:"stream"`
|
//Stream bool `json:"stream"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ImageRequest docs: https://platform.openai.com/docs/api-reference/images/create
|
||||||
type ImageRequest struct {
|
type ImageRequest struct {
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
Prompt string `json:"prompt" binding:"required"`
|
Prompt string `json:"prompt" binding:"required"`
|
||||||
@ -85,6 +86,7 @@ type ImageRequest struct {
|
|||||||
Quality string `json:"quality"`
|
Quality string `json:"quality"`
|
||||||
ResponseFormat string `json:"response_format"`
|
ResponseFormat string `json:"response_format"`
|
||||||
Style string `json:"style"`
|
Style string `json:"style"`
|
||||||
|
User string `json:"user"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AudioResponse struct {
|
type AudioResponse struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user