feat: refactor ticket creation process to use Graph Tool for confirmation and state management

This commit is contained in:
mlogclub
2026-04-10 15:45:51 +08:00
parent e7a600b7d5
commit 3db7bec662
11 changed files with 273 additions and 147 deletions
@@ -10,6 +10,7 @@ import (
"cs-agent/internal/pkg/dto/request"
"cs-agent/internal/pkg/enums"
"cs-agent/internal/pkg/errorsx"
"cs-agent/internal/pkg/toolx"
"cs-agent/internal/pkg/utils"
"cs-agent/internal/repositories"
@@ -210,6 +211,7 @@ func normalizeSkillStringArray(input []string) ([]string, error) {
seen := make(map[string]struct{}, len(ret))
for _, item := range ret {
item = strings.TrimSpace(item)
item = toolx.NormalizeToolCodeAlias(item)
if item == "" {
continue
}
+7 -7
View File
@@ -35,13 +35,13 @@ func (s *toolCatalogService) ListMCPTools(ctx context.Context) ([]MCPToolCatalog
cfg := config.Current()
ret := make([]MCPToolCatalogItem, 0, 2)
ret = append(ret, MCPToolCatalogItem{
ToolCode: toolx.BuiltinCreateTicketConfirmToolCode,
ServerCode: toolx.BuiltinToolCatalogServerCode,
ToolName: toolx.BuiltinCreateTicketConfirmToolName,
SourceType: toolx.BuiltinToolCatalogServerCode,
ToolCode: toolx.GraphCreateTicketConfirmToolCode,
ServerCode: toolx.GraphToolCatalogServerCode,
ToolName: toolx.GraphCreateTicketConfirmToolName,
SourceType: toolx.GraphToolCatalogServerCode,
AutoInjected: false,
Title: toolx.BuiltinCreateTicketConfirmToolTitle,
Description: toolx.BuiltinCreateTicketConfirmToolDescription,
Title: toolx.GraphCreateTicketConfirmToolTitle,
Description: toolx.GraphCreateTicketConfirmToolDescription,
})
if !cfg.MCP.Enabled {
return ret, nil
@@ -96,7 +96,7 @@ func (s *toolCatalogService) ValidateToolCode(toolCode string) error {
return errorsx.InvalidParam("toolCode不能为空")
}
switch toolCode {
case toolx.BuiltinToolSearchToolCode, toolx.BuiltinCreateTicketConfirmToolCode:
case toolx.BuiltinToolSearchToolCode, toolx.BuiltinCreateTicketConfirmToolCode, toolx.GraphCreateTicketConfirmToolCode:
return nil
}
serverCode, toolName := toolx.SplitMCPToolCode(toolCode)