feat(memory-management): implement server-side user preference for memory feature

Updated the memory management logic to utilize a server-side per-user preference for enabling memory. The `enable_memory` field is now conditionally set based on user preferences, allowing for better control in both normal and embedded contexts. Adjusted relevant API handlers and request structures to support this change, ensuring backward compatibility with existing clients.

Refs: #1303
This commit is contained in:
wizardchen
2026-05-18 11:27:09 +08:00
committed by lyingbug
parent 68ac7fb973
commit 5a91487322
4 changed files with 60 additions and 5 deletions
+3
View File
@@ -26,6 +26,7 @@ type Handler struct {
agentShareService interfaces.AgentShareService // Service for resolving shared agents (KB scope in retrieval)
fileService interfaces.FileService // Service for file storage (image uploads)
modelService interfaces.ModelService // Service for model management (VLM access)
userService interfaces.UserService // Service for resolving per-user preferences (e.g. enable_memory default)
attachmentProcessor *AttachmentProcessor // Processor for file attachments
}
@@ -41,6 +42,7 @@ func NewHandler(
agentShareService interfaces.AgentShareService,
fileService interfaces.FileService,
modelService interfaces.ModelService,
userService interfaces.UserService,
documentReader interfaces.DocumentReader,
imageResolver *docparser.ImageResolver,
) *Handler {
@@ -55,6 +57,7 @@ func NewHandler(
agentShareService: agentShareService,
fileService: fileService,
modelService: modelService,
userService: userService,
attachmentProcessor: NewAttachmentProcessor(
fileService,
documentReader,