mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-26 17:16:52 +08:00
### What problem does this PR solve? Feat: Run eslint when the project is running to standardize everyone's code #9377 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -3,7 +3,7 @@ import {
|
||||
KeywordIcon,
|
||||
QWeatherIcon,
|
||||
WikipediaIcon,
|
||||
} from '@/assets/icon/Icon';
|
||||
} from '@/assets/icon/next-icon';
|
||||
import { ReactComponent as AkShareIcon } from '@/assets/svg/akshare.svg';
|
||||
import { ReactComponent as ArXivIcon } from '@/assets/svg/arxiv.svg';
|
||||
import { ReactComponent as baiduFanyiIcon } from '@/assets/svg/baidu-fanyi.svg';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { CommaIcon, SemicolonIcon } from '@/assets/icon/Icon';
|
||||
import { CommaIcon, SemicolonIcon } from '@/assets/icon/next-icon';
|
||||
import { Form, Select } from 'antd';
|
||||
import {
|
||||
CornerDownLeft,
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import { Edge } from '@xyflow/react';
|
||||
import pick from 'lodash/pick';
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import { IOperatorForm } from '../../interface';
|
||||
@ -21,8 +20,8 @@ export const useBuildRelevantOptions = () => {
|
||||
return buildRelevantOptions;
|
||||
};
|
||||
|
||||
const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
|
||||
edges.find((x) => x.sourceHandle === sourceHandle)?.target;
|
||||
// const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
|
||||
// edges.find((x) => x.sourceHandle === sourceHandle)?.target;
|
||||
|
||||
/**
|
||||
* monitor changes in the connection and synchronize the target to the yes and no fields of the form
|
||||
@ -30,7 +29,7 @@ const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
|
||||
* @param param0
|
||||
*/
|
||||
export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
|
||||
const edges = useGraphStore((state) => state.edges);
|
||||
// const edges = useGraphStore((state) => state.edges);
|
||||
const getNode = useGraphStore((state) => state.getNode);
|
||||
const node = getNode(nodeId);
|
||||
|
||||
@ -40,12 +39,12 @@ export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
|
||||
}
|
||||
}, [node, form]);
|
||||
|
||||
const watchConnectionChanges = useCallback(() => {
|
||||
const edgeList = edges.filter((x) => x.source === nodeId);
|
||||
const yes = getTargetOfEdge(edgeList, 'yes');
|
||||
const no = getTargetOfEdge(edgeList, 'no');
|
||||
form?.setFieldsValue({ yes, no });
|
||||
}, [edges, nodeId, form]);
|
||||
// const watchConnectionChanges = useCallback(() => {
|
||||
// const edgeList = edges.filter((x) => x.source === nodeId);
|
||||
// const yes = getTargetOfEdge(edgeList, 'yes');
|
||||
// const no = getTargetOfEdge(edgeList, 'no');
|
||||
// form?.setFieldsValue({ yes, no });
|
||||
// }, [edges, nodeId, form]);
|
||||
|
||||
useEffect(() => {
|
||||
watchFormChanges();
|
||||
|
||||
@ -50,10 +50,14 @@ export const useSaveGraphBeforeOpeningDebugDrawer = (show: () => void) => {
|
||||
};
|
||||
|
||||
export const useWatchAgentChange = (chatDrawerVisible: boolean) => {
|
||||
console.log(
|
||||
'🚀 ~ useWatchAgentChange ~ chatDrawerVisible:',
|
||||
chatDrawerVisible,
|
||||
);
|
||||
const [time, setTime] = useState<string>();
|
||||
const nodes = useGraphStore((state) => state.nodes);
|
||||
const edges = useGraphStore((state) => state.edges);
|
||||
const { saveGraph } = useSaveGraph();
|
||||
// const { saveGraph } = useSaveGraph();
|
||||
const { data: flowDetail } = useFetchFlow();
|
||||
|
||||
const setSaveTime = useCallback((updateTime: number) => {
|
||||
@ -64,12 +68,12 @@ export const useWatchAgentChange = (chatDrawerVisible: boolean) => {
|
||||
setSaveTime(flowDetail?.update_time);
|
||||
}, [flowDetail, setSaveTime]);
|
||||
|
||||
const saveAgent = useCallback(async () => {
|
||||
if (!chatDrawerVisible) {
|
||||
const ret = await saveGraph();
|
||||
setSaveTime(ret.data.update_time);
|
||||
}
|
||||
}, [chatDrawerVisible, saveGraph, setSaveTime]);
|
||||
// const saveAgent = useCallback(async () => {
|
||||
// if (!chatDrawerVisible) {
|
||||
// const ret = await saveGraph();
|
||||
// setSaveTime(ret.data.update_time);
|
||||
// }
|
||||
// }, [chatDrawerVisible, saveGraph, setSaveTime]);
|
||||
|
||||
useDebounceEffect(
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user