修改whisper
This commit is contained in:
parent
b16afa5299
commit
3f85269df0
@ -37,15 +37,15 @@ class VLLMWhisperModelCredential(BaseForm, BaseModelCredential):
|
|||||||
if not any(list(filter(lambda mt: mt.get('value') == model_type, model_type_list))):
|
if not any(list(filter(lambda mt: mt.get('value') == model_type, model_type_list))):
|
||||||
raise AppApiException(ValidCode.valid_error.value,
|
raise AppApiException(ValidCode.valid_error.value,
|
||||||
gettext('{model_type} Model type is not supported').format(model_type=model_type))
|
gettext('{model_type} Model type is not supported').format(model_type=model_type))
|
||||||
|
|
||||||
|
# 直接测试 /audio/transcriptions 端点,而不是依赖 /models 端点
|
||||||
try:
|
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:
|
except Exception as e:
|
||||||
raise AppApiException(ValidCode.valid_error.value, gettext('API domain name is invalid'))
|
raise AppApiException(ValidCode.valid_error.value, gettext(f'API authentication failed: {str(e)}'))
|
||||||
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)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def encryption_dict(self, model_info: Dict[str, object]):
|
def encryption_dict(self, model_info: Dict[str, object]):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user