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

This commit is contained in:
euvre
2026-07-08 10:03:58 +08:00
committed by GitHub
parent 0ae5961e1c
commit 699a25c19c
3 changed files with 10 additions and 5 deletions

View File

@@ -439,7 +439,7 @@ run() {
sleep 1
print_section "Starting RAGFlow server (foreground)"
"$RAGFLOW_SERVER_BINARY" -- api
"$RAGFLOW_SERVER_BINARY" --api
}
# Show help

View File

@@ -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 {

View File

@@ -1,2 +1,2 @@
VITE_BASE_URL='/'
API_PROXY_SCHEME='python'
API_PROXY_SCHEME='go'