mirror of https://github.com/langgenius/dify.git
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import type { NodeDefault } from '../../types'
|
|
import { BlockEnum } from '../../types'
|
|
import type { QuestionClassifierNodeType } from './types'
|
|
import { ALL_CHAT_AVAILABLE_BLOCKS, ALL_COMPLETION_AVAILABLE_BLOCKS } from '@/app/components/workflow/constants'
|
|
|
|
const nodeDefault: NodeDefault<QuestionClassifierNodeType> = {
|
|
defaultValue: {
|
|
query_variable_selector: [],
|
|
model: {
|
|
provider: '',
|
|
name: '',
|
|
mode: 'chat',
|
|
completion_params: {
|
|
temperature: 0.7,
|
|
},
|
|
},
|
|
classes: [],
|
|
},
|
|
getAvailablePrevNodes(isChatMode: boolean) {
|
|
const nodes = isChatMode ? ALL_CHAT_AVAILABLE_BLOCKS : ALL_COMPLETION_AVAILABLE_BLOCKS
|
|
return nodes
|
|
},
|
|
getAvailableNextNodes(isChatMode: boolean) {
|
|
const nodes = isChatMode ? ALL_CHAT_AVAILABLE_BLOCKS : ALL_COMPLETION_AVAILABLE_BLOCKS
|
|
return nodes.filter(type => type !== BlockEnum.VariableAssigner)
|
|
},
|
|
checkValid(payload: QuestionClassifierNodeType) {
|
|
let isValid = true
|
|
let errorMessages = ''
|
|
if (payload.type) {
|
|
isValid = true
|
|
errorMessages = ''
|
|
}
|
|
return {
|
|
isValid,
|
|
errorMessage: errorMessages,
|
|
}
|
|
},
|
|
}
|
|
|
|
export default nodeDefault
|