Feat: Upload files on the data flow page #9869 (#10153)

### What problem does this PR solve?

Feat: Upload files on the data flow page #9869

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-09-18 16:19:53 +08:00
committed by GitHub
parent e82617f6de
commit 5c1791d7f0
9 changed files with 112 additions and 157 deletions

View File

@ -0,0 +1,34 @@
import { useSendMessageBySSE } from '@/hooks/use-send-message';
import api from '@/utils/api';
import { useCallback } from 'react';
import { useParams } from 'umi';
import { useSaveGraphBeforeOpeningDebugDrawer } from './use-save-graph';
export function useRunDataflow(showLogSheet: () => void) {
const { send } = useSendMessageBySSE(api.runCanvas);
const { id } = useParams();
const { handleRun: saveGraph, loading } =
useSaveGraphBeforeOpeningDebugDrawer(showLogSheet!);
const run = useCallback(
async (fileResponseData: Record<string, any>) => {
const success = await saveGraph();
if (!success) return;
const res = await send({
id,
query: '',
session_id: null,
inputs: fileResponseData,
});
console.log('🚀 ~ useRunDataflow ~ res:', res);
if (res && res?.response.status === 200 && res?.data?.code === 0) {
// fetch canvas
}
},
[id, saveGraph, send],
);
return { run, loading: loading };
}