Files
ai-agent/internal/ai/runtime/tools/helper.go
T
t 2bbf42b741 refactor(auth): delegate access control to be-system
Remove Agent Desk users, roles, login sessions, tokens, and local permission persistence. Expose the backend as an embeddable ai-agent module with host-provided subject lookup and operation authorization callbacks, and complete the frontend/backend repository split.
2026-08-21 00:41:07 +08:00

53 lines
1.3 KiB
Go

package tools
import (
"strings"
"code.tczkiot.com/wlw/ai-agent/internal/ai/runtime/registry"
"code.tczkiot.com/wlw/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
}
}