Skip to content

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

Fix: dsl import/export (#13992)

Magicbook1108c5871c107892
diff --git a/test/testcases/test_web_api/test_chunk_feedback/__init__.py b/test/testcases/test_web_api/test_chunk_feedback/__init__.py
index 177b91dd05..1a080087ba 100644
--- a/test/testcases/test_web_api/test_chunk_feedback/__init__.py
+++ b/test/testcases/test_web_api/test_chunk_feedback/__init__.py
@@ -12,4 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
+
+from rag.flow.chunker.token_chunker import TokenChunker, TokenChunkerParam
+
+__all__ = ["TokenChunker", "TokenChunkerParam"]
diff --git a/web/src/pages/agents/use-import-json.ts b/web/src/pages/agents/use-import-json.ts
index 091d205982..6cda708731 100644
--- a/web/src/pages/agents/use-import-json.ts
+++ b/web/src/pages/agents/use-import-json.ts
@@ -8,6 +8,7 @@ import { Node } from '@xyflow/react';
import isEmpty from 'lodash/isEmpty';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
+import { buildDslComponentsByGraph } from '../agent/utils';
import { DataflowEmptyDsl } from './hooks/use-create-agent';
import { FormSchemaType } from './upload-agent-dialog/upload-agent-form';
@@ -65,6 +66,14 @@ export const useHandleImportJsonFile = () => {
dsl.variables = graphOrDsl.variables;
}
+ if (Array.isArray(graph?.nodes) && Array.isArray(graph?.edges)) {
+ dsl.components = buildDslComponentsByGraph(
+ graph.nodes as any,
+ graph.edges as any,
+ graphOrDsl.components ?? dsl.components,
+ );
+ }
+
setAgent({
title: name,
dsl,