Merge branch 'main' into feat/plugins

This commit is contained in:
zxhlyh
2024-12-16 17:55:52 +08:00
16 changed files with 70 additions and 29 deletions

View File

@ -192,6 +192,7 @@ export const useWorkflowRun = () => {
const newNodes = produce(nodes, (draft) => {
draft.forEach((node) => {
node.data._waitingRun = true
node.data._runningBranchId = undefined
})
})
setNodes(newNodes)

View File

@ -52,6 +52,12 @@ const useConfig = (id: string, payload: IterationNodeType) => {
[VarType.number]: VarType.arrayNumber,
[VarType.object]: VarType.arrayObject,
[VarType.file]: VarType.arrayFile,
// list operator node can output array
[VarType.array]: VarType.array,
[VarType.arrayFile]: VarType.arrayFile,
[VarType.arrayString]: VarType.arrayString,
[VarType.arrayNumber]: VarType.arrayNumber,
[VarType.arrayObject]: VarType.arrayObject,
} as Record<VarType, VarType>)[outputItemType] || VarType.arrayString
})
setInputs(newInputs)

View File

@ -59,20 +59,12 @@ const InputVarList: FC<Props> = ({
const newValue = produce(value, (draft: ToolVarInputs) => {
const target = draft[variable]
if (target) {
if (!isSupportConstantValue || varKindType === VarKindType.variable) {
if (isSupportConstantValue)
target.type = VarKindType.variable
target.value = varValue as ValueSelector
}
else {
target.type = VarKindType.constant
target.value = varValue as string
}
target.type = varKindType
target.value = varValue
}
else {
draft[variable] = {
type: VarKindType.variable,
type: varKindType,
value: varValue,
}
}
@ -170,7 +162,7 @@ const InputVarList: FC<Props> = ({
value={varInput?.type === VarKindType.constant ? (varInput?.value || '') : (varInput?.value || [])}
onChange={handleNotMixedTypeChange(variable)}
onOpen={handleOpen(index)}
defaultVarKindType={isNumber ? VarKindType.constant : VarKindType.variable}
defaultVarKindType={varInput?.type || (isNumber ? VarKindType.constant : VarKindType.variable)}
isSupportConstantValue={isSupportConstantValue}
filterVar={isNumber ? filterVar : undefined}
availableVars={isSelect ? availableVars : undefined}

View File

@ -132,7 +132,7 @@ const useConfig = (id: string, payload: ToolNodeType) => {
draft.tool_parameters = {}
})
setInputs(inputsWithDefaultValue)
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [currTool])
// setting when call
@ -214,8 +214,13 @@ const useConfig = (id: string, payload: ToolNodeType) => {
.map(k => inputs.tool_parameters[k])
const varInputs = getInputVars(hadVarParams.map((p) => {
if (p.type === VarType.variable)
if (p.type === VarType.variable) {
// handle the old wrong value not crash the page
if (!(p.value as any).join)
return `{{#${p.value}#}}`
return `{{#${(p.value as ValueSelector).join('.')}#}}`
}
return p.value as string
}))