refactor(workflow): Move the plugin component in the Workflow package into the common crossdomain package (#717)

This commit is contained in:
Ryo
2025-08-13 11:06:53 +08:00
committed by GitHub
parent b38ab95623
commit 99c759addc
47 changed files with 1330 additions and 1407 deletions

View File

@@ -27,6 +27,7 @@ import (
"github.com/bytedance/sonic"
"github.com/cloudwego/eino/schema"
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
"github.com/coze-dev/coze-studio/backend/domain/workflow"
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity"
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
@@ -63,7 +64,7 @@ func setRootWorkflowSuccess(ctx context.Context, event *Event, repo workflow.Rep
rootWkID := event.RootWorkflowBasic.ID
exeCfg := event.ExeCfg
if exeCfg.Mode == vo.ExecuteModeDebug {
if exeCfg.Mode == plugin.ExecuteModeDebug {
if err := repo.UpdateWorkflowDraftTestRunSuccess(ctx, rootWkID); err != nil {
return fmt.Errorf("failed to save workflow draft test run success: %v", err)
}
@@ -725,7 +726,7 @@ func HandleExecuteEvent(ctx context.Context,
timeoutFn context.CancelFunc,
repo workflow.Repository,
sw *schema.StreamWriter[*entity.Message],
exeCfg vo.ExecuteConfig,
exeCfg plugin.ExecuteConfig,
) (event *Event) {
var (
wfSuccessEvent *Event
@@ -760,7 +761,7 @@ func HandleExecuteEvent(ctx context.Context,
return event
case workflowSuccess: // workflow success, wait for exit node to be done
wfSuccessEvent = event
if lastNodeIsDone || exeCfg.Mode == vo.ExecuteModeNodeDebug {
if lastNodeIsDone || exeCfg.Mode == plugin.ExecuteModeNodeDebug {
if err = setRootWorkflowSuccess(ctx, wfSuccessEvent, repo, sw); err != nil {
logs.CtxErrorf(ctx, "failed to set root workflow success for workflow %d: %v",
wfSuccessEvent.RootWorkflowBasic.ID, err)