Skip to content

Commit

Permalink
feat:Optimized code
Browse files Browse the repository at this point in the history
  • Loading branch information
严志勇 committed Sep 4, 2024
1 parent bc87dec commit 37aed53
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 24 deletions.
6 changes: 3 additions & 3 deletions web/components/flow/canvas-node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ const CanvasNode: React.FC<CanvasNodeProps> = ({ data }) => {
className={classNames(
'h-auto rounded-xl shadow-md px-2 py-4 border bg-white dark:bg-zinc-800 cursor-grab flex flex-col space-y-2 text-sm',
{
'w-80':node.tags.ui_size === 'middle' || !node.tags.ui_size,
'w-256':node.tags.ui_size === 'small',
'w-530':node.tags.ui_size === 'large',
'w-80':node?.tags?.ui_size === 'middle' || !node?.tags?.ui_size,
'w-[256px]':node?.tags?.ui_size === 'small',
'w-[530px]':node?.tags?.ui_size === 'large',
'border-blue-500': node.selected || isHovered,
'border-stone-400 dark:border-white': !node.selected && !isHovered,
'border-dashed': flowType !== 'operator',
Expand Down
14 changes: 3 additions & 11 deletions web/components/flow/node-renderer/upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export const renderUpload = (params: Props) => {
})
}
setFileList(urlList)
}).catch((res)=>{
debugger
}).catch((error)=>{
console.log(error)
})
}

Expand Down Expand Up @@ -104,19 +104,11 @@ export const renderUpload = (params: Props) => {

return (
<div className='p-2 text-sm text-center'>
{data.is_list ? (
<Upload fileList={fileList} onRemove={handleFileRemove} {...props} {...attr} multiple={true} accept={uploadType}>
<Upload fileList={fileList} onRemove={handleFileRemove} {...props} {...attr} multiple={data.is_list?true:false} accept={uploadType}>
<Button loading={uploading} icon={<UploadOutlined />}>
{t('Upload_Data')}
</Button>
</Upload>
) : (
<Upload fileList={fileList} onRemove={handleFileRemove} {...props} {...attr} multiple={false} accept={uploadType}>
<Button loading={uploading} icon={<UploadOutlined />}>
{t('Upload_Data')}
</Button>
</Upload>
)}
</div>
);
};
9 changes: 2 additions & 7 deletions web/pages/construct/flow/canvas/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ import 'reactflow/dist/style.css';

const nodeTypes = { customNode: CanvasNode };
const edgeTypes = { buttonedge: ButtonEdge };
let importData :any= null
const Canvas: React.FC = (props:any) => {
const Canvas: React.FC = () => {

const { t } = useTranslation();
const [messageApi, contextHolder] = message.useMessage();
Expand Down Expand Up @@ -297,11 +296,7 @@ const Canvas: React.FC = (props:any) => {
);
};

export default function CanvasWrapper(data:any) {

importData = data
console.log(importData);

export default function CanvasWrapper() {
return (
<ReactFlowProvider>
<Canvas />
Expand Down
6 changes: 3 additions & 3 deletions web/utils/ctx-axios.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import axios from 'axios';

const api = axios.create({
baseURL: process.env.API_BASE_URL,
baseURL: 'http://127.0.0.1:5670'
});

api.defaults.timeout = 10000;

api.interceptors.response.use(
response => response.data,
err => Promise.reject(err),
err => Promise.reject(err)
);

export default api;
export default api;

0 comments on commit 37aed53

Please sign in to comment.