mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-24 12:45:45 +00:00
feat: import update canvas flow
This commit is contained in:
parent
03e3f93a95
commit
4edc64a4c9
@ -4,7 +4,7 @@ import { Button, Form, GetProp, Modal, Radio, Space, Upload, UploadFile, UploadP
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Edge, Node } from 'reactflow';
|
||||
|
||||
import CanvasWrapper from '@/pages/construct/flow/canvas/index';
|
||||
type Props = {
|
||||
isImportModalOpen: boolean;
|
||||
setNodes: React.Dispatch<React.SetStateAction<Node<any, string | undefined>[]>>;
|
||||
@ -37,9 +37,12 @@ export const ImportFlowModal: React.FC<Props> = ({ isImportModalOpen, setIsImpor
|
||||
const [, , res] = await apiInterceptors(importFlow(formData));
|
||||
|
||||
if (res?.success) {
|
||||
messageApi.success(t('Export_Flow_Success'));
|
||||
messageApi.success(t('Import_Flow_Success'));
|
||||
localStorage.setItem('importFlowData', JSON.stringify(res?.data));
|
||||
CanvasWrapper(res?.data)
|
||||
} else if (res?.err_msg) {
|
||||
messageApi.error(res?.err_msg);
|
||||
|
||||
}
|
||||
setIsImportFlowModalOpen(false);
|
||||
};
|
||||
|
@ -19,7 +19,6 @@ type CanvasNodeProps = {
|
||||
function TypeLabel({ label }: { label: string }) {
|
||||
return <div className='w-full h-8 align-middle font-semibold'>{label}</div>;
|
||||
}
|
||||
const forceTypeList = ['file', 'multiple_files', 'time'];
|
||||
|
||||
const CanvasNode: React.FC<CanvasNodeProps> = ({ data }) => {
|
||||
const node = data;
|
||||
@ -128,9 +127,6 @@ const CanvasNode: React.FC<CanvasNodeProps> = ({ data }) => {
|
||||
function onParameterValuesChange(changedValues: any, allValues: any) {
|
||||
const [changedKey, changedVal] = Object.entries(changedValues)[0];
|
||||
|
||||
if (!allValues?.force && forceTypeList.includes(changedKey)) {
|
||||
return;
|
||||
}
|
||||
updateCurrentNodeValue(changedKey, changedVal);
|
||||
if (changedVal) {
|
||||
updateDependsNodeValue(changedKey, changedVal);
|
||||
|
@ -16,6 +16,7 @@ export const renderUpload = (params: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const urlList = useRef<string[]>([]);
|
||||
const { data, formValuesChange } = params;
|
||||
console.log(data);
|
||||
|
||||
const attr = convertKeysToCamelCase(data.ui?.attr || {});
|
||||
const [uploading, setUploading] = useState(false);
|
||||
|
Loading…
Reference in New Issue
Block a user