Skip to content

Commit 6d7b5eb

Browse files
committed
fix: Increase log output
1 parent 27d4603 commit 6d7b5eb

File tree

1 file changed

+2
-1
lines changed
  • apps/setting/models_provider/impl/openai_model_provider/credential

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from django.utils.translation import gettext_lazy as _, gettext
1313
from langchain_core.messages import HumanMessage
14+
from openai import BadRequestError
1415

1516
from common import forms
1617
from common.exception.app_exception import AppApiException
@@ -58,7 +59,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
5859
model.invoke([HumanMessage(content=gettext('Hello'))])
5960
except Exception as e:
6061
traceback.print_exc()
61-
if isinstance(e, AppApiException):
62+
if isinstance(e, AppApiException) or isinstance(e, BadRequestError):
6263
raise e
6364
if raise_exception:
6465
raise AppApiException(ValidCode.valid_error.value,

0 commit comments

Comments
 (0)