dify/web/utils/dsl-import-warning.ts
yyh 6736f4005b
fix(web): improve import DSL dialog states (#39432)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-23 02:26:59 +00:00

13 lines
535 B
TypeScript

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(' · ')
}