mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 02:15:59 +08:00
add support for swagger object type (#3426)
Co-authored-by: lipeikui <lipeikui@3vjia.com>
This commit is contained in:
parent
066076b157
commit
38ca3b29b5
@ -291,6 +291,16 @@ 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':
|
||||||
|
if isinstance(value, str):
|
||||||
|
try:
|
||||||
|
return json.loads(value)
|
||||||
|
except ValueError:
|
||||||
|
return value
|
||||||
|
elif isinstance(value, dict):
|
||||||
|
return value
|
||||||
|
else:
|
||||||
|
return value
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Invalid type {property['type']} for property {property}")
|
raise ValueError(f"Invalid type {property['type']} for property {property}")
|
||||||
elif 'anyOf' in property and isinstance(property['anyOf'], list):
|
elif 'anyOf' in property and isinstance(property['anyOf'], list):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user