Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: improve readability of DSL import warnings (#40148)
Joel2635d1b3df3d
diff --git a/web/app/components/app/create-from-dsl-modal/__tests__/dsl-import-warning-description.spec.tsx b/web/app/components/app/create-from-dsl-modal/__tests__/dsl-import-warning-description.spec.tsxnew file mode 100644index 00000000000..bd5473d64f4--- /dev/null+++ b/web/app/components/app/create-from-dsl-modal/__tests__/dsl-import-warning-description.spec.tsx@@ -0,0 +1,29 @@+import { render, screen } from '@testing-library/react'+import DSLImportWarningDescription from '../dsl-import-warning-description'++describe('DSLImportWarningDescription', () => {+ it('should render each distinct warning on its own row', () => {+ render(+ <p>+ <DSLImportWarningDescription+ warnings={[+ { message: "Agent skill 'market-research-methodology' was not included." },+ { message: "Agent skill 'market-research-methodology' was not included." },+ { message: "Agent skill 'source-backed-market-reporting' was not included." },+ { message: "Agent tool 'jina_search' requires authorization." },+ { message: "Agent secret 'SEARCH_TOKEN' must be configured." },+ ]}+ fallback="Some configuration may need attention."+ />+ </p>,+ )++ expect(screen.getByRole('list')).toBeInTheDocument()+ expect(screen.getAllByRole('listitem').map((item) => item.textContent)).toEqual([+ "Agent skill 'market-research-methodology' was not included.",+ "Agent skill 'source-backed-market-reporting' was not included.",+ "Agent tool 'jina_search' requires authorization.",+ '…',+ ])+ })+})diff --git a/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx b/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsxindex 2f2ff74ebd2..8f47974bba2 100644--- a/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx+++ b/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx@@ -397,7 +397,7 @@ describe('CreateFromDSLModal', () => {expect.stringMatching(/(?:^|\.)newApp\.caution(?=$|:)/),{type: 'warning',- description: "Agent secret 'SEARCH_TOKEN' must be configured.",+ description: expect.anything(),},)})@@ -577,7 +577,7 @@ describe('CreateFromDSLModal', () => {expect(toastMocks.call).toHaveBeenCalledWith(expect.stringMatching(/newApp\.caution/), {type: 'warning',- description: "Agent tool 'web_search' requires authorization.",+ description: expect.anything(),})expect(mockResolveImportedAppRedirectionTarget).toHaveBeenCalledWith({id: 'agent-app-1',diff --git a/web/app/components/app/create-from-dsl-modal/dsl-import-warning-description.tsx b/web/app/components/app/create-from-dsl-modal/dsl-import-warning-description.tsxnew file mode 100644index 00000000000..2d92a5c34b9--- /dev/null+++ b/web/app/components/app/create-from-dsl-modal/dsl-import-warning-description.tsx@@ -0,0 +1,40 @@+import type { ReactNode } from 'react'++type ImportWarning = {+ message: string+}++type DSLImportWarningDescriptionProps = {+ warnings?: ImportWarning[]+ fallback: ReactNode+}++const MAX_VISIBLE_IMPORT_WARNINGS = 3++const DSLImportWarningDescription = ({+ warnings = [],+ fallback,+}: DSLImportWarningDescriptionProps) => {+ const messages = [...new Set(warnings.map((warning) => warning.message.trim()).filter(Boolean))]++ if (!messages.length) return fallback++ const visibleWarnings = messages.slice(0, MAX_VISIBLE_IMPORT_WARNINGS).map((message) => ({+ id: `warning:${message}`,+ message,+ }))+ if (messages.length > MAX_VISIBLE_IMPORT_WARNINGS)+ visibleWarnings.push({ id: 'overflow', message: '…' })++ return (+ <span role="list" className="block">+ {visibleWarnings.map((warning) => (+ <span key={warning.id} role="listitem" className="block">+ {warning.message}+ </span>+ ))}+ </span>+ )+}++export default DSLImportWarningDescriptiondiff --git a/web/app/components/app/create-from-dsl-modal/index.tsx b/web/app/components/app/create-from-dsl-modal/index.tsxindex 29f429aff0d..9b4fb0b09f4 100644--- a/web/app/components/app/create-from-dsl-modal/index.tsx+++ b/web/app/components/app/create-from-dsl-modal/index.tsx@@ -32,9 +32,9 @@ import { consoleQuery } from '@/service/client'import { AppModeEnum as AppMode } from '@/types/app'import { getRedirection } from '@/utils/app-redirection'import { trackCreateApp } from '@/utils/create-app-tracking'-import { getDSLImportWarningDescription } from '@/utils/dsl-import-warning'import { resolveImportedAppRedirectionTarget } from '@/utils/imported-app-redirection'import DSLConfirmModal from './dsl-confirm-modal'+import DSLImportWarningDescription from './dsl-import-warning-description'import { CreateFromDSLModalTab } from './types'import { Uploader } from './uploader'@@ -142,10 +142,12 @@ function CreateFromDSLModal({{type: response.status === 'completed' ? 'success' : 'warning',description:- response.status === 'completed-with-warnings'- ? getDSLImportWarningDescription(response.warnings) ||- t(($) => $['newApp.appCreateDSLWarning'], { ns: 'app' })- : undefined,+ response.status === 'completed-with-warnings' ? (+ <DSLImportWarningDescription+ warnings={response.warnings}+ fallback={t(($) => $['newApp.appCreateDSLWarning'], { ns: 'app' })}+ />+ ) : undefined,},)if (!response.app_id || !appMode) returndiff --git a/web/app/components/workflow/__tests__/update-dsl-modal.helpers.spec.ts b/web/app/components/workflow/__tests__/update-dsl-modal.helpers.spec.tsindex 1f21bdfc250..a8a91801f70 100644--- a/web/app/components/workflow/__tests__/update-dsl-modal.helpers.spec.ts+++ b/web/app/components/workflow/__tests__/update-dsl-modal.helpers.spec.ts@@ -95,7 +95,7 @@ workflow:expect(isImportCompleted(DSLImportStatus.PENDING)).toBe(false)})- it('should use distinct Agent warning messages in the import notification', () => {+ it('should use the warning fallback in the import notification', () => {const t = ((key: (selector: Record<string, string>) => string) =>key({'common.importSuccess': 'Import succeeded',@@ -103,32 +103,12 @@ workflow:'common.importWarningDetails': 'Some configuration may need attention',})) as never- const payload = getImportNotificationPayload(DSLImportStatus.COMPLETED_WITH_WARNINGS, t, [- {- code: 'agent_file_omitted',- path: 'agent_packages.agent_1.omitted_assets',- message: "Agent file 'brief.pdf' was not included.",- details: {},- },- {- code: 'agent_file_omitted',- path: 'agent_packages.agent_1.omitted_assets',- message: "Agent file 'brief.pdf' was not included.",- details: {},- },- {- code: 'agent_tool_authorization_required',- path: 'agent_packages.agent_1.soul.tools.dify_tools.0',- message: "Agent tool 'web_search' requires authorization.",- details: {},- },- ])+ const payload = getImportNotificationPayload(DSLImportStatus.COMPLETED_WITH_WARNINGS, t)expect(payload).toEqual({type: 'warning',message: 'Caution',- children:- "Agent file 'brief.pdf' was not included. · Agent tool 'web_search' requires authorization.",+ children: 'Some configuration may need attention',})})diff --git a/web/app/components/workflow/__tests__/update-dsl-modal.spec.tsx b/web/app/components/workflow/__tests__/update-dsl-modal.spec.tsxindex ced8efcbb53..6ae715e20e1 100644--- a/web/app/components/workflow/__tests__/update-dsl-modal.spec.tsx+++ b/web/app/components/workflow/__tests__/update-dsl-modal.spec.tsx@@ -207,8 +207,7 @@ describe('UpdateDSLModal', () => {await waitFor(() => {expect(toast.warning).toHaveBeenCalledWith('workflow.common.importWarning', {- description:- "Agent file 'brief.pdf' was not included in the portable package. · Agent tool 'web_search' requires authorization.",+ description: expect.anything(),})})})@@ -293,7 +292,7 @@ describe('UpdateDSLModal', () => {await waitFor(() => {expect(toast.warning).toHaveBeenCalledWith('workflow.common.importWarning', {- description: "Agent secret 'SEARCH_TOKEN' must be configured.",+ description: expect.anything(),})})})diff --git a/web/app/components/workflow/update-dsl-modal.helpers.ts b/web/app/components/workflow/update-dsl-modal.helpers.tsindex 0a7a3af54b7..ad257b441b3 100644--- a/web/app/components/workflow/update-dsl-modal.helpers.ts+++ b/web/app/components/workflow/update-dsl-modal.helpers.ts@@ -1,10 +1,8 @@import type { TFunction } from 'i18next'import type { CommonNodeType, Node } from './types'-import type { DSLImportWarning } from '@/models/app'import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants'import { DSLImportStatus } from '@/models/app'import { AppModeEnum } from '@/types/app'-import { getDSLImportWarningDescription } from '@/utils/dsl-import-warning'import { loadYaml } from '@/utils/yaml'import { BlockEnum, SupportUploadFileTypes } from './types'@@ -77,7 +75,6 @@ export const isImportCompleted = (status: DSLImportStatus) => {export const getImportNotificationPayload = (status: DSLImportStatus,t: TFunction,- warnings: DSLImportWarning[] = [],): ImportNotificationPayload => {return {type: status === DSLImportStatus.COMPLETED ? 'success' : 'warning',@@ -87,8 +84,7 @@ export const getImportNotificationPayload = (: t(($) => $['common.importWarning'], { ns: 'workflow' }),children:status === DSLImportStatus.COMPLETED_WITH_WARNINGS- ? getDSLImportWarningDescription(warnings) ||- t(($) => $['common.importWarningDetails'], { ns: 'workflow' })+ ? t(($) => $['common.importWarningDetails'], { ns: 'workflow' }): undefined,}}diff --git a/web/app/components/workflow/update-dsl-modal.tsx b/web/app/components/workflow/update-dsl-modal.tsxindex a1874dcd785..e1046a785ee 100644--- a/web/app/components/workflow/update-dsl-modal.tsx+++ b/web/app/components/workflow/update-dsl-modal.tsx@@ -8,6 +8,7 @@ import { toast } from '@langgenius/dify-ui/toast'import { RiAlertFill, RiCloseLine, RiFileDownloadLine } from '@remixicon/react'import { memo, useCallback, useRef, useState } from 'react'import { useTranslation } from 'react-i18next'+import DSLImportWarningDescription from '@/app/components/app/create-from-dsl-modal/dsl-import-warning-description'import { Uploader } from '@/app/components/app/create-from-dsl-modal/uploader'import { useStore as useAppStore } from '@/app/components/app/store'import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks'@@ -92,10 +93,16 @@ const UpdateDSLModal = ({ onCancel, onBackup, onImport }: UpdateDSLModalProps) =await handleWorkflowUpdate(appId)collaborationManager.emitWorkflowUpdate(appId)onImport?.()- const payload = getImportNotificationPayload(status, t, warnings)+ const payload = getImportNotificationPayload(status, t)toast[payload.type](payload.message,- payload.children ? { description: payload.children } : undefined,+ payload.children+ ? {+ description: (+ <DSLImportWarningDescription warnings={warnings} fallback={payload.children} />+ ),+ }+ : undefined,)await handleCheckPluginDependencies(appId)setLoading(false)diff --git a/web/utils/dsl-import-warning.ts b/web/utils/dsl-import-warning.tsdeleted file mode 100644index 03d8eb83e4e..00000000000--- a/web/utils/dsl-import-warning.ts+++ /dev/null@@ -1,12 +0,0 @@-import type { DslImportWarning } from '@dify/contracts/api/console/apps/types.gen'--const MAX_VISIBLE_IMPORT_WARNINGS = 3--export const getDSLImportWarningDescription = (warnings: DslImportWarning[] = []) => {- const messages = [...new Set(warnings.map((warning) => warning.message.trim()).filter(Boolean))]- if (!messages.length) return-- const visibleMessages = messages.slice(0, MAX_VISIBLE_IMPORT_WARNINGS)- if (messages.length > MAX_VISIBLE_IMPORT_WARNINGS) visibleMessages.push('…')- return visibleMessages.join(' · ')-}