mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-28 14:52:58 +00:00
refactor: bailian
This commit is contained in:
parent
0e66b8a186
commit
3e9069aac1
|
|
@ -40,7 +40,6 @@ class BaiLianLLMModelParams(BaseForm):
|
|||
|
||||
|
||||
class BaiLianLLMModelCredential(BaseForm, BaseModelCredential):
|
||||
|
||||
api_base = forms.TextInputField(_('API URL'), required=True)
|
||||
api_key = forms.PasswordInputField(_('API Key'), required=True)
|
||||
|
||||
|
|
@ -71,7 +70,11 @@ class BaiLianLLMModelCredential(BaseForm, BaseModelCredential):
|
|||
|
||||
try:
|
||||
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:
|
||||
traceback.print_exc()
|
||||
if isinstance(e, AppApiException):
|
||||
|
|
|
|||
Loading…
Reference in New Issue