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 {