fix: 延迟创建 session,只在用户真正对话时才创建

This commit is contained in:
2026-04-27 08:00:20 +08:00
parent 3b8ffad2d5
commit b95518e787
2 changed files with 9 additions and 9 deletions

View File

@@ -279,6 +279,11 @@ func runWithStreaming(agentLoop *agent.AgentLoop, input, sessionKey string, temp
memoryCfg = internal.GetProjectConfig().Memory
if memoryCfg.Enabled {
chatCount, saveErr = memory.SaveChat(originalInput, resp, !memory.ShouldSkipSummaryUpdate(originalInput))
// 如果需要新 session提示用户
if saveErr == memory.ErrNeedNewSession {
fmt.Println("请使用 /new 创建新会话后再对话")
saveErr = nil
}
}
elapsed := time.Since(startTime)