refactor(workflow): Move the plugin component in the Workflow package into the common crossdomain package (#717)
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/repo/dal/model"
|
||||
@@ -51,21 +52,21 @@ func (e *executeHistoryStoreImpl) CreateWorkflowExecution(ctx context.Context, e
|
||||
}()
|
||||
|
||||
var mode int32
|
||||
if execution.Mode == vo.ExecuteModeDebug {
|
||||
if execution.Mode == plugin.ExecuteModeDebug {
|
||||
mode = 1
|
||||
} else if execution.Mode == vo.ExecuteModeRelease {
|
||||
} else if execution.Mode == plugin.ExecuteModeRelease {
|
||||
mode = 2
|
||||
} else if execution.Mode == vo.ExecuteModeNodeDebug {
|
||||
} else if execution.Mode == plugin.ExecuteModeNodeDebug {
|
||||
mode = 3
|
||||
}
|
||||
|
||||
var syncPattern int32
|
||||
switch execution.SyncPattern {
|
||||
case vo.SyncPatternSync:
|
||||
case plugin.SyncPatternSync:
|
||||
syncPattern = 1
|
||||
case vo.SyncPatternAsync:
|
||||
case plugin.SyncPatternAsync:
|
||||
syncPattern = 2
|
||||
case vo.SyncPatternStream:
|
||||
case plugin.SyncPatternStream:
|
||||
syncPattern = 3
|
||||
default:
|
||||
}
|
||||
@@ -211,23 +212,23 @@ func (e *executeHistoryStoreImpl) GetWorkflowExecution(ctx context.Context, id i
|
||||
}
|
||||
|
||||
rootExe := rootExes[0]
|
||||
var exeMode vo.ExecuteMode
|
||||
var exeMode plugin.ExecuteMode
|
||||
if rootExe.Mode == 1 {
|
||||
exeMode = vo.ExecuteModeDebug
|
||||
exeMode = plugin.ExecuteModeDebug
|
||||
} else if rootExe.Mode == 2 {
|
||||
exeMode = vo.ExecuteModeRelease
|
||||
exeMode = plugin.ExecuteModeRelease
|
||||
} else {
|
||||
exeMode = vo.ExecuteModeNodeDebug
|
||||
exeMode = plugin.ExecuteModeNodeDebug
|
||||
}
|
||||
|
||||
var syncPattern vo.SyncPattern
|
||||
var syncPattern plugin.SyncPattern
|
||||
switch rootExe.SyncPattern {
|
||||
case 1:
|
||||
syncPattern = vo.SyncPatternSync
|
||||
syncPattern = plugin.SyncPatternSync
|
||||
case 2:
|
||||
syncPattern = vo.SyncPatternAsync
|
||||
syncPattern = plugin.SyncPatternAsync
|
||||
case 3:
|
||||
syncPattern = vo.SyncPatternStream
|
||||
syncPattern = plugin.SyncPatternStream
|
||||
default:
|
||||
}
|
||||
|
||||
@@ -236,7 +237,7 @@ func (e *executeHistoryStoreImpl) GetWorkflowExecution(ctx context.Context, id i
|
||||
WorkflowID: rootExe.WorkflowID,
|
||||
Version: rootExe.Version,
|
||||
SpaceID: rootExe.SpaceID,
|
||||
ExecuteConfig: vo.ExecuteConfig{
|
||||
ExecuteConfig: plugin.ExecuteConfig{
|
||||
Operator: rootExe.OperatorID,
|
||||
Mode: exeMode,
|
||||
AppID: ternary.IFElse(rootExe.AppID > 0, ptr.Of(rootExe.AppID), nil),
|
||||
|
||||
@@ -30,6 +30,7 @@ import (
|
||||
"gorm.io/gen/field"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
|
||||
workflow3 "github.com/coze-dev/coze-studio/backend/api/model/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/application/base/ctxutil"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow"
|
||||
@@ -536,7 +537,7 @@ func (r *RepositoryImpl) GetEntity(ctx context.Context, policy *vo.GetPolicy) (_
|
||||
commitID string
|
||||
)
|
||||
switch policy.QType {
|
||||
case vo.FromDraft:
|
||||
case plugin.FromDraft:
|
||||
draft, err := r.DraftV2(ctx, policy.ID, policy.CommitID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -547,7 +548,7 @@ func (r *RepositoryImpl) GetEntity(ctx context.Context, policy *vo.GetPolicy) (_
|
||||
outputParams = draft.OutputParamsStr
|
||||
draftMeta = draft.DraftMeta
|
||||
commitID = draft.CommitID
|
||||
case vo.FromSpecificVersion:
|
||||
case plugin.FromSpecificVersion:
|
||||
v, err := r.GetVersion(ctx, policy.ID, policy.Version)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -557,7 +558,7 @@ func (r *RepositoryImpl) GetEntity(ctx context.Context, policy *vo.GetPolicy) (_
|
||||
outputParams = v.OutputParamsStr
|
||||
versionMeta = v.VersionMeta
|
||||
commitID = v.CommitID
|
||||
case vo.FromLatestVersion:
|
||||
case plugin.FromLatestVersion:
|
||||
v, err := r.GetLatestVersion(ctx, policy.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -1410,7 +1411,7 @@ func (r *RepositoryImpl) WorkflowAsTool(ctx context.Context, policy vo.GetPolicy
|
||||
), nil
|
||||
}
|
||||
|
||||
func (r *RepositoryImpl) CopyWorkflow(ctx context.Context, workflowID int64, policy vo.CopyWorkflowPolicy) (
|
||||
func (r *RepositoryImpl) CopyWorkflow(ctx context.Context, workflowID int64, policy plugin.CopyWorkflowPolicy) (
|
||||
_ *entity.Workflow, err error) {
|
||||
const (
|
||||
copyWorkflowRedisKeyPrefix = "copy_workflow_redis_key_prefix"
|
||||
|
||||
Reference in New Issue
Block a user