Files
ai-agent/internal/ai/application/runtime/workflow_runtime.go
T
mlogclub 847f688398 Refactor AI Agent configuration and workflow handling
- Removed runtime mode handling from AIAgentConfigWorkbench and related components.
- Updated tests to reflect changes in AI Agent policy copy and configuration.
- Changed terminology from "workflow" to "revision" in various components and API responses.
- Simplified agent binding logic in channel editing.
- Cleaned up unused variables and types related to runtime modes.
- Updated localization files for consistency with new terminology.
2026-07-27 23:29:02 +08:00

38 lines
1.0 KiB
Go

package runtime
import (
"encoding/json"
"agent-desk/internal/ai/workflow/dsl"
"agent-desk/internal/pkg/enums"
"agent-desk/internal/pkg/errorsx"
"agent-desk/internal/repositories"
"github.com/mlogclub/simple/sqls"
)
type resolvedWorkflow struct {
Definition dsl.Definition
WorkflowID int64
VersionID int64
}
func resolveWorkflowVersion(workflowVersionID int64) (resolvedWorkflow, error) {
if workflowVersionID <= 0 {
return resolvedWorkflow{}, errorsx.InvalidParam("workflow version is required")
}
version := repositories.AIWorkflowVersionRepository.Get(sqls.DB(), workflowVersionID)
if version == nil || version.Status != enums.StatusOk {
return resolvedWorkflow{}, errorsx.InvalidParam("workflow version does not exist")
}
var def dsl.Definition
if err := json.Unmarshal([]byte(version.Definition), &def); err != nil {
return resolvedWorkflow{}, errorsx.InvalidParam("workflow definition is invalid")
}
return resolvedWorkflow{
Definition: def,
WorkflowID: version.WorkflowID,
VersionID: version.ID,
}, nil
}