diff --git a/python/tests/component_check.py b/python/tests/component_check.py index fc5f51fa..52d919a4 100644 --- a/python/tests/component_check.py +++ b/python/tests/component_check.py @@ -73,6 +73,8 @@ def check(self, component_cls) -> CheckInfo: invalid_details.append("{} 没有添加测试case到 component_tool_eval_cases 中".format(component_cls_name)) else: component_case = self.component_tool_eval_cases[component_cls_name]() + envs = component_case.envs() + os.environ.update(envs) init_args = component_case.init_args() try: @@ -105,7 +107,10 @@ def check(self, component_cls) -> CheckInfo: print(e) check_pass_flag = False invalid_details.append(str(e)) - + + for env in envs: + os.environ.pop(env) + if len(invalid_details) > 0: check_pass_flag = False invalid_details = ",".join(invalid_details) @@ -292,9 +297,9 @@ def _gather_iter_outputs(self, outputs): if out_type == "text": text_output += content.text.info elif out_type == "oral_text": - oral_text_output += content.oral_text.info + oral_text_output += content.text.info elif out_type == "code": - code_output += content.code.code + code_output += content.text.code return { "text": text_output, "oral_text": oral_text_output, diff --git a/python/utils/json_schema_to_model.py b/python/utils/json_schema_to_model.py index a81b48c7..2056bdfa 100644 --- a/python/utils/json_schema_to_model.py +++ b/python/utils/json_schema_to_model.py @@ -88,7 +88,8 @@ def json_schema_to_pydantic_model(json_schema: dict, name_override: str) -> Base class_title = json_schema["title"] pydantic_models_as_str = sed_pydantic_str(pydantic_models_as_str, class_title) - + pydantic_models_as_str = pydantic_models_as_str.replace("unique_items", "Set") + with NamedTemporaryFile(suffix=".py", delete=False) as temp_file: temp_file_path = Path(temp_file.name).resolve() temp_file.write(pydantic_models_as_str.encode()) @@ -119,6 +120,14 @@ def json_schema_to_pydantic_model(json_schema: dict, name_override: str) -> Base "type": "string", "description": "待识别图片的文件名,用于生成图片url" }, + "files": { + "type": "array", + "items": { + "type": "string", + }, + "uniqueItems": True + } + }, "anyOf": [ {