diff --git a/appbuilder/core/components/qrcode_ocr/component.py b/appbuilder/core/components/qrcode_ocr/component.py index fbe173a2c..5edb5a0b8 100644 --- a/appbuilder/core/components/qrcode_ocr/component.py +++ b/appbuilder/core/components/qrcode_ocr/component.py @@ -167,7 +167,7 @@ def tool_eval(self, name: str, streaming: bool, **kwargs): raise InvalidRequestArgumentError("location must be a string with value 'true' or 'false'") req.location = location resp = self._recognize(req) - result[file_name] = [item["text"] for item in proto.Message.to_dict(resp)["codes_result"]] + result[file_name] = [item["text"] for item in proto.Message.to_dict(resp).get("codes_result", [])] if streaming: yield json.dumps(result, ensure_ascii=False) else: