Files
ai-agent/internal/ai/runtime/tools/helper.go
T
mlogclub 5d7c10aeab refactor: rename agent widget references to AI agent for consistency
- Updated runtime configuration to use __CS_AI_AGENT_WIDGET_CONFIG__ instead of __CS_AGENT_WIDGET_CONFIG__.
- Changed message types in support host bridge from "cs-agent" to "cs-ai-agent".
- Minified SDK script updated to reflect new AI agent naming conventions.
- Adjusted scrollbar styles in main.scss to use .cs-ai-agent-scrollbar instead of .cs-agent-scrollbar.
2026-05-30 21:19:36 +08:00

53 lines
1.3 KiB
Go

package tools
import (
"strings"
"cs-ai-agent/internal/ai/runtime/registry"
"cs-ai-agent/internal/pkg/toolx"
)
type Decision string
const (
DecisionConfirm Decision = "confirm"
DecisionCancel Decision = "cancel"
)
func ParseConfirmationDecision(value string) Decision {
value = strings.ToLower(strings.TrimSpace(value))
if value == "" {
return ""
}
confirmWords := []string{"确认", "是", "好的", "可以", "ok", "yes", "继续", "同意"}
for _, item := range confirmWords {
if strings.Contains(value, item) {
return DecisionConfirm
}
}
cancelWords := []string{"取消", "不用", "不需要", "算了", "no"}
for _, item := range cancelWords {
if strings.Contains(value, item) {
return DecisionCancel
}
}
return ""
}
func NewRuntimeStaticTool(toolCode string) registry.Tool {
switch toolx.NormalizeToolCodeAlias(strings.TrimSpace(toolCode)) {
case toolx.GraphTriageServiceRequest.Code:
return NewTriageServiceRequestTool()
case toolx.GraphAnalyzeConversation.Code:
return NewAnalyzeConversationTool()
case toolx.GraphPrepareTicketDraft.Code:
return NewPrepareTicketDraftTool()
case toolx.GraphCreateTicketConfirm.Code:
return NewCreateTicketGraphTool()
case toolx.GraphHandoffConversation.Code:
return NewHandoffGraphTool()
default:
return nil
}
}