fix: 移除 session 自动继承和异步向量生成

This commit is contained in:
2026-04-27 08:03:16 +08:00
parent b95518e787
commit f41aa8b453

View File

@@ -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 {