diff --git a/web/features/agent-v2/agent-detail/configure/__tests__/page.spec.tsx b/web/features/agent-v2/agent-detail/configure/__tests__/page.spec.tsx index e40ddfadd0d..f452fe01f2e 100644 --- a/web/features/agent-v2/agent-detail/configure/__tests__/page.spec.tsx +++ b/web/features/agent-v2/agent-detail/configure/__tests__/page.spec.tsx @@ -6,6 +6,7 @@ const mocks = vi.hoisted(() => ({ queryState: { agent: { data: { + debug_conversation_id: 'debug-conversation-old', icon: 'agent', icon_background: '#E0F2FE', icon_type: 'emoji', @@ -107,7 +108,13 @@ vi.mock('../components/preview/chat-features-panel', () => ({ })) vi.mock('../components/preview/header', () => ({ - AgentPreviewHeader: () =>
, + AgentPreviewHeader: (props: { + onRestart: () => void + }) => ( + + ), })) vi.mock('../components/preview/versions-panel', () => ({ @@ -125,6 +132,7 @@ describe('AgentConfigurePage', () => { icon_background: '#E0F2FE', icon_type: 'emoji', name: 'Research Agent', + debug_conversation_id: 'debug-conversation-old', }, isFetching: false, isPending: false, diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/header.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/header.tsx index 2598949ba21..20d9b500d2f 100644 --- a/web/features/agent-v2/agent-detail/configure/components/preview/header.tsx +++ b/web/features/agent-v2/agent-detail/configure/components/preview/header.tsx @@ -1,18 +1,41 @@ 'use client' +import type { AgentAppDetailWithSite } from '@dify/contracts/api/console/agent/types.gen' import { cn } from '@langgenius/dify-ui/cn' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { useTranslation } from 'react-i18next' +import { consoleQuery } from '@/service/client' export function AgentPreviewHeader({ + agentId, isChatFeaturesOpen, onToggleChatFeatures, onRestart, }: { + agentId: string isChatFeaturesOpen: boolean onToggleChatFeatures: () => void onRestart: () => void }) { const { t } = useTranslation('agentV2') + const queryClient = useQueryClient() + const refreshDebugConversationMutation = useMutation(consoleQuery.agent.byAgentId.debugConversation.refresh.post.mutationOptions({ + onSuccess: ({ debug_conversation_id }) => { + queryClient.setQueryData