fix(canvas): 生成任务 - 校验视频提示词长度并修复工作流产物ID与供应商错误识别
This commit is contained in:
1 parent
7fa10a5697
commit
246ca14ef5
10 files changed
+199
-16
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
@@ -590,8 +592,8 @@ func (s *Service) ensureGeneratedProjectAsset(task model.Task, projectID string,
|
||||
return "", err
|
||||
}
|
||||
now := time.Now()
|
||||
assetID := "workflow-asset-" + task.ID
|
||||
versionID := "workflow-version-" + task.ID
|
||||
assetID := workflowGeneratedEntityID("asset", task.ID)
|
||||
versionID := workflowGeneratedEntityID("version", task.ID)
|
||||
label := "图片"
|
||||
if mediaType == "video" {
|
||||
label = "视频"
|
||||
@@ -627,6 +629,12 @@ func (s *Service) ensureGeneratedProjectAsset(task model.Task, projectID string,
|
||||
return versionID, nil
|
||||
}
|
||||
|
||||
// 工作流产物重试必须复用同一实体 ID,同时需要满足素材版本及外键的 varchar(36) 约束。
|
||||
func workflowGeneratedEntityID(namespace string, taskID string) string {
|
||||
sum := sha256.Sum256([]byte(strings.TrimSpace(namespace) + ":" + strings.TrimSpace(taskID)))
|
||||
return hex.EncodeToString(sum[:16])
|
||||
}
|
||||
|
||||
func validWorkflowStepStatus(status model.WorkflowStepStatus) bool {
|
||||
switch status {
|
||||
case model.WorkflowStepStatusPending, model.WorkflowStepStatusReady, model.WorkflowStepStatusRunning, model.WorkflowStepStatusReview, model.WorkflowStepStatusCompleted, model.WorkflowStepStatusFailed, model.WorkflowStepStatusSkipped:
|
||||
|
||||
Reference in new issue
Block a user