feat: enhance AI agent functionality with tool management and logging improvements
- Added AllowedToolCodes field to Context for managing tool access. - Introduced ResumeSource in aiReplyTraceData to track resume points. - Enhanced logging with additional fields: PlannedSkillName, SkillRouteTrace, InterruptType, ResumeSource, and FinalStatus. - Implemented functions to parse and resolve allowed tool codes for agents and skills. - Refactored skill definition creation and update logic to streamline request handling. - Updated MCP tool catalog to include source type and integrated built-in tools. - Improved UI components to display additional tool information and enhance user experience.
This commit is contained in:
@@ -174,12 +174,29 @@ func buildAIAgentResponse(item *models.AIAgent) response.AIAgentResponse {
|
||||
if toolCode == "" {
|
||||
toolCode = toolx.BuildMCPToolCode(tool.ServerCode, tool.ToolName)
|
||||
}
|
||||
serverCode := strings.TrimSpace(tool.ServerCode)
|
||||
toolName := strings.TrimSpace(tool.ToolName)
|
||||
if toolCode == toolx.BuiltinCreateTicketConfirmToolCode {
|
||||
serverCode = toolx.BuiltinToolCatalogServerCode
|
||||
toolName = toolx.BuiltinCreateTicketConfirmToolName
|
||||
} else if parsedServerCode, parsedToolName := toolx.SplitMCPToolCode(toolCode); parsedServerCode != "" && parsedToolName != "" {
|
||||
serverCode = parsedServerCode
|
||||
toolName = parsedToolName
|
||||
}
|
||||
title := strings.TrimSpace(tool.Title)
|
||||
if title == "" && toolCode == toolx.BuiltinCreateTicketConfirmToolCode {
|
||||
title = toolx.BuiltinCreateTicketConfirmToolTitle
|
||||
}
|
||||
description := strings.TrimSpace(tool.Description)
|
||||
if description == "" && toolCode == toolx.BuiltinCreateTicketConfirmToolCode {
|
||||
description = toolx.BuiltinCreateTicketConfirmToolDescription
|
||||
}
|
||||
ret.DirectTools = append(ret.DirectTools, response.AIAgentMCPToolResponse{
|
||||
ToolCode: toolCode,
|
||||
ServerCode: strings.TrimSpace(tool.ServerCode),
|
||||
ToolName: strings.TrimSpace(tool.ToolName),
|
||||
Title: strings.TrimSpace(tool.Title),
|
||||
Description: strings.TrimSpace(tool.Description),
|
||||
ServerCode: serverCode,
|
||||
ToolName: toolName,
|
||||
Title: title,
|
||||
Description: description,
|
||||
Arguments: tool.Arguments,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user