Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix(service): allow updating memory_type when memory is empty (#16668)

euvre699a25c19cc7
diff --git a/build.sh b/build.sh
index 7f63d94d65..04c683cd51 100755
--- a/build.sh
+++ b/build.sh
@@ -439,7 +439,7 @@ run() {
sleep 1
print_section "Starting RAGFlow server (foreground)"
- "$RAGFLOW_SERVER_BINARY" -- api
+ "$RAGFLOW_SERVER_BINARY" --api
}
# Show help
diff --git a/internal/service/memory.go b/internal/service/memory.go
index e1f59aaee7..51250113fa 100644
--- a/internal/service/memory.go
+++ b/internal/service/memory.go
@@ -671,15 +671,20 @@ func (s *MemoryService) UpdateMemory(tenantID string, memoryID string, req *Upda
return formatRetDataFromMemory(currentMemory), nil
}
- memorySize := currentMemory.MemorySize
notAllowedUpdate := []string{}
for _, f := range []string{"tenant_embd_id", "embd_id", "memory_type"} {
- if _, ok := updateDict[f]; ok && memorySize > 0 {
+ if _, ok := updateDict[f]; ok {
notAllowedUpdate = append(notAllowedUpdate, f)
}
}
if len(notAllowedUpdate) > 0 {
- return nil, fmt.Errorf("can't update %v when memory isn't empty", notAllowedUpdate)
+ messages, err := s.listMemoryMessages(context.Background(), currentMemory, []string{}, "", 1, 1)
+ if err != nil {
+ return nil, fmt.Errorf("failed to check memory messages: %w", err)
+ }
+ if total, ok := messages["total_count"].(int64); ok && total > 0 {
+ return nil, fmt.Errorf("can't update %v when memory isn't empty", notAllowedUpdate)
+ }
}
if _, ok := updateDict["memory_type"]; ok {
diff --git a/web/.env.development b/web/.env.development
index bc3a847707..9131e59a77 100644
--- a/web/.env.development
+++ b/web/.env.development
@@ -1,2 +1,2 @@
VITE_BASE_URL='/'
-API_PROXY_SCHEME='python'
\ No newline at end of file
+API_PROXY_SCHEME='go'