mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-16 12:47:19 +08:00
fix(agent): return DataOperations input form (#16930)
## Summary - return the input form collected by `DataOperationsComponent.GetInputForm` - add a regression test covering system variables, component outputs, and duplicate references
This commit is contained in:
@@ -279,7 +279,7 @@ func (d *DataOperationsComponent) GetInputForm() map[string]any {
|
||||
}
|
||||
}
|
||||
}
|
||||
return map[string]any{}
|
||||
return res
|
||||
}
|
||||
|
||||
// Outputs returns the transformed payload.
|
||||
|
||||
@@ -24,6 +24,34 @@ import (
|
||||
"ragflow/internal/agent/canvas"
|
||||
)
|
||||
|
||||
func TestDataOperations_GetInputForm(t *testing.T) {
|
||||
c, err := NewDataOperationsComponent(map[string]any{
|
||||
"query": []string{
|
||||
"{{sys.query}}",
|
||||
"{{CodeExec:Run@result}}",
|
||||
"{{sys.query}}",
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("NewDataOperationsComponent: %v", err)
|
||||
}
|
||||
|
||||
got := c.(*DataOperationsComponent).GetInputForm()
|
||||
want := map[string]any{
|
||||
"sys.query": map[string]any{
|
||||
"name": "sys.query",
|
||||
"type": "line",
|
||||
},
|
||||
"CodeExec:Run@result": map[string]any{
|
||||
"name": "CodeExec:Run@result",
|
||||
"type": "line",
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("GetInputForm = %#v, want %#v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
// TestDataOperations_SelectKeys: keep only specified keys.
|
||||
func TestDataOperations_SelectKeys(t *testing.T) {
|
||||
c, err := NewDataOperationsComponent(map[string]any{
|
||||
|
||||
Reference in New Issue
Block a user