fix(canvas): 生成任务 - 校验视频提示词长度并修复工作流产物ID与供应商错误识别
This commit is contained in:
1 parent
7fa10a5697
commit
246ca14ef5
10 files changed
+199
-16
No files matched your search
@@ -344,6 +344,9 @@ func (s *Service) processCanvasGenerationTask(ctx context.Context, userID string
|
||||
if err := s.RequireWorkflowPluginForInterface(input.Config.InterfaceType); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := validateWorkflowProviderPromptLength(input); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := validateWorkflowProviderConfig(input.Mode, input.Config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -4950,8 +4953,7 @@ func doJSON(req *http.Request, target interface{}) error {
|
||||
}
|
||||
}
|
||||
if payload, ok := target.(*map[string]interface{}); ok {
|
||||
if code, ok := (*payload)["code"].(float64); ok && code != 0 {
|
||||
rawMessage := stringField(*payload, "msg")
|
||||
if _, rawMessage, failed := providerPayloadBusinessFailure(*payload); failed {
|
||||
return providerPayloadError{raw: rawMessage, message: providerPayloadErrorMessage(rawMessage)}
|
||||
}
|
||||
if errValue, ok := (*payload)["error"].(map[string]interface{}); ok && stringField(errValue, "message") != "" {
|
||||
@@ -5138,12 +5140,16 @@ func recordProviderRequest(req *http.Request, startedAt time.Time, statusCode in
|
||||
if requestErr != nil || statusCode < 200 || statusCode >= 300 {
|
||||
status = model.ApiCallStatusFailed
|
||||
errorCode, errorText = providerRequestErrorDetails(requestErr)
|
||||
} else if businessCode, businessMessage, failed := providerResponseBusinessFailure(responseBody); failed {
|
||||
status = model.ApiCallStatusFailed
|
||||
errorCode = businessCode
|
||||
errorText = businessMessage
|
||||
}
|
||||
requestKind := providerRequestKind(req.Method, req.URL.Path)
|
||||
if metadata.RequestKind != "" {
|
||||
requestKind = metadata.RequestKind
|
||||
}
|
||||
if requestErr == nil && statusCode >= 200 && statusCode < 300 && (requestKind == "create" || requestKind == "poll") && (metadata.Capability == "image" || metadata.Capability == "video") {
|
||||
if status == model.ApiCallStatusSucceeded && (requestKind == "create" || requestKind == "poll") && (metadata.Capability == "image" || metadata.Capability == "video") {
|
||||
metadata.Service.syncProviderTaskProgress(metadata.TaskID, responseBody)
|
||||
}
|
||||
apiFormat := "openai"
|
||||
|
||||
Reference in new issue
Block a user