1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| import { BlockEnum } from '../../types'
| import type { NodeDefault } from '../../types'
| import { type EndNodeType } from './types'
| import { ALL_CHAT_AVAILABLE_BLOCKS, ALL_COMPLETION_AVAILABLE_BLOCKS } from '@/app/components/workflow/blocks'
|
| const nodeDefault: NodeDefault<EndNodeType> = {
| defaultValue: {
| outputs: [],
| },
| getAvailablePrevNodes(isChatMode: boolean) {
| const nodes = isChatMode
| ? ALL_CHAT_AVAILABLE_BLOCKS
| : ALL_COMPLETION_AVAILABLE_BLOCKS.filter(type => type !== BlockEnum.End)
| return nodes
| },
| getAvailableNextNodes() {
| return []
| },
| checkValid(payload: EndNodeType) {
| let isValid = true
| let errorMessages = ''
| if (payload.type) {
| isValid = true
| errorMessages = ''
| }
| return {
| isValid,
| errorMessage: errorMessages,
| }
| },
| }
|
| export default nodeDefault
|
|