From bb1cfed16043d5cdf856c3dae68b55f33be8b504 Mon Sep 17 00:00:00 2001 From: renzhiyuan <465386466@qq.com> Date: Mon, 19 Jan 2026 10:16:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E8=B4=9F=E5=88=A9?= =?UTF-8?q?=E6=B6=A6=E5=88=86=E6=9E=90=E5=92=8C=E7=BC=93=E5=AD=98=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/pkg/utils_ollama/client.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/pkg/utils_ollama/client.go b/internal/pkg/utils_ollama/client.go index febd8cd..16928f6 100644 --- a/internal/pkg/utils_ollama/client.go +++ b/internal/pkg/utils_ollama/client.go @@ -8,6 +8,7 @@ import ( "net/url" "os" "sync" + "time" "github.com/ollama/ollama/api" ) @@ -43,11 +44,12 @@ func (c *Client) ToolSelect(ctx context.Context, messages []api.Message, tools [ // 构建聊天请求 req := &api.ChatRequest{ - Model: c.config.Model, - Messages: messages, - Stream: new(bool), // 设置为false,不使用流式响应 - Think: &api.ThinkValue{Value: false}, - Tools: tools, + Model: c.config.Model, + Messages: messages, + Stream: new(bool), // 设置为false,不使用流式响应 + Think: &api.ThinkValue{Value: false}, + Tools: tools, + KeepAlive: &api.Duration{Duration: 24 * time.Hour}, } err = c.client.Chat(ctx, req, func(resp api.ChatResponse) error { res = resp