diff --git a/controller/relay-audio.go b/controller/relay-audio.go index 277ab404..fb6b3668 100644 --- a/controller/relay-audio.go +++ b/controller/relay-audio.go @@ -106,7 +106,7 @@ func relayAudioHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode if quota != 0 { tokenName := c.GetString("token_name") logContent := fmt.Sprintf("模型倍率 %.2f,分组倍率 %.2f", modelRatio, groupRatio) - model.RecordConsumeLog(userId, 0, 0, audioModel, tokenName, quota, logContent) + model.RecordConsumeLog(userId, 0, 0, audioModel, tokenName, quota, logContent, tokenId) model.UpdateUserUsedQuotaAndRequestCount(userId, quota) channelId := c.GetInt("channel_id") model.UpdateChannelUsedQuota(channelId, quota) diff --git a/controller/relay.go b/controller/relay.go index 14da0ae7..75be7a90 100644 --- a/controller/relay.go +++ b/controller/relay.go @@ -2,6 +2,7 @@ package controller import ( "fmt" + "log" "net/http" "one-api/common" "strconv" @@ -171,6 +172,23 @@ type CompletionsStreamResponse struct { } `json:"choices"` } +type MidjourneyRequest struct { + Prompt string `json:"prompt"` + NotifyHook string `json:"notifyHook"` + Action string `json:"action"` + Index int `json:"index"` + State string `json:"state"` + TaskId string `json:"taskId"` + Base64Array []string `json:"base64Array"` +} + +type MidjourneyResponse struct { + Code int `json:"code"` + Description string `json:"description"` + Properties interface{} `json:"properties"` + Result string `json:"result"` +} + func Relay(c *gin.Context) { relayMode := RelayModeUnknown if strings.HasPrefix(c.Request.URL.Path, "/v1/chat/completions") { diff --git a/middleware/distributor.go b/middleware/distributor.go index b962e433..d862e9d2 100644 --- a/middleware/distributor.go +++ b/middleware/distributor.go @@ -2,6 +2,7 @@ package middleware import ( "fmt" + "log" "net/http" "one-api/common" "one-api/model" @@ -96,7 +97,7 @@ func Distribute() func(c *gin.Context) { modelRequest.Model = "whisper-1" } } - channel, err = model.CacheGetRandomSatisfiedChannel(userGroup, modelRequest.Model) + channel, err := model.CacheGetRandomSatisfiedChannel(userGroup, modelRequest.Model) if err != nil { message := fmt.Sprintf("当前分组 %s 下对于模型 %s 无可用渠道", userGroup, modelRequest.Model) if channel != nil {