feat: Enhance AI Agent and Channel Management
- Updated labels in the AI Agents dashboard for clarity, changing "流程状态" to "Playbook 状态" and "未发布流程" to "未发布 Playbook". - Introduced AI Agent rollout percentage management in channel editing, allowing users to set and rollback rollout percentages. - Added new API endpoints for rolling back AI Agent rollout and fetching agent run metrics. - Implemented new UI components for displaying agent run details, including status, duration, and input/output tokens. - Enhanced type definitions for AdminChannel and AIAgent to include rollout percentages and runtime modes. - Updated navigation to include a section for agent runs. - Added new translations for agent run features in both English and Chinese.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package request
|
||||
|
||||
type RunAgentEvaluationRequest struct {
|
||||
AIAgentID int64 `json:"aiAgentId"`
|
||||
EngineCode string `json:"engineCode"`
|
||||
Cases []AgentEvaluationCase `json:"cases"`
|
||||
}
|
||||
|
||||
type AgentEvaluationCase struct {
|
||||
ID string `json:"id"`
|
||||
Category string `json:"category"`
|
||||
Message string `json:"message"`
|
||||
History []string `json:"history,omitempty"`
|
||||
Expect map[string]any `json:"expect,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package request
|
||||
|
||||
import "agent-desk/internal/pkg/enums"
|
||||
|
||||
type SaveAgentRunQualityFeedbackRequest struct {
|
||||
AgentRunID int64 `json:"agentRunId"`
|
||||
ResolutionStatus enums.AgentRunResolutionStatus `json:"resolutionStatus"`
|
||||
EvidenceStatus enums.AgentRunEvidenceStatus `json:"evidenceStatus"`
|
||||
Comment string `json:"comment"`
|
||||
}
|
||||
@@ -46,14 +46,21 @@ 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"`
|
||||
KnowledgePolicy string `json:"knowledgePolicy"`
|
||||
ServiceMode enums.IMConversationServiceMode `json:"serviceMode"`
|
||||
SystemPrompt string `json:"systemPrompt"`
|
||||
WelcomeMessage string `json:"welcomeMessage"`
|
||||
ReplyTimeoutSeconds int `json:"replyTimeoutSeconds"`
|
||||
RolloutPercent int `json:"rolloutPercent"`
|
||||
TeamIDs []int64 `json:"teamIds"`
|
||||
HandoffMode enums.AIAgentHandoffMode `json:"handoffMode"`
|
||||
FallbackMode enums.AIAgentFallbackMode `json:"fallbackMode"`
|
||||
FallbackMessage string `json:"fallbackMessage"`
|
||||
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds"`
|
||||
SkillIDs []int64 `json:"skillIds"`
|
||||
DirectTools []AIAgentMCPToolRequest `json:"directTools"`
|
||||
}
|
||||
@@ -67,6 +74,19 @@ type DeleteAIAgentRequest struct {
|
||||
ID int64 `json:"id"`
|
||||
}
|
||||
|
||||
type PublishAIAgentRequest struct {
|
||||
ID int64 `json:"id"`
|
||||
}
|
||||
|
||||
type RollbackAIAgentRequest struct {
|
||||
ID int64 `json:"id"`
|
||||
RevisionID int64 `json:"revisionId"`
|
||||
}
|
||||
|
||||
type RollbackAIAgentRolloutRequest struct {
|
||||
ID int64 `json:"id"`
|
||||
}
|
||||
|
||||
type UpdateAIAgentStatusRequest struct {
|
||||
ID int64 `json:"id"`
|
||||
Status int `json:"status"`
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package request
|
||||
|
||||
type CreateChannelRequest struct {
|
||||
ChannelType string `json:"channelType"`
|
||||
AIAgentID int64 `json:"aiAgentId"`
|
||||
Name string `json:"name"`
|
||||
ConfigJSON string `json:"configJson"`
|
||||
Status int `json:"status"`
|
||||
Remark string `json:"remark"`
|
||||
ChannelType string `json:"channelType"`
|
||||
AIAgentID int64 `json:"aiAgentId"`
|
||||
AIAgentRolloutPercent int `json:"aiAgentRolloutPercent"`
|
||||
Name string `json:"name"`
|
||||
ConfigJSON string `json:"configJson"`
|
||||
Status int `json:"status"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
type UpdateChannelRequest struct {
|
||||
@@ -19,6 +20,10 @@ type UpdateChannelStatusRequest struct {
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
type RollbackChannelAIAgentRolloutRequest struct {
|
||||
ID int64 `json:"id"`
|
||||
}
|
||||
|
||||
type DeleteChannelRequest struct {
|
||||
ID int64 `json:"id"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
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"`
|
||||
Error string `json:"error,omitempty"`
|
||||
Finding string `json:"finding,omitempty"`
|
||||
}
|
||||
|
||||
type AgentEvaluationReportResponse struct {
|
||||
EngineCode string `json:"engineCode"`
|
||||
Total int `json:"total"`
|
||||
Passed int `json:"passed"`
|
||||
Results []AgentEvaluationResultResponse `json:"results"`
|
||||
CSV string `json:"csv"`
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package response
|
||||
|
||||
import "agent-desk/internal/pkg/enums"
|
||||
|
||||
type AgentRunResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
ConversationID int64 `json:"conversationId"`
|
||||
AIAgentID int64 `json:"aiAgentId"`
|
||||
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"`
|
||||
StartedAt string `json:"startedAt"`
|
||||
EndedAt string `json:"endedAt"`
|
||||
DurationMS int64 `json:"durationMs"`
|
||||
ErrorMessage string `json:"errorMessage"`
|
||||
TraceData string `json:"traceData"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
Steps []AgentStepResponse `json:"steps,omitempty"`
|
||||
ToolCalls []AgentToolCallResponse `json:"toolCalls,omitempty"`
|
||||
QualityFeedback *AgentRunQualityFeedbackResponse `json:"qualityFeedback,omitempty"`
|
||||
}
|
||||
|
||||
type AgentRunQualityFeedbackResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
AgentRunID int64 `json:"agentRunId"`
|
||||
ResolutionStatus enums.AgentRunResolutionStatus `json:"resolutionStatus"`
|
||||
EvidenceStatus enums.AgentRunEvidenceStatus `json:"evidenceStatus"`
|
||||
Comment string `json:"comment"`
|
||||
UpdateUserName string `json:"updateUserName"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
|
||||
type AgentStepResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
AgentRunID int64 `json:"agentRunId"`
|
||||
WorkflowRunID int64 `json:"workflowRunId"`
|
||||
StepType string `json:"stepType"`
|
||||
StepCode string `json:"stepCode"`
|
||||
Status string `json:"status"`
|
||||
InputPreview string `json:"inputPreview"`
|
||||
OutputPreview string `json:"outputPreview"`
|
||||
ErrorMessage string `json:"errorMessage"`
|
||||
StartedAt string `json:"startedAt"`
|
||||
EndedAt string `json:"endedAt"`
|
||||
DurationMS int `json:"durationMs"`
|
||||
}
|
||||
|
||||
type AgentToolCallResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
AgentRunID int64 `json:"agentRunId"`
|
||||
AgentStepID int64 `json:"agentStepId"`
|
||||
ToolCode string `json:"toolCode"`
|
||||
RiskLevel string `json:"riskLevel"`
|
||||
RequireConfirm bool `json:"requireConfirm"`
|
||||
Status string `json:"status"`
|
||||
ArgumentsPreview string `json:"argumentsPreview"`
|
||||
ResultPreview string `json:"resultPreview"`
|
||||
ErrorMessage string `json:"errorMessage"`
|
||||
DurationMS int `json:"durationMs"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
@@ -24,6 +24,18 @@ type AIAgentMCPToolResponse struct {
|
||||
Arguments map[string]string `json:"arguments"`
|
||||
}
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
type AIConfigResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
@@ -67,34 +79,44 @@ 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"`
|
||||
ServiceMode enums.IMConversationServiceMode `json:"serviceMode"`
|
||||
ServiceModeName string `json:"serviceModeName"`
|
||||
SystemPrompt string `json:"systemPrompt"`
|
||||
WelcomeMessage string `json:"welcomeMessage"`
|
||||
ReplyTimeoutSeconds int `json:"replyTimeoutSeconds"`
|
||||
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"`
|
||||
SkillIDs []int64 `json:"skillIds"`
|
||||
Skills []AIAgentSkillResponse `json:"skills"`
|
||||
DirectTools []AIAgentMCPToolResponse `json:"directTools"`
|
||||
WorkflowVersionID int64 `json:"workflowVersionId"`
|
||||
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"`
|
||||
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"`
|
||||
}
|
||||
|
||||
@@ -41,6 +41,13 @@ type AIWorkflowValidationResponse struct {
|
||||
Errors []workflowvalidator.Error `json:"errors"`
|
||||
}
|
||||
|
||||
type AIWorkflowTemplateResponse struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Definition dsl.Definition `json:"definition"`
|
||||
}
|
||||
|
||||
type AIWorkflowNodeSpecResponse struct {
|
||||
Type string `json:"type"`
|
||||
Title string `json:"title"`
|
||||
|
||||
@@ -6,15 +6,17 @@ import (
|
||||
)
|
||||
|
||||
type ChannelResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
ChannelType string `json:"channelType"`
|
||||
ChannelID string `json:"channelId"`
|
||||
AIAgentID int64 `json:"aiAgentId"`
|
||||
AIAgentName string `json:"aiAgentName,omitempty"`
|
||||
Name string `json:"name"`
|
||||
ConfigJSON string `json:"configJson"`
|
||||
Status enums.Status `json:"status"`
|
||||
Remark string `json:"remark"`
|
||||
ID int64 `json:"id"`
|
||||
ChannelType string `json:"channelType"`
|
||||
ChannelID string `json:"channelId"`
|
||||
AIAgentID int64 `json:"aiAgentId"`
|
||||
AIAgentRolloutPercent int `json:"aiAgentRolloutPercent"`
|
||||
PreviousAIAgentRolloutPercent int `json:"previousAiAgentRolloutPercent"`
|
||||
AIAgentName string `json:"aiAgentName,omitempty"`
|
||||
Name string `json:"name"`
|
||||
ConfigJSON string `json:"configJson"`
|
||||
Status enums.Status `json:"status"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
type WxWorkKFAccountResponse struct {
|
||||
@@ -29,13 +31,15 @@ func BuildChannelResponse(item *models.Channel) ChannelResponse {
|
||||
return ChannelResponse{}
|
||||
}
|
||||
return ChannelResponse{
|
||||
ID: item.ID,
|
||||
ChannelType: item.ChannelType,
|
||||
ChannelID: item.ChannelID,
|
||||
AIAgentID: item.AIAgentID,
|
||||
Name: item.Name,
|
||||
ConfigJSON: item.ConfigJSON,
|
||||
Status: item.Status,
|
||||
Remark: item.Remark,
|
||||
ID: item.ID,
|
||||
ChannelType: item.ChannelType,
|
||||
ChannelID: item.ChannelID,
|
||||
AIAgentID: item.AIAgentID,
|
||||
AIAgentRolloutPercent: item.AIAgentRolloutPercent,
|
||||
PreviousAIAgentRolloutPercent: item.PreviousAIAgentRolloutPercent,
|
||||
Name: item.Name,
|
||||
ConfigJSON: item.ConfigJSON,
|
||||
Status: item.Status,
|
||||
Remark: item.Remark,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user