From 4d7f31d33f0961e7e4d8e59e37432297c6e97c41 Mon Sep 17 00:00:00 2001 From: MrChengmo Date: Tue, 12 Mar 2024 20:13:23 +0800 Subject: [PATCH] fix get_model_type & get_model_url when model hasn't short name --- appbuilder/core/utils.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/appbuilder/core/utils.py b/appbuilder/core/utils.py index ad7f4093..fa6af8f3 100644 --- a/appbuilder/core/utils.py +++ b/appbuilder/core/utils.py @@ -86,9 +86,11 @@ def __init__(self, client: HTTPClient): def get_model_url(self, model_name: str) -> str: """获取模型在工作台网关的请求url""" - origin_name = model_name + short_name = model_name remote_model_name_collector = RemoteModelCollector() - origin_name = remote_model_name_collector.get_remote_name_by_short_name(origin_name) + origin_name = remote_model_name_collector.get_remote_name_by_short_name(short_name) + if not origin_name: + origin_name = short_name for model in self.model_list: if model.name == origin_name: return convert_cloudhub_url(self.client, model.url) @@ -97,9 +99,11 @@ def get_model_url(self, model_name: str) -> str: def get_model_type(self, model_name: str) -> str: """获取模型类型""" - origin_name = model_name + short_name = model_name remote_model_name_collector = RemoteModelCollector() - origin_name = remote_model_name_collector.get_remote_name_by_short_name(origin_name) + origin_name = remote_model_name_collector.get_remote_name_by_short_name(short_name) + if not origin_name: + origin_name = short_name for model in self.model_list: if model.name == origin_name: return model.apiType