From 3f85269df05a483a0f03dd3aff67c3383750a730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=BD=AE?= Date: Thu, 18 Dec 2025 20:50:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9whisper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vllm_model_provider/credential/whisper_stt.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/models_provider/impl/vllm_model_provider/credential/whisper_stt.py b/apps/models_provider/impl/vllm_model_provider/credential/whisper_stt.py index f65b38ea..60672119 100644 --- a/apps/models_provider/impl/vllm_model_provider/credential/whisper_stt.py +++ b/apps/models_provider/impl/vllm_model_provider/credential/whisper_stt.py @@ -37,15 +37,15 @@ class VLLMWhisperModelCredential(BaseForm, BaseModelCredential): if not any(list(filter(lambda mt: mt.get('value') == model_type, model_type_list))): raise AppApiException(ValidCode.valid_error.value, gettext('{model_type} Model type is not supported').format(model_type=model_type)) + + # 直接测试 /audio/transcriptions 端点,而不是依赖 /models 端点 try: - model_list = provider.get_base_model_list(model_credential.get('api_url'), model_credential.get('api_key')) + model = provider.get_model(model_type, model_name, model_credential, **model_params) + # 使用模型的 check_auth 方法来验证认证 + model.check_auth() except Exception as e: - raise AppApiException(ValidCode.valid_error.value, gettext('API domain name is invalid')) - exist = provider.get_model_info_by_name(model_list, model_name) - if len(exist) == 0: - raise AppApiException(ValidCode.valid_error.value, - gettext('The model does not exist, please download the model first')) - model = provider.get_model(model_type, model_name, model_credential, **model_params) + raise AppApiException(ValidCode.valid_error.value, gettext(f'API authentication failed: {str(e)}')) + return True def encryption_dict(self, model_info: Dict[str, object]):