Files
dify/web/app/components/workflow/utils/data-source.ts
T
+10
-LAN-GitHubtwwucrazywoolajyongWu TianweiQuantumGhostlyzno1quicksandJyonglyzno1zxhlyhYongtao Huangautofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>JoelCopilotnite-kniteHanqing Zhaogemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>Harry
85cda47c70 feat: knowledge pipeline (#25360)
Signed-off-by: -LAN- <[email protected]>
Co-authored-by: twwu <[email protected]>
Co-authored-by: crazywoola <[email protected]>
Co-authored-by: jyong <[email protected]>
Co-authored-by: Wu Tianwei <[email protected]>
Co-authored-by: QuantumGhost <[email protected]>
Co-authored-by: lyzno1 <[email protected]>
Co-authored-by: quicksand <[email protected]>
Co-authored-by: Jyong <[email protected]>
Co-authored-by: lyzno1 <[email protected]>
Co-authored-by: zxhlyh <[email protected]>
Co-authored-by: Yongtao Huang <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Joel <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: nite-knite <[email protected]>
Co-authored-by: Hanqing Zhao <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Harry <[email protected]>
2025-09-18 12:49:10 +08:00

38 lines
1.3 KiB
TypeScript

import type {
InputVar,
ToolWithProvider,
} from '../types'
import type { DataSourceNodeType } from '../nodes/data-source/types'
import { CollectionType } from '@/app/components/tools/types'
import { toolParametersToFormSchemas } from '@/app/components/tools/utils/to-form-schema'
export const getDataSourceCheckParams = (
toolData: DataSourceNodeType,
dataSourceList: ToolWithProvider[],
language: string,
) => {
const { plugin_id, provider_type, datasource_name } = toolData
const isBuiltIn = provider_type === CollectionType.builtIn
const currentDataSource = dataSourceList.find(item => item.plugin_id === plugin_id)
const currentDataSourceItem = currentDataSource?.tools.find(tool => tool.name === datasource_name)
const formSchemas = currentDataSourceItem ? toolParametersToFormSchemas(currentDataSourceItem.parameters) : []
return {
dataSourceInputsSchema: (() => {
const formInputs: InputVar[] = []
formSchemas.forEach((item: any) => {
formInputs.push({
label: item.label[language] || item.label.en_US,
variable: item.variable,
type: item.type,
required: item.required,
hide: item.hide,
})
})
return formInputs
})(),
notAuthed: isBuiltIn && !!currentDataSource?.allow_delete && !currentDataSource?.is_authorized,
language,
}
}