Commit 68fa81ec authored by Joel's avatar Joel

chore: change tool input types

parent c051c891
......@@ -106,6 +106,7 @@ const Item = ({
provider_type: data.type,
provider_name: data.name,
tool_name: tool.name,
tool_label: tool.label[language],
title: tool.label[language],
})}
>
......
......@@ -30,5 +30,6 @@ export type ToolDefaultValue = {
provider_type: string
provider_name: string
tool_name: string
tool_label: string
title: string
}
......@@ -10,6 +10,7 @@ import useOneStepRun from '@/app/components/workflow/nodes/_base/hooks/use-one-s
const useConfig = (id: string, payload: HttpNodeType) => {
const { inputs, setInputs } = useNodeCrud<HttpNodeType>(id, payload)
// console.log(inputs)
const { handleVarListChange, handleAddVariable } = useVarList<HttpNodeType>({
inputs,
setInputs,
......
......@@ -3,8 +3,8 @@ import type { ToolNodeType } from './types'
const nodeDefault: NodeDefault<ToolNodeType> = {
defaultValue: {
tool_inputs: [],
tool_parameters: {},
tool_parameters: [],
tool_configurations: {},
},
getAvailablePrevNodes() {
return []
......
......@@ -8,7 +8,7 @@ import type { NodeProps } from '@/app/components/workflow/types'
const Node: FC<NodeProps<ToolNodeType>> = ({
data,
}) => {
const { tool_inputs } = data
const { tool_parameters: tool_inputs } = data
return (
<div className='px-3'>
......
......@@ -47,7 +47,7 @@ const Panel: FC<NodePanelProps<ToolNodeType>> = ({
runResult,
} = useConfig(id, data)
// console.log(inputs)
console.log(inputs)
if (isLoading) {
return <div className='flex h-[200px] items-center justify-center'>
......@@ -80,7 +80,7 @@ const Panel: FC<NodePanelProps<ToolNodeType>> = ({
readOnly={readOnly}
nodeId={id}
schema={toolInputVarSchema as any}
value={inputs.tool_inputs}
value={inputs.tool_parameters}
onChange={setInputVar}
/>
</Field>
......
......@@ -18,6 +18,6 @@ export type ToolNodeType = CommonNodeType & {
provider_name: string
tool_name: string
tool_label: string
tool_inputs: ToolVarInput[]
tool_parameters: Record<string, any>
tool_parameters: ToolVarInput[]
tool_configurations: Record<string, any>
}
......@@ -23,8 +23,8 @@ const useConfig = (id: string, payload: ToolNodeType) => {
const setToolsMap = useStore(s => s.setToolsMap)
const { inputs, setInputs } = useNodeCrud<ToolNodeType>(id, payload)
const toolInputs = inputs.tool_inputs
const { provider_id, provider_name, provider_type, tool_name, tool_parameters } = inputs
const toolInputs = inputs.tool_parameters
const { provider_id, provider_name, provider_type, tool_name, tool_configurations: tool_parameters } = inputs
const isBuiltIn = provider_type === CollectionType.builtIn
const [currCollection, setCurrCollection] = useState<Collection | null | undefined>(null)
const fetchCurrCollection = useCallback(async () => {
......@@ -72,7 +72,7 @@ const useConfig = (id: string, payload: ToolNodeType) => {
const setToolSettingValue = useCallback((value: Record<string, any>) => {
setInputs({
...inputs,
tool_parameters: value,
tool_configurations: value,
})
}, [inputs, setInputs])
......@@ -81,7 +81,7 @@ const useConfig = (id: string, payload: ToolNodeType) => {
const setInputVar = useCallback((value: ToolVarInput[]) => {
setInputs({
...inputs,
tool_inputs: value,
tool_parameters: value,
})
}, [inputs, setInputs])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment