新版本流程编辑器

This commit is contained in:
mlogclub
2026-07-27 19:04:15 +08:00
parent d33960961a
commit e072141953
281 changed files with 25145 additions and 3405 deletions
@@ -2,6 +2,7 @@ package services
import (
"encoding/json"
"strings"
"testing"
"time"
@@ -40,6 +41,26 @@ func TestAIWorkflowServiceValidateDefinitionReportsErrors(t *testing.T) {
}
}
func TestAIWorkflowServiceDefaultDefinitionUsesOfficialFlowGramModel(t *testing.T) {
definition := defaultAgentWorkflowDefinition()
if definition.SchemaVersion != 0 {
t.Fatalf("official FlowGram definition must not contain the legacy schemaVersion, got %d", definition.SchemaVersion)
}
if len(definition.Nodes) != 3 {
t.Fatalf("default node count = %d, want 3", len(definition.Nodes))
}
nodeTypes := []string{definition.Nodes[0].Type, definition.Nodes[1].Type, definition.Nodes[2].Type}
if strings.Join(nodeTypes, ",") != "start,llm,end" {
t.Fatalf("default node types = %v, want [start llm end]", nodeTypes)
}
if len(definition.GlobalVariable) == 0 {
t.Fatalf("official FlowGram globalVariable is required")
}
if result := AIWorkflowService.ValidateDefinition(definition); !result.Valid {
t.Fatalf("default official FlowGram definition is invalid: %#v", result.Errors)
}
}
func TestAIWorkflowServicePublishCreatesImmutableVersion(t *testing.T) {
setupAIWorkflowTestDB(t)
operator := aiWorkflowTestOperator()