mirror of
https://github.com/langgenius/dify.git
synced 2026-03-12 10:38:54 +08:00
fix tool parameters
This commit is contained in:
@ -64,7 +64,7 @@ const FormInputItem: FC<Props> = ({
|
||||
const isModelSelector = type === FormTypeEnum.modelSelector
|
||||
const showTypeSwitch = isNumber || isObject || isArray
|
||||
const isConstant = varInput?.type === VarKindType.constant
|
||||
const showVariableSelector = isString || isFile || varInput?.type === VarKindType.variable
|
||||
const showVariableSelector = isFile || varInput?.type === VarKindType.variable
|
||||
|
||||
const { availableVars, availableNodesWithParent } = useAvailableVarList(nodeId, {
|
||||
onlyLeafNodeVar: false,
|
||||
@ -110,7 +110,7 @@ const FormInputItem: FC<Props> = ({
|
||||
else if (isObject)
|
||||
return (varPayload: any) => varPayload.type === VarType.object
|
||||
else if (isArray)
|
||||
return (varPayload: any) => varPayload.type === VarType.arrayObject
|
||||
return (varPayload: any) => [VarType.array, VarType.arrayString, VarType.arrayNumber, VarType.arrayObject].includes(varPayload.type)
|
||||
return undefined
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ const useConfig = (id: string, payload: ToolNodeType) => {
|
||||
* tool_parameters: tool dynamic setting(form type = llm)
|
||||
* output_schema: tool dynamic output
|
||||
*/
|
||||
const { provider_id, provider_type, tool_name, tool_configurations, output_schema } = inputs
|
||||
const { provider_id, provider_type, tool_name, tool_configurations, output_schema, tool_parameters } = inputs
|
||||
const isBuiltIn = provider_type === CollectionType.builtIn
|
||||
const buildInTools = useStore(s => s.buildInTools)
|
||||
const customTools = useStore(s => s.customTools)
|
||||
@ -132,12 +132,19 @@ const useConfig = (id: string, payload: ToolNodeType) => {
|
||||
if (!currTool)
|
||||
return
|
||||
const inputsWithDefaultValue = produce(inputs, (draft) => {
|
||||
if (!draft.tool_configurations || Object.keys(draft.tool_configurations).length === 0)
|
||||
if (!draft.tool_configurations || Object.keys(draft.tool_configurations).length === 0) {
|
||||
draft.tool_configurations = getConfiguredValue(tool_configurations, toolSettingSchema)
|
||||
}
|
||||
else {
|
||||
// TODO
|
||||
}
|
||||
|
||||
if (!draft.tool_parameters)
|
||||
draft.tool_parameters = {}
|
||||
// TODO: boolean & model & app formatting BOTH configuration & parameters
|
||||
if (!draft.tool_parameters || Object.keys(draft.tool_configurations).length === 0) {
|
||||
draft.tool_parameters = getConfiguredValue(tool_parameters, toolInputVarSchema)
|
||||
}
|
||||
else {
|
||||
// TODO: boolean & model & app formatting BOTH configuration & parameters
|
||||
}
|
||||
})
|
||||
setInputs(inputsWithDefaultValue)
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
|
||||
Reference in New Issue
Block a user