Fix: Fixed the issue where the drop-down box could not be displayed after selecting a large model #9869 (#10205)

### What problem does this PR solve?

Fix: Fixed the issue where the drop-down box could not be displayed
after selecting a large model #9869

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2025-09-22 17:16:34 +08:00
committed by GitHub
parent 476852e8f1
commit 73c33bc8d2
17 changed files with 180 additions and 205 deletions

View File

@ -1,12 +1,14 @@
import { useSendMessageBySSE } from '@/hooks/use-send-message';
import api from '@/utils/api';
import { useCallback } from 'react';
import { get } from 'lodash';
import { useCallback, useState } 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 [messageId, setMessageId] = useState();
const { handleRun: saveGraph, loading } =
useSaveGraphBeforeOpeningDebugDrawer(showLogSheet!);
@ -22,12 +24,21 @@ export function useRunDataflow(showLogSheet: () => void) {
files: [fileResponseData.file],
});
if (res && res?.response.status === 200 && res?.data?.code === 0) {
if (res && res?.response.status === 200 && get(res, 'data.code') === 0) {
// fetch canvas
const msgId = get(res, 'data.data.message_id');
if (msgId) {
setMessageId(msgId);
}
return msgId;
}
},
[id, saveGraph, send],
);
return { run, loading: loading };
return { run, loading: loading, messageId };
}
export type RunDataflowType = ReturnType<typeof useRunDataflow>;