39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package tools_bot
|
|
|
|
import (
|
|
"ai_scheduler/internal/config"
|
|
"ai_scheduler/internal/data/constants"
|
|
errors "ai_scheduler/internal/data/error"
|
|
"ai_scheduler/internal/data/impl"
|
|
"ai_scheduler/internal/entitys"
|
|
"ai_scheduler/internal/pkg/utils_ollama"
|
|
"context"
|
|
|
|
"github.com/gofiber/fiber/v2/log"
|
|
)
|
|
|
|
type BotTool struct {
|
|
config *config.Config
|
|
llm *utils_ollama.Client
|
|
sessionImpl *impl.SessionImpl
|
|
taskMap map[string]string // task_id -> session_id
|
|
// zltxOrderAfterSaleTool tools.ZltxOrderAfterSaleTool
|
|
}
|
|
|
|
// NewBotTool 创建直连天下订单详情工具
|
|
func NewBotTool(config *config.Config, llm *utils_ollama.Client, sessionImpl *impl.SessionImpl) *BotTool {
|
|
return &BotTool{config: config, llm: llm, sessionImpl: sessionImpl, taskMap: make(map[string]string)}
|
|
}
|
|
|
|
// Execute 执行直连天下订单详情查询
|
|
func (w *BotTool) Execute(ctx context.Context, toolName string, requireData *entitys.RequireData) (err error) {
|
|
switch toolName {
|
|
case constants.BotToolsBugOptimizationSubmit:
|
|
err = w.BugOptimizationSubmit(ctx, requireData)
|
|
default:
|
|
log.Errorf("未知的工具类型:%s", toolName)
|
|
err = errors.ParamErr("未知的工具类型:%s", toolName)
|
|
}
|
|
return
|
|
}
|