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

@@ -17,7 +17,7 @@
package vo
import (
model "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
model "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/workflow"
)
type Page struct {

View File

@@ -23,7 +23,7 @@ import (
"github.com/cloudwego/eino/compose"
"github.com/cloudwego/eino/schema"
"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/pkg/errorx"
"github.com/coze-dev/coze-studio/backend/pkg/sonic"
"github.com/coze-dev/coze-studio/backend/types/errno"
@@ -93,7 +93,7 @@ type wfErr struct {
func (w *wfErr) DebugURL() string {
if w.StatusError.Extra() == nil {
return fmt.Sprintf(plugin.DebugURLTpl, w.exeID, w.spaceID, w.workflowID)
return fmt.Sprintf(workflowModel.DebugURLTpl, w.exeID, w.spaceID, w.workflowID)
}
debugURL, ok := w.StatusError.Extra()["debug_url"]
@@ -101,7 +101,7 @@ func (w *wfErr) DebugURL() string {
return debugURL
}
return fmt.Sprintf(plugin.DebugURLTpl, w.exeID, w.spaceID, w.workflowID)
return fmt.Sprintf(workflowModel.DebugURLTpl, w.exeID, w.spaceID, w.workflowID)
}
func (w *wfErr) Level() ErrorLevel {
@@ -170,7 +170,7 @@ func WrapError(code int, err error, opts ...errorx.Option) WorkflowError {
}
func WrapWithDebug(code int, err error, exeID, spaceID, workflowID int64, opts ...errorx.Option) WorkflowError {
debugURL := fmt.Sprintf(plugin.DebugURLTpl, exeID, spaceID, workflowID)
debugURL := fmt.Sprintf(workflowModel.DebugURLTpl, exeID, spaceID, workflowID)
opts = append(opts, errorx.Extra("debug_url", debugURL))
return WrapError(code, err, opts...)
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package vo
import (
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
)
type ExternalResourceRelated struct {
PluginMap map[int64]*plugin.PluginEntity
PluginToolMap map[int64]int64
KnowledgeMap map[int64]int64
DatabaseMap map[int64]int64
}
type CopyWorkflowPolicy struct {
TargetSpaceID *int64
TargetAppID *int64
ModifiedCanvasSchema *string
ShouldModifyWorkflowName bool
}
type DependenceResource struct {
PluginIDs []int64
KnowledgeIDs []int64
DatabaseIDs []int64
}

View File

@@ -76,3 +76,9 @@ type WorkflowBasic struct {
AppID *int64
CommitID string
}
type CopyWorkflowFromAppToLibraryResult struct {
WorkflowIDVersionMap map[int64]IDVersionPair
ValidateIssues []*vo.ValidateIssue
CopiedWorkflows []*Workflow
}

View File

@@ -19,7 +19,7 @@ package entity
import (
"time"
model "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/api/model/workflow"
)
@@ -31,7 +31,7 @@ type WorkflowExecution struct {
WorkflowID int64
Version string
SpaceID int64
model.ExecuteConfig
workflowModel.ExecuteConfig
CreatedAt time.Time
LogID string
NodeCount int32