From 3d575e031e8b6d7c60227d84ba4fe2709cd6786c Mon Sep 17 00:00:00 2001 From: Acbox Date: Sun, 15 Feb 2026 14:15:55 +0800 Subject: [PATCH] feat: run memory extraction in the background --- internal/conversation/flow/resolver.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/conversation/flow/resolver.go b/internal/conversation/flow/resolver.go index a7a3c101..a6cc848a 100644 --- a/internal/conversation/flow/resolver.go +++ b/internal/conversation/flow/resolver.go @@ -778,7 +778,9 @@ func (r *Resolver) storeRound(ctx context.Context, req conversation.ChatRequest, } r.storeMessages(ctx, req, fullRound) - r.storeMemory(ctx, req.BotID, fullRound) + // Run memory extraction in the background so that the SSE stream can + // finish immediately after messages are persisted. + go r.storeMemory(context.WithoutCancel(ctx), req.BotID, fullRound) return nil }