diff --git a/appbuilder/core/components/animal_recognize/component.py b/appbuilder/core/components/animal_recognize/component.py index ffd735a9f..2d67bca26 100644 --- a/appbuilder/core/components/animal_recognize/component.py +++ b/appbuilder/core/components/animal_recognize/component.py @@ -24,6 +24,9 @@ from appbuilder.core._exception import AppBuilderServerException from typing import Generator, Union +TOP_NUM = 1 +BAIKE_NUM = 0 + class AnimalRecognition(Component): r""" @@ -169,8 +172,8 @@ def _recognize_w_post_process(self, img_path, img_url, file_urls) -> str: if img_url in file_urls: img_url = file_urls['img_url'] req.url = img_url - req.top_num = 6 - req.baike_num = 0 + req.top_num = TOP_NUM + req.baike_num = BAIKE_NUM result = self._recognize(req) result_dict = proto.Message.to_dict(result) rec_res = "模型识别结果为:\n" diff --git a/appbuilder/core/components/image_understand/component.py b/appbuilder/core/components/image_understand/component.py index 19fa68d68..ff3b19de4 100644 --- a/appbuilder/core/components/image_understand/component.py +++ b/appbuilder/core/components/image_understand/component.py @@ -168,7 +168,16 @@ def tool_eval(self, name: str, streaming: bool, file_urls = kwargs.get("file_urls", {}) rec_res = self._recognize_w_post_process(img_path, img_url, file_urls) if streaming: - yield rec_res + yield { + "type": "text", + "text": rec_res, + "visible_scope": 'llm', + } + yield { + "type": "text", + "text": "", + "visible_scope": 'user', + } else: return rec_res diff --git a/appbuilder/core/components/plant_recognize/component.py b/appbuilder/core/components/plant_recognize/component.py index b679eccf1..ea92d6338 100644 --- a/appbuilder/core/components/plant_recognize/component.py +++ b/appbuilder/core/components/plant_recognize/component.py @@ -22,6 +22,9 @@ from appbuilder.core.components.plant_recognize.model import * from typing import Generator, Union +TOP_NUM = 1 +BAIKE_NUM = 0 + class PlantRecognition(Component): r""" @@ -174,8 +177,8 @@ def _recognize_w_post_process(self, img_path, img_url, file_urls): if img_url in file_urls: img_url = file_urls['img_url'] req.url = img_url - req.top_num = 6 - req.baike_num = 0 + req.top_num = TOP_NUM + req.baike_num = BAIKE_NUM result = self.__recognize(req) result_dict = proto.Message.to_dict(result) rec_res = "模型识别结果为:\n"