mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-09 12:54:47 +08:00
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:
@@ -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"]
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user