mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-22 10:16:36 +08:00
修复mj计费问题
This commit is contained in:
parent
290fed3841
commit
b3fc335908
@ -55,6 +55,15 @@ type MidjourneyWithoutStatus struct {
|
|||||||
ChannelId int `json:"channel_id"`
|
ChannelId int `json:"channel_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var DefaultModelPrice = map[string]float64{
|
||||||
|
"mj_imagine": 0.1,
|
||||||
|
"mj_variation": 0.1,
|
||||||
|
"mj_reroll": 0.1,
|
||||||
|
"mj_blend": 0.1,
|
||||||
|
"mj_describe": 0.05,
|
||||||
|
"mj_upscale": 0.05,
|
||||||
|
}
|
||||||
|
|
||||||
func RelayMidjourneyImage(c *gin.Context) {
|
func RelayMidjourneyImage(c *gin.Context) {
|
||||||
taskId := c.Param("id")
|
taskId := c.Param("id")
|
||||||
midjourneyTask := model.GetByOnlyMJId(taskId)
|
midjourneyTask := model.GetByOnlyMJId(taskId)
|
||||||
@ -382,8 +391,16 @@ func relayMidjourneySubmit(c *gin.Context, relayMode int) *MidjourneyResponse {
|
|||||||
} else {
|
} else {
|
||||||
requestBody = c.Request.Body
|
requestBody = c.Request.Body
|
||||||
}
|
}
|
||||||
|
mjAction := "mj_" + strings.ToLower(action)
|
||||||
modelPrice := common.GetModelPrice("mj_" + strings.ToLower(action))
|
modelPrice := common.GetModelPrice(mjAction)
|
||||||
|
if modelPrice == -1 {
|
||||||
|
defaultPrice, ok := DefaultModelPrice[mjAction]
|
||||||
|
if !ok {
|
||||||
|
modelPrice = 0.1
|
||||||
|
} else {
|
||||||
|
modelPrice = defaultPrice
|
||||||
|
}
|
||||||
|
}
|
||||||
groupRatio := common.GetGroupRatio(group)
|
groupRatio := common.GetGroupRatio(group)
|
||||||
ratio := modelPrice * groupRatio
|
ratio := modelPrice * groupRatio
|
||||||
userQuota, err := model.CacheGetUserQuota(userId)
|
userQuota, err := model.CacheGetUserQuota(userId)
|
||||||
|
Loading…
Reference in New Issue
Block a user