From f41aa8b4537a9d64fdd3c1cc65acb0e9c7fc7d78 Mon Sep 17 00:00:00 2001 From: titor Date: Mon, 27 Apr 2026 08:03:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=20session=20=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=BB=A7=E6=89=BF=E5=92=8C=E5=BC=82=E6=AD=A5=E5=90=91?= =?UTF-8?q?=E9=87=8F=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/hxclaw/internal/memory/save.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/cmd/hxclaw/internal/memory/save.go b/cmd/hxclaw/internal/memory/save.go index 539b779..8ae9877 100644 --- a/cmd/hxclaw/internal/memory/save.go +++ b/cmd/hxclaw/internal/memory/save.go @@ -27,12 +27,7 @@ func GetContextPrompt(userInput string) string { session := currentSession if session == nil { - var err error - session, err = db.GetLatestSession() - if err != nil || session == nil { - return "" - } - currentSession = session + return "" // 没有 session,不提供上下文 } var context string @@ -254,7 +249,7 @@ func SaveChat(userInput, aiReply string, useSessionSummary bool) (int, error) { // 生成并保存向量 vs := GetVectorService() if vs != nil && memoryCfg.Vector.APIKey != "" { - go generateEmbedding(chat) + generateEmbedding(chat) } if err := db.UpdateChat(chat); err != nil { @@ -272,7 +267,7 @@ func SaveChat(userInput, aiReply string, useSessionSummary bool) (int, error) { // Session 也要生成向量 if vs != nil && memoryCfg.Vector.APIKey != "" && useSessionSummary { - go generateSessionEmbedding(session) + generateSessionEmbedding(session) } if err := db.UpdateSession(session); err != nil {