mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Supports to debug single component in Agent. #3993 Fix: The github button on the login page is displayed incorrectly #4002 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { ResponseType } from '@/interfaces/database/base';
|
||||
import { DSL, IFlow, IFlowTemplate } from '@/interfaces/database/flow';
|
||||
import { IDebugSingleRequestBody } from '@/interfaces/request/flow';
|
||||
import i18n from '@/locales/config';
|
||||
import flowService from '@/services/flow-service';
|
||||
import { buildMessageListWithUuid } from '@/utils/chat';
|
||||
@ -220,3 +221,50 @@ export const useTestDbConnect = () => {
|
||||
|
||||
return { data, loading, testDbConnect: mutateAsync };
|
||||
};
|
||||
|
||||
export const useFetchInputElements = (componentId?: string) => {
|
||||
const { id } = useParams();
|
||||
|
||||
const { data, isPending: loading } = useQuery({
|
||||
queryKey: ['fetchInputElements', id, componentId],
|
||||
initialData: [],
|
||||
enabled: !!id && !!componentId,
|
||||
retryOnMount: false,
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
gcTime: 0,
|
||||
queryFn: async () => {
|
||||
try {
|
||||
const { data } = await flowService.getInputElements({
|
||||
id,
|
||||
component_id: componentId,
|
||||
});
|
||||
return data?.data ?? [];
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ queryFn: ~ error:', error);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return { data, loading };
|
||||
};
|
||||
|
||||
export const useDebugSingle = () => {
|
||||
const { id } = useParams();
|
||||
const {
|
||||
data,
|
||||
isPending: loading,
|
||||
mutateAsync,
|
||||
} = useMutation({
|
||||
mutationKey: ['debugSingle'],
|
||||
mutationFn: async (params: IDebugSingleRequestBody) => {
|
||||
const ret = await flowService.debugSingle({ id, ...params });
|
||||
if (ret?.data?.code !== 0) {
|
||||
message.error(ret?.data?.message);
|
||||
}
|
||||
return ret?.data?.data;
|
||||
},
|
||||
});
|
||||
|
||||
return { data, loading, debugSingle: mutateAsync };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user