feat: Implement AI Agent Workflow Binding functionality

- Added aiAgentWorkflowBindingRepository for managing workflow bindings associated with AI agents.
- Enhanced agentRevisionService to include workflow bindings in agent revisions.
- Updated aIAgentService to handle workflow bindings during agent creation and updates.
- Introduced ai_agent_workflow_binding_service for managing workflow binding logic.
- Created new API endpoints for fetching, creating, updating, and deleting AI workflows.
- Developed a new dashboard page for managing AI workflows.
- Updated frontend components to support workflow binding management in agent configuration.
- Added necessary tests for workflow binding functionality and updated existing tests for compatibility.
- Translated relevant UI texts and messages for workflow management.
This commit is contained in:
mlogclub
2026-07-25 15:24:49 +08:00
parent e4ad83dc20
commit 7b86fd1f09
21 changed files with 590 additions and 136 deletions
+9
View File
@@ -11,6 +11,14 @@ type AIAgentMCPToolRequest struct {
Arguments map[string]string `json:"arguments"`
}
type AIAgentWorkflowBindingRequest struct {
WorkflowVersionID int64 `json:"workflowVersionId"`
ToolName string `json:"toolName"`
TriggerInstruction string `json:"triggerInstruction"`
Priority int `json:"priority"`
Enabled bool `json:"enabled"`
}
type CreateAIConfigRequest struct {
Name string `json:"name"`
Provider enums.AIProvider `json:"provider"`
@@ -63,6 +71,7 @@ type CreateAIAgentRequest struct {
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds"`
SkillIDs []int64 `json:"skillIds"`
DirectTools []AIAgentMCPToolRequest `json:"directTools"`
WorkflowBindings []AIAgentWorkflowBindingRequest `json:"workflowBindings"`
}
type UpdateAIAgentRequest struct {
+53 -40
View File
@@ -24,6 +24,18 @@ type AIAgentMCPToolResponse struct {
Arguments map[string]string `json:"arguments"`
}
type AIAgentWorkflowBindingResponse struct {
ID int64 `json:"id"`
WorkflowID int64 `json:"workflowId"`
WorkflowVersionID int64 `json:"workflowVersionId"`
WorkflowName string `json:"workflowName"`
WorkflowVersion int `json:"workflowVersion"`
ToolName string `json:"toolName"`
TriggerInstruction string `json:"triggerInstruction"`
Priority int `json:"priority"`
Enabled bool `json:"enabled"`
}
type AgentRevisionResponse struct {
ID int64 `json:"id"`
AgentID int64 `json:"agentId"`
@@ -79,44 +91,45 @@ func BuildAIConfigResponse(item *models.AIConfig) AIConfigResponse {
}
type AIAgentResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Status enums.Status `json:"status"`
StatusName string `json:"statusName"`
AIConfigID int64 `json:"aiConfigId"`
AIConfigName string `json:"aiConfigName"`
RuntimeMode enums.AIAgentRuntimeMode `json:"runtimeMode"`
RuntimeModeName string `json:"runtimeModeName"`
MaxSteps int `json:"maxSteps"`
ContextWindow int `json:"contextWindow"`
ToolPolicy string `json:"toolPolicy"`
KnowledgePolicy string `json:"knowledgePolicy"`
ServiceMode enums.IMConversationServiceMode `json:"serviceMode"`
ServiceModeName string `json:"serviceModeName"`
SystemPrompt string `json:"systemPrompt"`
WelcomeMessage string `json:"welcomeMessage"`
ReplyTimeoutSeconds int `json:"replyTimeoutSeconds"`
RolloutPercent int `json:"rolloutPercent"`
PreviousRolloutPercent int `json:"previousRolloutPercent"`
Teams []AIAgentTeamResponse `json:"teams"`
HandoffMode enums.AIAgentHandoffMode `json:"handoffMode"`
HandoffModeName string `json:"handoffModeName"`
FallbackMode enums.AIAgentFallbackMode `json:"fallbackMode"`
FallbackModeName string `json:"fallbackModeName"`
FallbackMessage string `json:"fallbackMessage"`
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds"`
SkillIDs []int64 `json:"skillIds"`
Skills []AIAgentSkillResponse `json:"skills"`
DirectTools []AIAgentMCPToolResponse `json:"directTools"`
WorkflowVersionID int64 `json:"workflowVersionId"`
PublishedRevisionID int64 `json:"publishedRevisionId"`
WorkflowPublished bool `json:"workflowPublished"`
WorkflowState string `json:"workflowState"`
WorkflowStateText string `json:"workflowStateText"`
SortNo int `json:"sortNo"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Status enums.Status `json:"status"`
StatusName string `json:"statusName"`
AIConfigID int64 `json:"aiConfigId"`
AIConfigName string `json:"aiConfigName"`
RuntimeMode enums.AIAgentRuntimeMode `json:"runtimeMode"`
RuntimeModeName string `json:"runtimeModeName"`
MaxSteps int `json:"maxSteps"`
ContextWindow int `json:"contextWindow"`
ToolPolicy string `json:"toolPolicy"`
KnowledgePolicy string `json:"knowledgePolicy"`
ServiceMode enums.IMConversationServiceMode `json:"serviceMode"`
ServiceModeName string `json:"serviceModeName"`
SystemPrompt string `json:"systemPrompt"`
WelcomeMessage string `json:"welcomeMessage"`
ReplyTimeoutSeconds int `json:"replyTimeoutSeconds"`
RolloutPercent int `json:"rolloutPercent"`
PreviousRolloutPercent int `json:"previousRolloutPercent"`
Teams []AIAgentTeamResponse `json:"teams"`
HandoffMode enums.AIAgentHandoffMode `json:"handoffMode"`
HandoffModeName string `json:"handoffModeName"`
FallbackMode enums.AIAgentFallbackMode `json:"fallbackMode"`
FallbackModeName string `json:"fallbackModeName"`
FallbackMessage string `json:"fallbackMessage"`
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds"`
SkillIDs []int64 `json:"skillIds"`
Skills []AIAgentSkillResponse `json:"skills"`
DirectTools []AIAgentMCPToolResponse `json:"directTools"`
WorkflowBindings []AIAgentWorkflowBindingResponse `json:"workflowBindings"`
WorkflowVersionID int64 `json:"workflowVersionId"`
PublishedRevisionID int64 `json:"publishedRevisionId"`
WorkflowPublished bool `json:"workflowPublished"`
WorkflowState string `json:"workflowState"`
WorkflowStateText string `json:"workflowStateText"`
SortNo int `json:"sortNo"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
}