mirror of
https://github.com/langgenius/dify.git
synced 2026-06-23 20:41:17 +08:00
Co-authored-by: Jingyi-Dify <jingyi.qi@dify.ai> Co-authored-by: yyh <yuanyouhuilyz@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: hjlarry <hjlarry@163.com> Co-authored-by: Bond Zhu <783504079@qq.com> Co-authored-by: Yansong Zhang <916125788@qq.com> Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
37 lines
825 B
TypeScript
37 lines
825 B
TypeScript
import type { NodeDefault } from '../../types'
|
|
import type { AgentV2NodeType } from './types'
|
|
import { BlockEnum } from '../../types'
|
|
import { genNodeMetaData } from '../../utils'
|
|
import { hasValidAgentBinding } from './types'
|
|
|
|
const metaData = genNodeMetaData({
|
|
sort: 3,
|
|
type: BlockEnum.AgentV2,
|
|
})
|
|
|
|
const nodeDefault: NodeDefault<AgentV2NodeType> = {
|
|
metaData,
|
|
defaultValue: {
|
|
agent_node_kind: 'dify_agent',
|
|
version: '2',
|
|
},
|
|
checkValid(payload, t) {
|
|
if (!hasValidAgentBinding(payload)) {
|
|
return {
|
|
isValid: false,
|
|
errorMessage: t('errorMsg.fieldRequired', {
|
|
ns: 'workflow',
|
|
field: t('nodes.agent.roster.label', { ns: 'workflow' }),
|
|
}),
|
|
}
|
|
}
|
|
|
|
return {
|
|
isValid: true,
|
|
errorMessage: '',
|
|
}
|
|
},
|
|
}
|
|
|
|
export default nodeDefault
|