mirror of
https://github.com/langgenius/dify.git
synced 2026-03-19 21:57:33 +08:00
Signed-off-by: yyh <yuanyouhuilyz@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: CodingOnStar <hanxujiang@dify.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Coding On Star <447357187@qq.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com> Co-authored-by: statxc <tyleradams93226@gmail.com>
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import type { NodeDefault } from '../../types'
|
|
import type { KnowledgeBaseNodeType } from './types'
|
|
import { BlockEnum } from '@/app/components/workflow/types'
|
|
import { genNodeMetaData } from '@/app/components/workflow/utils'
|
|
import {
|
|
getKnowledgeBaseValidationIssue,
|
|
getKnowledgeBaseValidationMessage,
|
|
} from './utils'
|
|
|
|
const metaData = genNodeMetaData({
|
|
sort: 3.1,
|
|
type: BlockEnum.KnowledgeBase,
|
|
isRequired: true,
|
|
isUndeletable: true,
|
|
isSingleton: true,
|
|
isTypeFixed: true,
|
|
})
|
|
const nodeDefault: NodeDefault<KnowledgeBaseNodeType> = {
|
|
metaData,
|
|
defaultValue: {
|
|
index_chunk_variable_selector: [],
|
|
keyword_number: 10,
|
|
retrieval_model: {
|
|
top_k: 3,
|
|
score_threshold_enabled: false,
|
|
score_threshold: 0.5,
|
|
},
|
|
},
|
|
checkValid(payload, t) {
|
|
const issue = getKnowledgeBaseValidationIssue(payload)
|
|
if (issue)
|
|
return { isValid: false, errorMessage: getKnowledgeBaseValidationMessage(issue, t) }
|
|
|
|
return {
|
|
isValid: true,
|
|
errorMessage: '',
|
|
}
|
|
},
|
|
}
|
|
|
|
export default nodeDefault
|