refactor: bailian
This commit is contained in:
parent
0e66b8a186
commit
3e9069aac1
@ -40,7 +40,6 @@ class BaiLianLLMModelParams(BaseForm):
|
|||||||
|
|
||||||
|
|
||||||
class BaiLianLLMModelCredential(BaseForm, BaseModelCredential):
|
class BaiLianLLMModelCredential(BaseForm, BaseModelCredential):
|
||||||
|
|
||||||
api_base = forms.TextInputField(_('API URL'), required=True)
|
api_base = forms.TextInputField(_('API URL'), required=True)
|
||||||
api_key = forms.PasswordInputField(_('API Key'), required=True)
|
api_key = forms.PasswordInputField(_('API Key'), required=True)
|
||||||
|
|
||||||
@ -71,7 +70,11 @@ class BaiLianLLMModelCredential(BaseForm, BaseModelCredential):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
model = provider.get_model(model_type, model_name, model_credential, **model_params)
|
model = provider.get_model(model_type, model_name, model_credential, **model_params)
|
||||||
model.invoke([HumanMessage(content=gettext('Hello'))])
|
if model_params.get('stream'):
|
||||||
|
for res in model.stream([HumanMessage(content=gettext('Hello'))]):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
model.invoke([HumanMessage(content=gettext('Hello'))])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
if isinstance(e, AppApiException):
|
if isinstance(e, AppApiException):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user