浏览代码

fix API tool's schema not support array (#6006)

tags/0.6.13
非法操作 1年前
父节点
当前提交
bf2268b0af
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4
    1
      api/core/tools/tool/api_tool.py

+ 4
- 1
api/core/tools/tool/api_tool.py 查看文件

@@ -249,9 +249,12 @@ class ApiTool(Tool):
elif property['type'] == 'null':
if value is None:
return None
elif property['type'] == 'object':
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)
except ValueError:
return value

正在加载...
取消
保存