mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-08 20:34:48 +08:00
fix(service): allow updating memory_type when memory is empty (#16668)
This commit is contained in:
2
build.sh
2
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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
VITE_BASE_URL='/'
|
||||
API_PROXY_SCHEME='python'
|
||||
API_PROXY_SCHEME='go'
|
||||
|
||||
Reference in New Issue
Block a user