修改whisper
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run

This commit is contained in:
朱潮 2025-12-18 20:50:07 +08:00
parent b16afa5299
commit 3f85269df0

View File

@ -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]):