From 6ef3542c6c896626da7369aa0c59df54a5f68e5d Mon Sep 17 00:00:00 2001 From: takatost Date: Wed, 13 Mar 2024 15:08:15 +0800 Subject: [PATCH] fix value type --- api/core/workflow/entities/variable_pool.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api/core/workflow/entities/variable_pool.py b/api/core/workflow/entities/variable_pool.py index 3868041a8f28ea..7a5f58d808d1b6 100644 --- a/api/core/workflow/entities/variable_pool.py +++ b/api/core/workflow/entities/variable_pool.py @@ -13,7 +13,10 @@ class ValueType(Enum): STRING = "string" NUMBER = "number" OBJECT = "object" - ARRAY = "array" + ARRAY_STRING = "array[string]" + ARRAY_NUMBER = "array[number]" + ARRAY_OBJECT = "array[object]" + ARRAY_FILE = "array[file]" FILE = "file" @@ -78,7 +81,10 @@ def get_variable_value(self, variable_selector: list[str], elif target_value_type == ValueType.OBJECT: if not isinstance(value, dict): raise ValueError('Invalid value type: object') - elif target_value_type == ValueType.ARRAY: + elif target_value_type in [ValueType.ARRAY_STRING, + ValueType.ARRAY_NUMBER, + ValueType.ARRAY_OBJECT, + ValueType.ARRAY_FILE]: if not isinstance(value, list): raise ValueError('Invalid value type: array')