feat: catch errors when sending messages #918 (#1113)

### What problem does this PR solve?

feat: catch errors when sending messages #918

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-06-11 15:46:12 +08:00
committed by GitHub
parent e28d13e3b4
commit 8902d92d0e
10 changed files with 51 additions and 44 deletions

View File

@ -2,7 +2,6 @@ import { useSetModalState } from '@/hooks/commonHooks';
import {
useFetchFlow,
useFetchFlowTemplates,
useRunFlow,
useSetFlow,
} from '@/hooks/flow-hooks';
import { useFetchLlmList } from '@/hooks/llmHooks';
@ -216,19 +215,3 @@ export const useFetchDataOnMount = () => {
export const useFlowIsFetching = () => {
return useIsFetching({ queryKey: ['flowDetail'] }) > 0;
};
export const useRunGraph = () => {
const { data } = useFetchFlow();
const { runFlow } = useRunFlow();
const { id } = useParams();
const { nodes, edges } = useGraphStore((state) => state);
const runGraph = useCallback(() => {
const dslComponents = buildDslComponentsByGraph(nodes, edges);
runFlow({
id: id!!,
dsl: { ...data.dsl, components: dslComponents },
});
}, [nodes, edges, runFlow, id, data]);
return { runGraph };
};