mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 03:32:23 +08:00
Merge 5c5483a7f0
into d05fee1182
This commit is contained in:
commit
d1873ffdff
|
@ -263,12 +263,14 @@ class ApiTool(Tool):
|
|||
elif property["type"] == "object" or property["type"] == "array":
|
||||
if isinstance(value, str):
|
||||
try:
|
||||
# an array str like '[1,2]' also can convert to list [1,2] through json.loads
|
||||
# json not support single quote, but we can support it
|
||||
value = value.replace("'", '"')
|
||||
return json.loads(value)
|
||||
# an array str like '[1,2]' can also be converted to list [1,2] through json.loads
|
||||
# json does not support single quotes, but we can support it
|
||||
return json.loads(value.replace("'", '"'))
|
||||
except ValueError:
|
||||
return value
|
||||
try:
|
||||
return json.loads(value)
|
||||
except ValueError:
|
||||
return value
|
||||
elif isinstance(value, dict):
|
||||
return value
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue
Block a user