| if variable is None: | if variable is None: | ||||
| raise ToolParameterError(f"Variable {tool_input.value} does not exist") | raise ToolParameterError(f"Variable {tool_input.value} does not exist") | ||||
| parameter_value = variable.value | parameter_value = variable.value | ||||
| elif tool_input.type in {"mixed", "constant"}: | |||||
| elif tool_input.type == "constant": | |||||
| parameter_value = tool_input.value | |||||
| elif tool_input.type == "mixed": | |||||
| segment_group = variable_pool.convert_template(str(tool_input.value)) | segment_group = variable_pool.convert_template(str(tool_input.value)) | ||||
| parameter_value = segment_group.text | parameter_value = segment_group.text | ||||
| else: | else: |
| for val in value: | for val in value: | ||||
| if not isinstance(val, str): | if not isinstance(val, str): | ||||
| raise ValueError("value must be a list of strings") | raise ValueError("value must be a list of strings") | ||||
| elif typ == "constant" and not isinstance(value, str | int | float | bool): | |||||
| elif typ == "constant" and not isinstance(value, str | int | float | bool | dict): | |||||
| raise ValueError("value must be a string, int, float, or bool") | raise ValueError("value must be a string, int, float, or bool") | ||||
| return typ | return typ | ||||
| ...value, | ...value, | ||||
| [variable]: { | [variable]: { | ||||
| ...varInput, | ...varInput, | ||||
| ...newValue, | |||||
| value: newValue, | |||||
| }, | }, | ||||
| }) | }) | ||||
| } | } | ||||
| <AppSelector | <AppSelector | ||||
| disabled={readOnly} | disabled={readOnly} | ||||
| scope={scope || 'all'} | scope={scope || 'all'} | ||||
| value={varInput as any} | |||||
| value={varInput?.value} | |||||
| onSelect={handleAppOrModelSelect} | onSelect={handleAppOrModelSelect} | ||||
| /> | /> | ||||
| )} | )} | ||||
| popupClassName='!w-[387px]' | popupClassName='!w-[387px]' | ||||
| isAdvancedMode | isAdvancedMode | ||||
| isInWorkflow | isInWorkflow | ||||
| value={varInput} | |||||
| value={varInput?.value} | |||||
| setModel={handleAppOrModelSelect} | setModel={handleAppOrModelSelect} | ||||
| readonly={readOnly} | readonly={readOnly} | ||||
| scope={scope} | scope={scope} |