refactor(workflow): Move the database component in the Workflow package into the common crossdomain package (#704)

This commit is contained in:
Ryo
2025-08-12 15:42:58 +08:00
committed by GitHub
parent e7011f2549
commit 9ff065cebd
29 changed files with 834 additions and 1353 deletions

View File

@@ -19,14 +19,12 @@ package workflow
import (
"context"
"github.com/cloudwego/eino/callbacks"
"github.com/cloudwego/eino/compose"
"gorm.io/gorm"
"github.com/cloudwego/eino/callbacks"
"github.com/coze-dev/coze-studio/backend/application/internal"
wfdatabase "github.com/coze-dev/coze-studio/backend/crossdomain/workflow/database"
"github.com/coze-dev/coze-studio/backend/crossdomain/impl/code"
wfknowledge "github.com/coze-dev/coze-studio/backend/crossdomain/workflow/knowledge"
wfmodel "github.com/coze-dev/coze-studio/backend/crossdomain/workflow/model"
wfplugin "github.com/coze-dev/coze-studio/backend/crossdomain/workflow/plugin"
@@ -38,8 +36,6 @@ import (
plugin "github.com/coze-dev/coze-studio/backend/domain/plugin/service"
search "github.com/coze-dev/coze-studio/backend/domain/search/service"
"github.com/coze-dev/coze-studio/backend/domain/workflow"
crosscode "github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/code"
crossdatabase "github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/database"
crossknowledge "github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/knowledge"
crossmodel "github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/model"
crossplugin "github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/plugin"
@@ -88,13 +84,12 @@ func InitService(ctx context.Context, components *ServiceComponents) (*Applicati
workflow.SetRepository(workflowRepo)
workflowDomainSVC := service.NewWorkflowService(workflowRepo)
crossdatabase.SetDatabaseOperator(wfdatabase.NewDatabaseRepository(components.DatabaseDomainSVC))
crossvariable.SetVariableHandler(variable.NewVariableHandler(components.VariablesDomainSVC))
crossvariable.SetVariablesMetaGetter(variable.NewVariablesMetaGetter(components.VariablesDomainSVC))
crossplugin.SetPluginService(wfplugin.NewPluginService(components.PluginDomainSVC, components.Tos))
crossknowledge.SetKnowledgeOperator(wfknowledge.NewKnowledgeRepository(components.KnowledgeDomainSVC, components.IDGen))
crossmodel.SetManager(wfmodel.NewModelManager(components.ModelManager, nil))
crosscode.SetCodeRunner(components.CodeRunner)
code.SetCodeRunner(components.CodeRunner)
crosssearch.SetNotifier(wfsearch.NewNotify(components.DomainNotifier))
callbacks.AppendGlobalHandlers(workflowservice.GetTokenCallbackHandler())

View File

@@ -25,9 +25,8 @@ import (
"strings"
"time"
xmaps "golang.org/x/exp/maps"
"github.com/cloudwego/eino/schema"
xmaps "golang.org/x/exp/maps"
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_common"
model "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/knowledge"