From dda32c6880ee5c415166b014378cbfd989125193 Mon Sep 17 00:00:00 2001 From: Yeuoly <45712896+Yeuoly@users.noreply.github.com> Date: Wed, 24 Jan 2024 21:07:26 +0800 Subject: [PATCH] fix: credentials validation of ababa (#2183) --- api/core/model_runtime/model_providers/minimax/llm/llm.py | 2 +- api/core/model_runtime/model_providers/minimax/minimax.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/core/model_runtime/model_providers/minimax/llm/llm.py b/api/core/model_runtime/model_providers/minimax/llm/llm.py index 4226156309..429c75c537 100644 --- a/api/core/model_runtime/model_providers/minimax/llm/llm.py +++ b/api/core/model_runtime/model_providers/minimax/llm/llm.py @@ -55,7 +55,7 @@ class MinimaxLargeLanguageModel(LargeLanguageModel): stream=False, user='' ) - except InvalidAuthenticationError as e: + except (InvalidAuthenticationError, InsufficientAccountBalanceError) as e: raise CredentialsValidateFailedError(f"Invalid API key: {e}") def get_num_tokens(self, model: str, credentials: dict, prompt_messages: list[PromptMessage], diff --git a/api/core/model_runtime/model_providers/minimax/minimax.py b/api/core/model_runtime/model_providers/minimax/minimax.py index 97afe6aa44..52f6c2f1d3 100644 --- a/api/core/model_runtime/model_providers/minimax/minimax.py +++ b/api/core/model_runtime/model_providers/minimax/minimax.py @@ -27,4 +27,4 @@ class MinimaxProvider(ModelProvider): raise ex except Exception as ex: logger.exception(f'{self.get_provider_schema().provider} credentials validate failed') - raise ex + raise CredentialsValidateFailedError(f'{ex}')