mirror of
https://github.com/langgenius/dify.git
synced 2026-03-27 01:00:13 +08:00
Frontend: - Migrate deprecated imports: modal→dialog, toast→ui/toast, tooltip→tooltip-plus, portal-to-follow-elem→portal-to-follow-elem-plus, select→ui/select, confirm→alert-dialog - Replace next/* with @/next/* wrapper modules - Convert TypeScript enums to const objects (erasable-syntax-only) - Replace all `any` types with `unknown` or specific types in workflow types - Fix unused vars, react-hooks-extra, react-refresh/only-export-components - Extract InteractionMode to separate module, tool-block commands to commands.ts Backend: - Fix pyrefly errors: type narrowing, null guards, getattr patterns - Remove unused TYPE_CHECKING imports in LLM node - Add ignore_imports entries to .importlinter for dify_graph boundary violations Made-with: Cursor
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import type { NodeDefault } from '../../types'
|
|
import type { CommandNodeType } from './types'
|
|
import { BlockClassificationEnum } from '@/app/components/workflow/block-selector/types'
|
|
import { BlockEnum } from '@/app/components/workflow/types'
|
|
import { genNodeMetaData } from '@/app/components/workflow/utils'
|
|
|
|
const i18nPrefix = 'errorMsg'
|
|
|
|
const metaData = genNodeMetaData({
|
|
classification: BlockClassificationEnum.Utilities,
|
|
sort: 2,
|
|
type: BlockEnum.Command,
|
|
})
|
|
|
|
const nodeDefault: NodeDefault<CommandNodeType> = {
|
|
metaData,
|
|
defaultValue: {
|
|
working_directory: '',
|
|
command: '',
|
|
},
|
|
checkValid(payload: CommandNodeType, t: Parameters<NodeDefault<CommandNodeType>['checkValid']>[1]) {
|
|
let errorMessages = ''
|
|
const { command } = payload
|
|
const translate = t as (key: string, options?: Record<string, unknown>) => string
|
|
|
|
if (!errorMessages && !command)
|
|
errorMessages = translate(`${i18nPrefix}.fieldRequired`, { ns: 'workflow', field: translate(`${i18nPrefix}.fields.command`, { ns: 'workflow' }) })
|
|
|
|
return {
|
|
isValid: !errorMessages,
|
|
errorMessage: errorMessages,
|
|
}
|
|
},
|
|
}
|
|
|
|
export default nodeDefault
|