|
|
@@ -135,17 +135,14 @@ func getModelRequest(c *gin.Context) (*ModelRequest, bool, error) {
|
|
|
midjourneyRequest := dto.MidjourneyRequest{}
|
|
|
err = common.UnmarshalBodyReusable(c, &midjourneyRequest)
|
|
|
if err != nil {
|
|
|
- abortWithMidjourneyMessage(c, http.StatusBadRequest, constant.MjErrorUnknown, "无效的请求, "+err.Error())
|
|
|
return nil, false, err
|
|
|
}
|
|
|
midjourneyModel, mjErr, success := service.GetMjRequestModel(relayMode, &midjourneyRequest)
|
|
|
if mjErr != nil {
|
|
|
- abortWithMidjourneyMessage(c, http.StatusBadRequest, mjErr.Code, mjErr.Description)
|
|
|
return nil, false, fmt.Errorf(mjErr.Description)
|
|
|
}
|
|
|
if midjourneyModel == "" {
|
|
|
if !success {
|
|
|
- abortWithMidjourneyMessage(c, http.StatusBadRequest, constant.MjErrorUnknown, "无效的请求, 无法解析模型")
|
|
|
return nil, false, fmt.Errorf("无效的请求, 无法解析模型")
|
|
|
} else {
|
|
|
// task fetch, task fetch by condition, notify
|
|
|
@@ -170,7 +167,6 @@ func getModelRequest(c *gin.Context) (*ModelRequest, bool, error) {
|
|
|
err = common.UnmarshalBodyReusable(c, &modelRequest)
|
|
|
}
|
|
|
if err != nil {
|
|
|
- abortWithOpenAiMessage(c, http.StatusBadRequest, "无效的请求, "+err.Error())
|
|
|
return nil, false, errors.New("无效的请求, " + err.Error())
|
|
|
}
|
|
|
if strings.HasPrefix(c.Request.URL.Path, "/v1/realtime") {
|