diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/__tests__/working-directory-panel.spec.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/__tests__/working-directory-panel.spec.tsx index f930da07b27..c96bc5564e8 100644 --- a/web/features/agent-v2/agent-detail/configure/components/preview/__tests__/working-directory-panel.spec.tsx +++ b/web/features/agent-v2/agent-detail/configure/components/preview/__tests__/working-directory-panel.spec.tsx @@ -350,7 +350,7 @@ describe('AgentWorkingDirectoryPanel', () => { ) }) - it('should separate saved and temporary files by their sandbox path roots', async () => { + it('should separate persistent and temporary files by their sandbox path roots', async () => { const user = userEvent.setup() mocks.sandboxFilesQueryOptions.mockImplementation(({ input }: QueryOptionsInput) => ({ queryKey: ['sandbox-files-by-root', input], @@ -364,17 +364,17 @@ describe('AgentWorkingDirectoryPanel', () => { })) renderWorkingDirectoryPanel() - const savedFilesTab = await screen.findByRole('tab', { - name: 'agentV2.agentDetail.configure.workingDirectory.savedFiles', + const persistentFilesTab = await screen.findByRole('tab', { + name: 'agentV2.agentDetail.configure.workingDirectory.persistentFiles', }) const temporaryFilesTab = screen.getByRole('tab', { name: 'agentV2.agentDetail.configure.workingDirectory.temporaryFiles', }) - expect(savedFilesTab).toHaveAttribute('aria-selected', 'true') + expect(persistentFilesTab).toHaveAttribute('aria-selected', 'true') expect( await screen.findByRole('tabpanel', { - name: 'agentV2.agentDetail.configure.workingDirectory.savedFiles', + name: 'agentV2.agentDetail.configure.workingDirectory.persistentFiles', }), ).toBeInTheDocument() await waitFor(() => { @@ -464,6 +464,30 @@ describe('AgentWorkingDirectoryPanel', () => { }) }) + it('should explain the lifetime of persistent and temporary files', async () => { + const user = userEvent.setup() + renderWorkingDirectoryPanel() + + const persistentFilesTooltip = + 'agentV2.agentDetail.configure.workingDirectory.persistentFilesTooltip' + const temporaryFilesTooltip = + 'agentV2.agentDetail.configure.workingDirectory.temporaryFilesTooltip' + + await user.click( + await screen.findByRole('button', { + name: persistentFilesTooltip, + }), + ) + expect(await screen.findByText(persistentFilesTooltip)).toBeInTheDocument() + + await user.click( + screen.getByRole('button', { + name: temporaryFilesTooltip, + }), + ) + expect(await screen.findByText(temporaryFilesTooltip)).toBeInTheDocument() + }) + it('should download binary working directory files from the unsupported preview download link', async () => { const user = userEvent.setup() const download = createDeferred<{ url: string }>() diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx index bf3fc94ae6c..3abf047d8fe 100644 --- a/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx +++ b/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx @@ -17,6 +17,7 @@ import { toast } from '@langgenius/dify-ui/toast' import { skipToken, useMutation, useQueries, useQuery } from '@tanstack/react-query' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' +import { Infotip } from '@/app/components/base/infotip' import { consoleClient, consoleQuery } from '@/service/client' import { downloadUrl } from '@/utils/download' import { getFileIconType } from '../orchestrate/files/file-icon' @@ -245,6 +246,12 @@ export function AgentWorkingDirectoryPanel({ }: AgentWorkingDirectoryPanelProps) { const { t } = useTranslation('agentV2') const { t: tCommon } = useTranslation('common') + const persistentFilesTooltip = t( + ($) => $['agentDetail.configure.workingDirectory.persistentFilesTooltip'], + ) + const temporaryFilesTooltip = t( + ($) => $['agentDetail.configure.workingDirectory.temporaryFilesTooltip'], + ) const [selectedDirectoryPath, setSelectedDirectoryPath] = useState( AGENT_SAVED_FILES_ROOT_PATH, ) @@ -561,18 +568,36 @@ export function AgentWorkingDirectoryPanel({ } > - - {t(($) => $['agentDetail.configure.workingDirectory.savedFiles'])} - - - {t(($) => $['agentDetail.configure.workingDirectory.temporaryFiles'])} - +
+ + {t(($) => $['agentDetail.configure.workingDirectory.persistentFiles'])} + + + {persistentFilesTooltip} + +
+
+ + {t(($) => $['agentDetail.configure.workingDirectory.temporaryFiles'])} + + + {temporaryFilesTooltip} + +