mirror of
https://github.com/langgenius/dify.git
synced 2026-07-21 02:28:30 +08:00
13 lines
505 B
TypeScript
13 lines
505 B
TypeScript
import type { DSLImportWarning } from '@/models/app'
|
|
|
|
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(' · ')
|
|
}
|