|
|
@@ -55,6 +55,15 @@ type MidjourneyWithoutStatus struct {
|
|
|
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) {
|
|
|
taskId := c.Param("id")
|
|
|
midjourneyTask := model.GetByOnlyMJId(taskId)
|
|
|
@@ -382,8 +391,16 @@ func relayMidjourneySubmit(c *gin.Context, relayMode int) *MidjourneyResponse {
|
|
|
} else {
|
|
|
requestBody = c.Request.Body
|
|
|
}
|
|
|
-
|
|
|
- modelPrice := common.GetModelPrice("mj_" + strings.ToLower(action))
|
|
|
+ mjAction := "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)
|
|
|
ratio := modelPrice * groupRatio
|
|
|
userQuota, err := model.CacheGetUserQuota(userId)
|