mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 09:28:04 +08:00
refactor: unify trigger node architecture and clean up technical debt (#24886)
Co-authored-by: hjlarry <hjlarry@163.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@ -1,29 +1,29 @@
|
||||
import { BlockEnum } from '../../types'
|
||||
import type { NodeDefault } from '../../types'
|
||||
import type { WebhookTriggerNodeType } from './types'
|
||||
import { ALL_CHAT_AVAILABLE_BLOCKS, ALL_COMPLETION_AVAILABLE_BLOCKS } from '@/app/components/workflow/blocks'
|
||||
import { ALL_COMPLETION_AVAILABLE_BLOCKS } from '@/app/components/workflow/blocks'
|
||||
import type { DefaultValueForm } from '@/app/components/workflow/nodes/_base/components/error-handle/types'
|
||||
|
||||
const nodeDefault: NodeDefault<WebhookTriggerNodeType> = {
|
||||
defaultValue: {
|
||||
'webhook_url': '',
|
||||
'method': 'POST',
|
||||
'content-type': 'application/json',
|
||||
'headers': [],
|
||||
'params': [],
|
||||
'body': [],
|
||||
'async_mode': true,
|
||||
'status_code': 200,
|
||||
'response_body': '',
|
||||
'default_value': [] as DefaultValueForm[],
|
||||
webhook_url: '',
|
||||
method: 'POST',
|
||||
content_type: 'application/json',
|
||||
headers: [],
|
||||
params: [],
|
||||
body: [],
|
||||
async_mode: true,
|
||||
status_code: 200,
|
||||
response_body: '',
|
||||
default_value: [] as DefaultValueForm[],
|
||||
},
|
||||
getAvailablePrevNodes(_isChatMode: boolean) {
|
||||
return []
|
||||
},
|
||||
getAvailableNextNodes(isChatMode: boolean) {
|
||||
const nodes = isChatMode
|
||||
? ALL_CHAT_AVAILABLE_BLOCKS
|
||||
: ALL_COMPLETION_AVAILABLE_BLOCKS.filter(type => type !== BlockEnum.End)
|
||||
? []
|
||||
: ALL_COMPLETION_AVAILABLE_BLOCKS
|
||||
return nodes.filter(type => type !== BlockEnum.Start)
|
||||
},
|
||||
checkValid(_payload: WebhookTriggerNodeType, _t: any) {
|
||||
|
||||
Reference in New Issue
Block a user