refactor(workflow): Move domain resources events into the application layer (#729)

This commit is contained in:
Ryo
2025-08-13 21:06:56 +08:00
committed by GitHub
parent 8c3ae99643
commit 5d98e8ef93
47 changed files with 661 additions and 761 deletions

View File

@@ -26,7 +26,7 @@ import (
"github.com/cloudwego/eino/compose"
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/database"
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
workflowModel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/workflow"
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/execute"
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes"
@@ -413,7 +413,7 @@ func isDebugExecute(ctx context.Context) bool {
if execCtx == nil {
panic(fmt.Errorf("unable to get exe context"))
}
return execCtx.RootCtx.ExeCfg.Mode == plugin.ExecuteModeDebug || execCtx.RootCtx.ExeCfg.Mode == plugin.ExecuteModeNodeDebug
return execCtx.RootCtx.ExeCfg.Mode == workflowModel.ExecuteModeDebug || execCtx.RootCtx.ExeCfg.Mode == workflowModel.ExecuteModeNodeDebug
}
func getExecUserID(ctx context.Context) string {

View File

@@ -25,7 +25,7 @@ import (
"go.uber.org/mock/gomock"
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/database"
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
workflowModel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/workflow"
crossdatabase "github.com/coze-dev/coze-studio/backend/crossdomain/contract/database"
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/database/databasemock"
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
@@ -72,10 +72,10 @@ func TestCustomSQL_Execute(t *testing.T) {
defer mockey.Mock(execute.GetExeCtx).Return(&execute.Context{
RootCtx: execute.RootCtx{
ExeCfg: plugin.ExecuteConfig{
Mode: plugin.ExecuteModeDebug,
ExeCfg: workflowModel.ExecuteConfig{
Mode: workflowModel.ExecuteModeDebug,
Operator: 123,
BizType: plugin.BizTypeWorkflow,
BizType: workflowModel.BizTypeWorkflow,
},
},
}).Build().UnPatch()

View File

@@ -27,7 +27,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/database"
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
workflowModel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/workflow"
crossdatabase "github.com/coze-dev/coze-studio/backend/crossdomain/contract/database"
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/database/databasemock"
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
@@ -57,10 +57,10 @@ func (m *mockDsSelect) Query() func(ctx context.Context, request *database.Query
func TestDataset_Query(t *testing.T) {
defer mockey.Mock(execute.GetExeCtx).Return(&execute.Context{
RootCtx: execute.RootCtx{
ExeCfg: plugin.ExecuteConfig{
Mode: plugin.ExecuteModeDebug,
ExeCfg: workflowModel.ExecuteConfig{
Mode: workflowModel.ExecuteModeDebug,
Operator: 123,
BizType: plugin.BizTypeWorkflow,
BizType: workflowModel.BizTypeWorkflow,
},
},
}).Build().UnPatch()

View File

@@ -37,6 +37,7 @@ import (
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/knowledge"
crossmodel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/modelmgr"
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
workflowModel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/workflow"
workflow3 "github.com/coze-dev/coze-studio/backend/api/model/workflow"
crossknowledge "github.com/coze-dev/coze-studio/backend/crossdomain/contract/knowledge"
crossmodelmgr "github.com/coze-dev/coze-studio/backend/crossdomain/contract/modelmgr"
@@ -401,9 +402,9 @@ func (c *Config) Build(ctx context.Context, ns *schema2.NodeSchema, _ ...schema2
workflowToolConfig.OutputParametersConfig = wf.FCSetting.ResponseParameters
}
locator := plugin.FromDraft
locator := workflowModel.FromDraft
if wf.WorkflowVersion != "" {
locator = plugin.FromSpecificVersion
locator = workflowModel.FromSpecificVersion
}
wfTool, err := workflow.GetRepository().WorkflowAsTool(ctx, vo.GetPolicy{

View File

@@ -24,6 +24,7 @@ import (
"github.com/cloudwego/eino/compose"
model "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
workflowModel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/workflow"
crossplugin "github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin"
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity"
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
@@ -111,7 +112,7 @@ type Plugin struct {
}
func (p *Plugin) Invoke(ctx context.Context, parameters map[string]any) (ret map[string]any, err error) {
var exeCfg model.ExecuteConfig
var exeCfg workflowModel.ExecuteConfig
if ctxExeCfg := execute.GetExeCtx(ctx); ctxExeCfg != nil {
exeCfg = ctxExeCfg.ExeCfg
}