|
|
|
@@ -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) |
|
|
|
} |