Fix: dsl import/export (#13992)

### What problem does this PR solve?

Fix: dsl import/export
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Enhanced JSON import functionality for agents to automatically
populate components from imported graph structures.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Zhichang Yu <yuzhichang@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Magicbook1108
2026-04-09 10:55:22 +08:00
committed by GitHub
parent 82fa85c837
commit c5871c1078
2 changed files with 13 additions and 1 deletions

View File

@@ -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"]

View File

@@ -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,