Feat: Add agent-log-list page (#9076)

### What problem does this PR solve?

Fix: Add agent-log-list page And RAPTOR:Save directly after enabling,
incomplete form submission #3221

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
chanx
2025-07-30 09:48:51 +08:00
committed by GitHub
parent 39ef2ffba9
commit 4f8e7ef763
11 changed files with 627 additions and 17 deletions

View File

@ -54,6 +54,13 @@ export const useNavigatePage = () => {
[navigate],
);
const navigateToAgentLogs = useCallback(
(id: string) => () => {
navigate(`${Routes.AgentLogPage}/${id}`);
},
[navigate],
);
const navigateToAgentTemplates = useCallback(() => {
navigate(Routes.AgentTemplates);
}, [navigate]);
@ -120,6 +127,7 @@ export const useNavigatePage = () => {
navigateToChunk,
navigateToAgents,
navigateToAgent,
navigateToAgentLogs,
navigateToAgentTemplates,
navigateToSearchList,
navigateToSearch,

View File

@ -1,13 +1,20 @@
import { FileUploadProps } from '@/components/file-upload';
import message from '@/components/ui/message';
import { AgentGlobals } from '@/constants/agent';
import { ITraceData } from '@/interfaces/database/agent';
import {
IAgentLogsRequest,
IAgentLogsResponse,
ITraceData,
} from '@/interfaces/database/agent';
import { DSL, IFlow, IFlowTemplate } from '@/interfaces/database/flow';
import { IDebugSingleRequestBody } from '@/interfaces/request/agent';
import i18n from '@/locales/config';
import { BeginId } from '@/pages/agent/constant';
import { useGetSharedChatSearchParams } from '@/pages/chat/shared-hooks';
import agentService, { fetchTrace } from '@/services/agent-service';
import agentService, {
fetchAgentLogsByCanvasId,
fetchTrace,
} from '@/services/agent-service';
import api from '@/utils/api';
import { buildMessageListWithUuid } from '@/utils/chat';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
@ -558,3 +565,22 @@ export const useFetchAgentAvatar = (): {
return { data, loading, refetch };
};
export const useFetchAgentLog = (searchParams: IAgentLogsRequest) => {
const { id } = useParams();
const { data, isFetching: loading } = useQuery<IAgentLogsResponse>({
queryKey: ['fetchAgentLog', id, searchParams],
initialData: {} as IAgentLogsResponse,
gcTime: 0,
queryFn: async () => {
console.log('useFetchAgentLog', searchParams);
const { data } = await fetchAgentLogsByCanvasId(id as string, {
...searchParams,
});
return data?.data ?? [];
},
});
return { data, loading };
};