Skip to content

Commit 3e9069a

Browse files
committed
refactor: bailian
1 parent 0e66b8a commit 3e9069a

File tree

1 file changed

+5
-2
lines changed
  • apps/models_provider/impl/aliyun_bai_lian_model_provider/credential

1 file changed

+5
-2
lines changed

apps/models_provider/impl/aliyun_bai_lian_model_provider/credential/llm.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class BaiLianLLMModelParams(BaseForm):
4040

4141

4242
class BaiLianLLMModelCredential(BaseForm, BaseModelCredential):
43-
4443
api_base = forms.TextInputField(_('API URL'), required=True)
4544
api_key = forms.PasswordInputField(_('API Key'), required=True)
4645

@@ -71,7 +70,11 @@ def is_valid(
7170

7271
try:
7372
model = provider.get_model(model_type, model_name, model_credential, **model_params)
74-
model.invoke([HumanMessage(content=gettext('Hello'))])
73+
if model_params.get('stream'):
74+
for res in model.stream([HumanMessage(content=gettext('Hello'))]):
75+
pass
76+
else:
77+
model.invoke([HumanMessage(content=gettext('Hello'))])
7578
except Exception as e:
7679
traceback.print_exc()
7780
if isinstance(e, AppApiException):

0 commit comments

Comments
 (0)