Skip to content

Commit d1f7a82

Browse files
authored
fix: Volcano engine large speech model cannot be added (#2058)
1 parent 6b9dd1c commit d1f7a82

File tree

1 file changed

+10
-5
lines changed
  • apps/setting/models_provider/impl/openai_model_provider/credential

1 file changed

+10
-5
lines changed

apps/setting/models_provider/impl/openai_model_provider/credential/llm.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@
1818

1919

2020
class OpenAILLMModelParams(BaseForm):
21-
temperature = forms.SliderField(TooltipLabel(_('Temperature'), _('Higher values make the output more random, while lower values make it more focused and deterministic')),
21+
temperature = forms.SliderField(TooltipLabel(_('Temperature'),
22+
_('Higher values make the output more random, while lower values make it more focused and deterministic')),
2223
required=True, default_value=0.7,
2324
_min=0.1,
2425
_max=1.0,
2526
_step=0.01,
2627
precision=2)
2728

2829
max_tokens = forms.SliderField(
29-
TooltipLabel(_('Output the maximum Tokens'), _('Specify the maximum number of tokens that the model can generate')),
30+
TooltipLabel(_('Output the maximum Tokens'),
31+
_('Specify the maximum number of tokens that the model can generate')),
3032
required=True, default_value=800,
3133
_min=1,
3234
_max=100000,
@@ -40,7 +42,8 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
4042
raise_exception=False):
4143
model_type_list = provider.get_model_type_list()
4244
if not any(list(filter(lambda mt: mt.get('value') == model_type, model_type_list))):
43-
raise AppApiException(ValidCode.valid_error.value, __('{model_type} Model type is not supported').format(model_type=model_type))
45+
raise AppApiException(ValidCode.valid_error.value,
46+
__('{model_type} Model type is not supported').format(model_type=model_type))
4447

4548
for key in ['api_base', 'api_key']:
4649
if key not in model_credential:
@@ -51,12 +54,14 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
5154
try:
5255

5356
model = provider.get_model(model_type, model_name, model_credential, **model_params)
54-
model.invoke([HumanMessage(content=_('Hello'))])
57+
model.invoke([HumanMessage(content=__('Hello'))])
5558
except Exception as e:
5659
if isinstance(e, AppApiException):
5760
raise e
5861
if raise_exception:
59-
raise AppApiException(ValidCode.valid_error.value, __('Verification failed, please check whether the parameters are correct: {error}').format(error=str(e)))
62+
raise AppApiException(ValidCode.valid_error.value,
63+
__('Verification failed, please check whether the parameters are correct: {error}').format(
64+
error=str(e)))
6065
else:
6166
return False
6267
return True

0 commit comments

Comments
 (0)