diff --git a/modelscope_agent/tools/base.py b/modelscope_agent/tools/base.py index ed6d5b69..f5a9c4c1 100644 --- a/modelscope_agent/tools/base.py +++ b/modelscope_agent/tools/base.py @@ -597,7 +597,7 @@ def _verify_args(self, params: str, api_info) -> Union[str, dict]: if 'required' in param and param['required']: current = {} - current_test = copy.deepcopy(params_json) + current_test = deepcopy(params_json) parts = param['name'].split('.') for i, part in enumerate(parts): if part not in current: @@ -714,6 +714,7 @@ def call(self, params: str, **kwargs): response = requests.post( f'{self.openapi_service_manager_url}/execute_openapi', json={ + 'openapi_name': self.openapi_remote_name, 'url': url, 'params': query_params, 'headers': header, diff --git a/modelscope_agent/tools/utils/openapi_utils.py b/modelscope_agent/tools/utils/openapi_utils.py index 843a7af1..233bc81d 100644 --- a/modelscope_agent/tools/utils/openapi_utils.py +++ b/modelscope_agent/tools/utils/openapi_utils.py @@ -109,15 +109,15 @@ def parse_nested_parameters(param_name, param_info, parameters_list, content): # openapi_schema_convert,register to tool_config.json -def extract_references(schema_content): +def extract_references(schema_content, index=0): references = [] if isinstance(schema_content, dict): if '$ref' in schema_content: references.append(schema_content['$ref']) for key, value in schema_content.items(): - references.extend(extract_references(value)) + references.extend(extract_references(value, index + 1)) # if properties exist, record the schema content in references and deal later - if 'properties' in schema_content: + if 'properties' in schema_content and index == 0: references.append(schema_content) elif isinstance(schema_content, list): for item in schema_content: