From 50a51939222279985986331b125b1c06fdb49a7e Mon Sep 17 00:00:00 2001 From: renzhiyuan <465386466@qq.com> Date: Mon, 22 Sep 2025 20:38:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E6=9E=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/biz/router_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/biz/router_test.go b/internal/biz/router_test.go index b636e90..7e056a5 100644 --- a/internal/biz/router_test.go +++ b/internal/biz/router_test.go @@ -5,6 +5,7 @@ import ( "ai_scheduler/internal/data/impl" "ai_scheduler/internal/data/model" "ai_scheduler/internal/entitys" + "ai_scheduler/internal/pkg" "ai_scheduler/internal/pkg/utils_ollama" "ai_scheduler/internal/tools" "ai_scheduler/utils" @@ -53,27 +54,30 @@ func Test_OrderLog(t *testing.T) { } func in() *AiRouterBiz { + modDir, err := getModuleDir() if err != nil { panic("1") } configPath := flag.String("config", fmt.Sprintf("%s/config/config.yaml", modDir), "Path to configuration file") flag.Parse() + configConfig, err := config.LoadConfig(*configPath) if err != nil { panic("加载配置失败") } + client, _, err := utils_ollama.NewClient(configConfig) allLogger := log.DefaultLogger() utilOllama := utils_ollama.NewUtilOllama(configConfig, allLogger) - manager := tools.NewManager(configConfig, utilOllama) + manager := tools.NewManager(configConfig, client) db, _ := utils.NewGormDb(configConfig) sessionImpl := impl.NewSessionImpl(db) sysImpl := impl.NewSysImpl(db) taskImpl := impl.NewTaskImpl(db) chatImpl := impl.NewChatImpl(db) - - routerBiz := NewAiRouterBiz(manager, sessionImpl, sysImpl, taskImpl, chatImpl, configConfig, utilOllama) + safeChannelPool, _ := pkg.NewSafeChannelPool(configConfig) + routerBiz := NewAiRouterBiz(manager, sessionImpl, sysImpl, taskImpl, chatImpl, configConfig, utilOllama, safeChannelPool) return routerBiz }