34051a4631
- 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.
103 lines
4.8 KiB
Go
103 lines
4.8 KiB
Go
package response
|
|
|
|
import (
|
|
"agent-desk/internal/ai/workflow/dsl"
|
|
workflowregistry "agent-desk/internal/ai/workflow/registry"
|
|
workflowvalidator "agent-desk/internal/ai/workflow/validator"
|
|
"agent-desk/internal/pkg/enums"
|
|
)
|
|
|
|
type AIWorkflowResponse struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
AgentID int64 `json:"agentId"`
|
|
Status enums.Status `json:"status"`
|
|
DraftDefinition dsl.Definition `json:"draftDefinition"`
|
|
PublishedVersionID int64 `json:"publishedVersionId"`
|
|
SortNo int `json:"sortNo"`
|
|
CreatedAt string `json:"createdAt"`
|
|
UpdatedAt string `json:"updatedAt"`
|
|
CreateUserName string `json:"createUserName"`
|
|
UpdateUserName string `json:"updateUserName"`
|
|
}
|
|
|
|
type AIWorkflowVersionResponse struct {
|
|
ID int64 `json:"id"`
|
|
WorkflowID int64 `json:"workflowId"`
|
|
Version int `json:"version"`
|
|
Status enums.Status `json:"status"`
|
|
Definition dsl.Definition `json:"definition"`
|
|
DefinitionHash string `json:"definitionHash"`
|
|
PublishedAt string `json:"publishedAt"`
|
|
PublishedByID int64 `json:"publishedById"`
|
|
PublishedByName string `json:"publishedByName"`
|
|
CreatedAt string `json:"createdAt"`
|
|
UpdatedAt string `json:"updatedAt"`
|
|
}
|
|
|
|
type AIWorkflowValidationResponse struct {
|
|
Valid bool `json:"valid"`
|
|
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"`
|
|
Description string `json:"description"`
|
|
Icon string `json:"icon"`
|
|
RiskLevel workflowregistry.NodeRiskLevel `json:"riskLevel"`
|
|
Interruptible bool `json:"interruptible"`
|
|
RequiresConfirmationPredecessor bool `json:"requiresConfirmationPredecessor"`
|
|
ConfigSchema any `json:"configSchema,omitempty"`
|
|
InputSchema []workflowregistry.VariableSpec `json:"inputSchema,omitempty"`
|
|
OutputSchema []workflowregistry.VariableSpec `json:"outputSchema,omitempty"`
|
|
DefaultInputs map[string]dsl.Value `json:"defaultInputs,omitempty"`
|
|
}
|
|
|
|
type AIWorkflowRunResponse struct {
|
|
ID int64 `json:"id"`
|
|
WorkflowID int64 `json:"workflowId"`
|
|
WorkflowVersionID int64 `json:"workflowVersionId"`
|
|
WorkflowVersion int `json:"workflowVersion"`
|
|
WorkflowName string `json:"workflowName"`
|
|
ConversationID int64 `json:"conversationId"`
|
|
AIAgentID int64 `json:"aiAgentId"`
|
|
AIAgentName string `json:"aiAgentName"`
|
|
MessageID int64 `json:"messageId"`
|
|
Status int `json:"status"`
|
|
StatusName string `json:"statusName"`
|
|
StartedAt string `json:"startedAt"`
|
|
EndedAt string `json:"endedAt"`
|
|
DurationMS int64 `json:"durationMs"`
|
|
InterruptType string `json:"interruptType"`
|
|
InterruptNodeID string `json:"interruptNodeId"`
|
|
ErrorMessage string `json:"errorMessage"`
|
|
CreatedAt string `json:"createdAt"`
|
|
UpdatedAt string `json:"updatedAt"`
|
|
Definition dsl.Definition `json:"definition"`
|
|
Nodes []AIWorkflowNodeRunResponse `json:"nodes,omitempty"`
|
|
}
|
|
|
|
type AIWorkflowNodeRunResponse struct {
|
|
ID int64 `json:"id"`
|
|
WorkflowRunID int64 `json:"workflowRunId"`
|
|
NodeID string `json:"nodeId"`
|
|
NodeType string `json:"nodeType"`
|
|
Status int `json:"status"`
|
|
StatusName string `json:"statusName"`
|
|
InputPreview string `json:"inputPreview"`
|
|
OutputPreview string `json:"outputPreview"`
|
|
ErrorMessage string `json:"errorMessage"`
|
|
StartedAt string `json:"startedAt"`
|
|
EndedAt string `json:"endedAt"`
|
|
DurationMS int `json:"durationMs"`
|
|
}
|