RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix: ignore empty dataset config when creating from a template (#19677)
Lynn9d5de1470c35
diff --git a/internal/agent/component/exesql_params.go b/internal/agent/component/exesql_params.goindex 7a16894179..2a1f5845b5 100644--- a/internal/agent/component/exesql_params.go+++ b/internal/agent/component/exesql_params.go@@ -44,6 +44,15 @@ func validateExeSQLParams(params map[string]any) error {return fmt.Errorf("Choose DB type %v is not supported, it should be in %v", dbType, exeSQLDBTypes)}+ // Templates ship ExeSQL nodes whose connection fields are all blank (see+ // agent/templates/text2sql_data_expert.json): the node is an unconfigured+ // scaffold the user fills in on the canvas, not a broken configuration.+ // Requiring the fields here would make such a canvas impossible to create+ // or save, so only a node the user started configuring is checked.+ if !exeSQLConnectionStarted(params) {+ return nil+ }+// Connection identity fields have no Python defaults and must be present.for _, field := range []struct {key string@@ -85,6 +94,17 @@ func validateExeSQLParams(params map[string]any) error {return nil}+// exeSQLConnectionStarted reports whether the user filled in at least one+// ExeSQL connection field. Blanks and absent keys both count as untouched.+func exeSQLConnectionStarted(params map[string]any) bool {+ for _, key := range []string{"database", "username", "host", "password"} {+ if isNonBlankString(params[key]) {+ return true+ }+ }+ return false+}+// exeSQLDBTypeAllowed reports whether dbType is one of exeSQLDBTypes.func exeSQLDBTypeAllowed(dbType string) bool {for _, candidate := range exeSQLDBTypes {diff --git a/internal/agent/component/exesql_params_test.go b/internal/agent/component/exesql_params_test.goindex 20b863144c..26d3053598 100644--- a/internal/agent/component/exesql_params_test.go+++ b/internal/agent/component/exesql_params_test.go@@ -44,11 +44,32 @@ func TestValidateDynamicEntriesExeSQL(t *testing.T) {t.Fatalf("valid trino ExeSQL DSL rejected: %v", err)}+ // Templates ship an ExeSQL scaffold with every connection field blank+ // (agent/templates/text2sql_data_expert.json); it must stay creatable+ // and savable until the user configures the connection.+ templateScaffold := dslWithComponents(componentDSL("ExeSQL", map[string]any{+ "db_type": "mysql",+ "database": "",+ "username": "",+ "host": "",+ "password": "",+ "port": 3306,+ "max_records": 1024,+ }))+ if err := ValidateDynamicEntries(templateScaffold); err != nil {+ t.Fatalf("unconfigured ExeSQL scaffold rejected: %v", err)+ }+tests := []struct {name stringcomponent map[string]anywant string}{+ {+ "scaffold with only host filled",+ componentDSL("ExeSQL", map[string]any{"db_type": "mysql", "database": "", "username": "", "host": "10.0.0.5", "password": ""}),+ "[ExeSQL] Database name does not support empty value",+ },{"unsupported db_type",componentDSL("ExeSQL", map[string]any{"db_type": "oracle", "database": "d", "username": "u", "host": "h", "password": "p"}),