소스 검색

add support for swagger object type (#3426)

Co-authored-by: lipeikui <lipeikui@3vjia.com>
LeePui 1 년 전
부모
커밋
38ca3b29b5
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      api/core/tools/tool/api_tool.py

+ 10 - 0
api/core/tools/tool/api_tool.py

@@ -291,6 +291,16 @@ class ApiTool(Tool):
                 elif property['type'] == 'null':
                     if value is 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:
                     raise ValueError(f"Invalid type {property['type']} for property {property}")
             elif 'anyOf' in property and isinstance(property['anyOf'], list):