dify/web/app/components/workflow/nodes/agent/default.ts
2024-12-27 11:30:43 +08:00

33 lines
817 B
TypeScript

import { ALL_CHAT_AVAILABLE_BLOCKS, ALL_COMPLETION_AVAILABLE_BLOCKS } from '../../constants'
import type { NodeDefault } from '../../types'
import type { AgentNodeType } from './types'
const nodeDefault: NodeDefault<AgentNodeType> = {
defaultValue: {
},
getAvailablePrevNodes(isChatMode) {
return isChatMode
? ALL_CHAT_AVAILABLE_BLOCKS
: ALL_COMPLETION_AVAILABLE_BLOCKS
},
getAvailableNextNodes(isChatMode) {
return isChatMode
? ALL_CHAT_AVAILABLE_BLOCKS
: ALL_COMPLETION_AVAILABLE_BLOCKS
},
checkValid(payload, t, moreDataForCheckValid) {
let isValid = true
let errorMessages = ''
if (payload.type) {
isValid = true
errorMessages = ''
}
return {
isValid,
errorMessage: errorMessages,
}
},
}
export default nodeDefault