dify/web/app/components/workflow/nodes/agent-v2/default.ts
yyh d0ea5a5e0d
chore(agent-v2): sync changes (#38442)
Co-authored-by: Joel <iamjoel007@gmail.com>
Co-authored-by: zyssyz123 <916125788@qq.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: 林玮 (Jade Lin) <linw1995@icloud.com>
Co-authored-by: 盐粒 Yanli <mail@yanli.one>
2026-07-06 13:51:33 +00:00

41 lines
913 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,
helpLinkUri: 'agent',
})
const nodeDefault: NodeDefault<AgentV2NodeType> = {
metaData,
defaultValue: {
agent_binding: {
binding_type: 'inline_agent',
},
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