Skip to content

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

fix(agent): accept typed slices in ListOperations (#21252)

Sbaaoui Idrisscc44424e7c45
diff --git a/internal/agent/component/list_operations.go b/internal/agent/component/list_operations.go
index 5d90cc8bda..bf4083b759 100644
--- a/internal/agent/component/list_operations.go
+++ b/internal/agent/component/list_operations.go
@@ -38,6 +38,7 @@ import (
"encoding/json"
"fmt"
"ragflow/internal/common"
+ "reflect"
"sort"
"strings"
@@ -289,7 +290,14 @@ func (l *ListOperationsComponent) Invoke(ctx context.Context, db *gorm.DB, _ map
if raw == nil {
items = []any{}
} else {
- return nil, fmt.Errorf("ListOperations: input is not a list (got %T)", raw)
+ rv := reflect.ValueOf(raw)
+ if rv.Kind() != reflect.Slice && rv.Kind() != reflect.Array {
+ return nil, fmt.Errorf("ListOperations: input is not a list (got %T)", raw)
+ }
+ items = make([]any, rv.Len())
+ for i := range items {
+ items[i] = rv.Index(i).Interface()
+ }
}
}
// A typed nil []any satisfies the assertion above (ok=true, items=nil)