fix API tool's schema not support array (#6006)
This commit is contained in:
parent
00b4cc3cd4
commit
bf2268b0af
@ -249,9 +249,12 @@ class ApiTool(Tool):
|
|||||||
elif property['type'] == 'null':
|
elif property['type'] == 'null':
|
||||||
if value is None:
|
if value is None:
|
||||||
return None
|
return None
|
||||||
elif property['type'] == 'object':
|
elif property['type'] == 'object' or property['type'] == 'array':
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
try:
|
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)
|
return json.loads(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return value
|
return value
|
||||||
|
Loading…
Reference in New Issue
Block a user