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 }