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.
This commit is contained in:
mlogclub
2026-07-27 23:29:02 +08:00
parent 241f274927
commit 847f688398
97 changed files with 1666 additions and 5941 deletions
@@ -1,9 +1,8 @@
package request
type RunAgentEvaluationRequest struct {
AIAgentID int64 `json:"aiAgentId"`
EngineCode string `json:"engineCode"`
Cases []AgentEvaluationCase `json:"cases"`
AIAgentID int64 `json:"aiAgentId"`
Cases []AgentEvaluationCase `json:"cases"`
}
type AgentEvaluationCase struct {
+8 -7
View File
@@ -3,12 +3,14 @@ package request
import "agent-desk/internal/pkg/enums"
type AIAgentMCPToolRequest struct {
ToolCode string `json:"toolCode"`
ServerCode string `json:"serverCode"`
ToolName string `json:"toolName"`
Title string `json:"title"`
Description string `json:"description"`
Arguments map[string]string `json:"arguments"`
ToolCode string `json:"toolCode"`
ServerCode string `json:"serverCode"`
ToolName string `json:"toolName"`
Title string `json:"title"`
Description string `json:"description"`
RiskLevel string `json:"riskLevel"`
RequireConfirmation bool `json:"requireConfirmation"`
Arguments map[string]string `json:"arguments"`
}
type AIAgentWorkflowBindingRequest struct {
@@ -54,7 +56,6 @@ type CreateAIAgentRequest struct {
Name string `json:"name"`
Description string `json:"description"`
AIConfigID int64 `json:"aiConfigId"`
RuntimeMode enums.AIAgentRuntimeMode `json:"runtimeMode"`
MaxSteps int `json:"maxSteps"`
ContextWindow int `json:"contextWindow"`
ToolPolicy string `json:"toolPolicy"`
@@ -3,7 +3,6 @@ package response
type AgentEvaluationResultResponse struct {
CaseID string `json:"caseId"`
Category string `json:"category"`
EngineCode string `json:"engineCode"`
Passed bool `json:"passed"`
ReplyText string `json:"replyText"`
Interrupted bool `json:"interrupted"`
@@ -12,9 +11,8 @@ type AgentEvaluationResultResponse struct {
}
type AgentEvaluationReportResponse struct {
EngineCode string `json:"engineCode"`
Total int `json:"total"`
Passed int `json:"passed"`
Results []AgentEvaluationResultResponse `json:"results"`
CSV string `json:"csv"`
Total int `json:"total"`
Passed int `json:"passed"`
Results []AgentEvaluationResultResponse `json:"results"`
CSV string `json:"csv"`
}
@@ -9,7 +9,6 @@ type AgentRunResponse struct {
AgentRevisionID int64 `json:"agentRevisionId"`
SourceMessageID int64 `json:"sourceMessageId"`
WorkflowRunID int64 `json:"workflowRunId"`
EngineCode string `json:"engineCode"`
Status string `json:"status"`
PromptTokens int `json:"promptTokens"`
CompletionTokens int `json:"completionTokens"`
+16 -21
View File
@@ -16,12 +16,14 @@ type AIAgentSkillResponse struct {
}
type AIAgentMCPToolResponse struct {
ToolCode string `json:"toolCode"`
ServerCode string `json:"serverCode"`
ToolName string `json:"toolName"`
Title string `json:"title"`
Description string `json:"description"`
Arguments map[string]string `json:"arguments"`
ToolCode string `json:"toolCode"`
ServerCode string `json:"serverCode"`
ToolName string `json:"toolName"`
Title string `json:"title"`
Description string `json:"description"`
RiskLevel string `json:"riskLevel"`
RequireConfirmation bool `json:"requireConfirmation"`
Arguments map[string]string `json:"arguments"`
}
type AIAgentWorkflowBindingResponse struct {
@@ -37,15 +39,14 @@ type AIAgentWorkflowBindingResponse struct {
}
type AgentRevisionResponse struct {
ID int64 `json:"id"`
AgentID int64 `json:"agentId"`
Revision int `json:"revision"`
WorkflowVersionID int64 `json:"workflowVersionId"`
Status enums.Status `json:"status"`
DefinitionHash string `json:"definitionHash"`
PublishedAt string `json:"publishedAt"`
PublishedByID int64 `json:"publishedById"`
PublishedByName string `json:"publishedByName"`
ID int64 `json:"id"`
AgentID int64 `json:"agentId"`
Revision int `json:"revision"`
Status enums.Status `json:"status"`
DefinitionHash string `json:"definitionHash"`
PublishedAt string `json:"publishedAt"`
PublishedByID int64 `json:"publishedById"`
PublishedByName string `json:"publishedByName"`
}
type AIConfigResponse struct {
@@ -98,8 +99,6 @@ type AIAgentResponse struct {
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"`
@@ -122,11 +121,7 @@ type AIAgentResponse struct {
Skills []AIAgentSkillResponse `json:"skills"`
MCPTools []AIAgentMCPToolResponse `json:"mcpTools"`
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"`
@@ -63,7 +63,7 @@ type DashboardAIStatsResponse struct {
TodayKnowledgeRetrieves int64 `json:"todayKnowledgeRetrieves"`
TodayKnowledgeRetrieveFailCount int64 `json:"todayKnowledgeRetrieveFailCount"`
TodayKnowledgeRetrieveFailRate float64 `json:"todayKnowledgeRetrieveFailRate"`
TodaySkillRunFailCount int64 `json:"todaySkillRunFailCount"`
TodayAgentRunFailCount int64 `json:"todayAgentRunFailCount"`
TodayAIHandoffCount int64 `json:"todayAiHandoffCount"`
}
@@ -22,14 +22,8 @@ type SkillDebugRunResponse struct {
SkillDefinitionID int64 `json:"skillDefinitionId"`
SkillName string `json:"skillName"`
ReplyText string `json:"replyText"`
PlanReason string `json:"planReason"`
SkillRouteTrace string `json:"skillRouteTrace"`
ToolWhitelist []string `json:"toolWhitelist"`
ExposedToolCodes []string `json:"exposedToolCodes"`
InvokedToolCodes []string `json:"invokedToolCodes"`
ToolSearchTrace string `json:"toolSearchTrace"`
GraphToolTrace string `json:"graphToolTrace"`
GraphToolCode string `json:"graphToolCode"`
InterruptType string `json:"interruptType"`
CheckPointID string `json:"checkPointId"`
Interrupted bool `json:"interrupted"`
-33
View File
@@ -239,39 +239,6 @@ func GetAIAgentFallbackModeLabel(mode AIAgentFallbackMode) string {
return aiAgentFallbackModeLabelMap[mode]
}
type AIAgentRuntimeMode string
const (
AIAgentRuntimeModeWorkflow AIAgentRuntimeMode = "workflow"
AIAgentRuntimeModeAutonomous AIAgentRuntimeMode = "autonomous"
AIAgentRuntimeModeHybrid AIAgentRuntimeMode = "hybrid"
)
var AIAgentRuntimeModeValues = []AIAgentRuntimeMode{
AIAgentRuntimeModeWorkflow,
AIAgentRuntimeModeAutonomous,
AIAgentRuntimeModeHybrid,
}
var aiAgentRuntimeModeLabelMap = map[AIAgentRuntimeMode]string{
AIAgentRuntimeModeWorkflow: "流程编排",
AIAgentRuntimeModeAutonomous: "自主运行",
AIAgentRuntimeModeHybrid: "混合运行",
}
func GetAIAgentRuntimeModeLabel(mode AIAgentRuntimeMode) string {
return aiAgentRuntimeModeLabelMap[mode]
}
func IsValidAIAgentRuntimeMode(mode AIAgentRuntimeMode) bool {
for _, item := range AIAgentRuntimeModeValues {
if item == mode {
return true
}
}
return false
}
const (
IMRealtimeEventConnected = "connected"
IMRealtimeEventPong = "pong"
+7 -5
View File
@@ -63,11 +63,13 @@ func NormalizeMCPToolRequest(item request.AIAgentMCPToolRequest) (request.AIAgen
return request.AIAgentMCPToolRequest{}, errorsx.InvalidParamI18n("error.e0018")
}
ret := request.AIAgentMCPToolRequest{
ToolCode: toolCode,
ServerCode: serverCode,
ToolName: toolName,
Title: strings.TrimSpace(item.Title),
Description: strings.TrimSpace(item.Description),
ToolCode: toolCode,
ServerCode: serverCode,
ToolName: toolName,
Title: strings.TrimSpace(item.Title),
Description: strings.TrimSpace(item.Description),
RiskLevel: strings.ToLower(strings.TrimSpace(item.RiskLevel)),
RequireConfirmation: item.RequireConfirmation,
}
if len(item.Arguments) > 0 {
ret.Arguments = make(map[string]string, len(item.Arguments))