feat: add support for Graph Tools in AIAgent model and related services

This commit is contained in:
mlogclub
2026-04-14 15:10:50 +08:00
parent 8d560bb6bd
commit aa7f94e08f
9 changed files with 213 additions and 19 deletions
+1
View File
@@ -56,6 +56,7 @@ type CreateAIAgentRequest struct {
KnowledgeIDs []int64 `json:"knowledgeIds"`
SkillIDs []int64 `json:"skillIds"`
DirectTools []AIAgentMCPToolRequest `json:"directTools"`
GraphTools []string `json:"graphTools"`
Remark string `json:"remark"`
}
+1
View File
@@ -89,6 +89,7 @@ type AIAgentResponse struct {
SkillIDs []int64 `json:"skillIds"`
Skills []AIAgentSkillResponse `json:"skills"`
DirectTools []AIAgentMCPToolResponse `json:"directTools"`
GraphTools []string `json:"graphTools"`
SortNo int `json:"sortNo"`
Remark string `json:"remark"`
CreatedAt string `json:"createdAt"`
+6
View File
@@ -281,6 +281,12 @@ func IsAgentDirectToolCode(toolCode string) bool {
return ok && spec.DirectAccess
}
func IsAgentDirectGraphToolCode(toolCode string) bool {
toolCode = NormalizeToolCodeAlias(strings.TrimSpace(toolCode))
spec, ok := GetRegisteredToolSpec(toolCode)
return ok && spec.DirectAccess && spec.SourceType == enums.ToolSourceTypeGraph
}
func NormalizeToolCodeAlias(toolCode string) string {
toolCode = strings.TrimSpace(toolCode)
if canonical, ok := toolAliasToCanonical[toolCode]; ok {