Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: code-based extension (#2490)

zxhlyh297d0f1f3070
diff --git a/web/app/components/app/configuration/config-var/index.tsx b/web/app/components/app/configuration/config-var/index.tsx
index 671ff9746e9..9aeb00de8fa 100644
--- a/web/app/components/app/configuration/config-var/index.tsx
+++ b/web/app/components/app/configuration/config-var/index.tsx
@@ -147,6 +147,7 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVar
) => {
setShowExternalDataToolModal({
payload: {
+ type,
variable: key,
label: name,
config,
@@ -245,7 +246,7 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVar
const handleConfig = ({ key, type, index, name, config, icon, icon_background }: ExternalDataToolParams) => {
setCurrKey(key)
- if (type === 'api') {
+ if (type !== 'string' && type !== 'paragraph' && type !== 'select') {
handleOpenExternalDataToolModal({ key, type, index, name, config, icon, icon_background }, promptVariables)
return
}
diff --git a/web/app/components/app/configuration/debug/index.tsx b/web/app/components/app/configuration/debug/index.tsx
index 194bc1f8b57..68bbdacfad3 100644
--- a/web/app/components/app/configuration/debug/index.tsx
+++ b/web/app/components/app/configuration/debug/index.tsx
@@ -149,7 +149,7 @@ const Debug: FC<IDebug> = ({
}
let hasEmptyInput = ''
const requiredVars = modelConfig.configs.prompt_variables.filter(({ key, name, required, type }) => {
- if (type === 'api')
+ if (type !== 'string' && type !== 'paragraph' && type !== 'select')
return false
const res = (!key || !key.trim()) || (!name || !name.trim()) || (required || required === undefined || required === null)
return res
diff --git a/web/app/components/app/configuration/toolbox/moderation/form-generation.tsx b/web/app/components/app/configuration/toolbox/moderation/form-generation.tsx
index 15a237efee4..daf964447b2 100644
--- a/web/app/components/app/configuration/toolbox/moderation/form-generation.tsx
+++ b/web/app/components/app/configuration/toolbox/moderation/form-generation.tsx
@@ -65,7 +65,7 @@ const FormGeneration: FC<FormGenerationProps> = ({
}
})}
onSelect={item => handleFormChange(form.variable, item.value as string)}
- popupClassName='w-[576px]'
+ popupClassName='w-[576px] !z-[102]'
/>
)
}
diff --git a/web/app/components/base/chat/chat/hooks.ts b/web/app/components/base/chat/chat/hooks.ts
index 00d62241c88..d870cfc79f0 100644
--- a/web/app/components/base/chat/chat/hooks.ts
+++ b/web/app/components/base/chat/chat/hooks.ts
@@ -42,7 +42,7 @@ export const useCheckPromptVariables = () => {
} = promptVariablesConfig
let hasEmptyInput = ''
const requiredVars = promptVariables.filter(({ key, name, required, type }) => {
- if (type === 'api')
+ if (type !== 'string' && type !== 'paragraph' && type !== 'select')
return false
const res = (!key || !key.trim()) || (!name || !name.trim()) || (required || required === undefined || required === null)
return res
diff --git a/web/utils/model-config.ts b/web/utils/model-config.ts
index c465b57dfce..66b8babb217 100644
--- a/web/utils/model-config.ts
+++ b/web/utils/model-config.ts
@@ -16,7 +16,7 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |
return ['string', item['text-input']]
if (item.external_data_tool)
- return ['api', item.external_data_tool]
+ return [item.external_data_tool.type, item.external_data_tool]
return ['select', item.select]
})()
@@ -33,16 +33,13 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |
is_context_var,
})
}
- else if (type === 'api') {
+ else if (type === 'select') {
promptVariables.push({
key: content.variable,
name: content.label,
required: content.required,
- type: content.type,
- enabled: content.enabled,
- config: content.config,
- icon: content.icon,
- icon_background: content.icon_background,
+ type: 'select',
+ options: content.options,
is_context_var,
})
}
@@ -51,8 +48,11 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |
key: content.variable,
name: content.label,
required: content.required,
- type: 'select',
- options: content.options,
+ type: content.type,
+ enabled: content.enabled,
+ config: content.config,
+ icon: content.icon,
+ icon_background: content.icon_background,
is_context_var,
})
}
@@ -79,28 +79,28 @@ export const promptVariablesToUserInputsForm = (promptVariables: PromptVariable[
},
} as any)
}
- else if (item.type === 'api') {
+ else if (item.type === 'select') {
userInputs.push({
- external_data_tool: {
+ select: {
label: item.name,
variable: item.key,
- enabled: item.enabled,
- type: item.type,
- config: item.config,
- required: item.required,
- icon: item.icon,
- icon_background: item.icon_background,
+ required: item.required !== false, // default true
+ options: item.options,
+ default: '',
},
} as any)
}
else {
userInputs.push({
- select: {
+ external_data_tool: {
label: item.name,
variable: item.key,
- required: item.required !== false, // default true
- options: item.options,
- default: '',
+ enabled: item.enabled,
+ type: item.type,
+ config: item.config,
+ required: item.required,
+ icon: item.icon,
+ icon_background: item.icon_background,
},
} as any)
}