55 lines
1.2 KiB
Go
55 lines
1.2 KiB
Go
package tools_bot
|
|
|
|
import (
|
|
"ai_scheduler/internal/config"
|
|
"ai_scheduler/internal/entitys"
|
|
"ai_scheduler/internal/pkg/utils_ollama"
|
|
"context"
|
|
)
|
|
|
|
type BotTool struct {
|
|
config config.ToolConfig
|
|
llm *utils_ollama.Client
|
|
}
|
|
|
|
// NewBotTool 创建直连天下订单详情工具
|
|
func NewBotTool(config config.ToolConfig, llm *utils_ollama.Client) *BotTool {
|
|
return &BotTool{config: config, llm: llm}
|
|
}
|
|
|
|
// Name 返回工具名称
|
|
func (w *BotTool) Name() string {
|
|
return "DingTalkBotTool"
|
|
}
|
|
|
|
// Description 返回工具描述
|
|
func (w *BotTool) Description() string {
|
|
return "钉钉机器人调用"
|
|
}
|
|
|
|
// Definition 返回工具定义
|
|
func (w *BotTool) Definition() entitys.ToolDefinition {
|
|
return entitys.ToolDefinition{
|
|
Type: "function",
|
|
Function: entitys.FunctionDef{
|
|
Name: w.Name(),
|
|
Description: w.Description(),
|
|
Parameters: map[string]interface{}{
|
|
"type": "object",
|
|
"properties": map[string]interface{}{
|
|
"number": map[string]interface{}{
|
|
"type": "string",
|
|
"description": "订单编号/流水号",
|
|
},
|
|
},
|
|
"required": []string{"number"},
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
// Execute 执行直连天下订单详情查询
|
|
func (w *BotTool) Execute(ctx context.Context, requireData *entitys.RequireData) (err error) {
|
|
return
|
|
}
|