fix: when config plugin endpoint choose no start form app cause page crashed (#21789)

This commit is contained in:
Joel
2025-07-02 10:55:38 +08:00
committed by GitHub
parent c4b960cc1a
commit 58dfe2ca03

View File

@@ -62,7 +62,7 @@ const AppInputsPanel = ({
return [] return []
let inputFormSchema = [] let inputFormSchema = []
if (isBasicApp) { if (isBasicApp) {
inputFormSchema = currentApp.model_config.user_input_form.filter((item: any) => !item.external_data_tool).map((item: any) => { inputFormSchema = currentApp.model_config?.user_input_form?.filter((item: any) => !item.external_data_tool).map((item: any) => {
if (item.paragraph) { if (item.paragraph) {
return { return {
...item.paragraph, ...item.paragraph,
@@ -108,10 +108,10 @@ const AppInputsPanel = ({
type: 'text-input', type: 'text-input',
required: false, required: false,
} }
}) }) || []
} }
else { else {
const startNode = currentWorkflow?.graph.nodes.find(node => node.data.type === BlockEnum.Start) as any const startNode = currentWorkflow?.graph?.nodes.find(node => node.data.type === BlockEnum.Start) as any
inputFormSchema = startNode?.data.variables.map((variable: any) => { inputFormSchema = startNode?.data.variables.map((variable: any) => {
if (variable.type === InputVarType.multiFiles) { if (variable.type === InputVarType.multiFiles) {
return { return {
@@ -132,7 +132,7 @@ const AppInputsPanel = ({
...variable, ...variable,
required: false, required: false,
} }
}) }) || []
} }
if ((currentApp.mode === 'completion' || currentApp.mode === 'workflow') && basicAppFileConfig.enabled) { if ((currentApp.mode === 'completion' || currentApp.mode === 'workflow') && basicAppFileConfig.enabled) {
inputFormSchema.push({ inputFormSchema.push({
@@ -144,7 +144,7 @@ const AppInputsPanel = ({
fileUploadConfig, fileUploadConfig,
}) })
} }
return inputFormSchema return inputFormSchema || []
}, [basicAppFileConfig, currentApp, currentWorkflow, fileUploadConfig, isBasicApp]) }, [basicAppFileConfig, currentApp, currentWorkflow, fileUploadConfig, isBasicApp])
const handleFormChange = (value: Record<string, any>) => { const handleFormChange = (value: Record<string, any>) => {