From 8598af2a17d1b5edfae2c330dc270b6d52a28e0c Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 11 Aug 2026 17:36:33 +0800 Subject: [PATCH] fix: improve agent working directory tab labels and tooltips (#40496) --- .../working-directory-panel.spec.tsx | 34 +++++++++++-- .../preview/working-directory-panel.tsx | 49 ++++++++++++++----- web/i18n/ar-TN/agent-v-2.json | 6 ++- web/i18n/de-DE/agent-v-2.json | 6 ++- web/i18n/en-US/agent-v-2.json | 6 ++- web/i18n/es-ES/agent-v-2.json | 6 ++- web/i18n/fa-IR/agent-v-2.json | 6 ++- web/i18n/fr-FR/agent-v-2.json | 6 ++- web/i18n/hi-IN/agent-v-2.json | 6 ++- web/i18n/id-ID/agent-v-2.json | 6 ++- web/i18n/it-IT/agent-v-2.json | 6 ++- web/i18n/ja-JP/agent-v-2.json | 4 +- web/i18n/ko-KR/agent-v-2.json | 6 ++- web/i18n/lo-LA/agent-v-2.json | 6 ++- web/i18n/nl-NL/agent-v-2.json | 6 ++- web/i18n/pl-PL/agent-v-2.json | 6 ++- web/i18n/pt-BR/agent-v-2.json | 6 ++- web/i18n/ro-RO/agent-v-2.json | 6 ++- web/i18n/ru-RU/agent-v-2.json | 6 ++- web/i18n/sl-SI/agent-v-2.json | 6 ++- web/i18n/th-TH/agent-v-2.json | 6 ++- web/i18n/tr-TR/agent-v-2.json | 6 ++- web/i18n/uk-UA/agent-v-2.json | 6 ++- web/i18n/vi-VN/agent-v-2.json | 6 ++- web/i18n/zh-Hans/agent-v-2.json | 6 ++- web/i18n/zh-Hant/agent-v-2.json | 6 ++- 26 files changed, 161 insertions(+), 64 deletions(-) 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} + +