Просмотр исходного кода

fix: run model serval ex not return (#915)

takatost 1 год назад
Родитель
Сommit
2a27dad2fb

+ 1 - 1
api/core/model_providers/models/llm/azure_openai_model.py

@@ -166,7 +166,7 @@ class AzureOpenAIModel(BaseLLM):
         elif isinstance(ex, openai.error.RateLimitError):
         elif isinstance(ex, openai.error.RateLimitError):
             return LLMRateLimitError('Azure ' + str(ex))
             return LLMRateLimitError('Azure ' + str(ex))
         elif isinstance(ex, openai.error.AuthenticationError):
         elif isinstance(ex, openai.error.AuthenticationError):
-            raise LLMAuthorizationError('Azure ' + str(ex))
+            return LLMAuthorizationError('Azure ' + str(ex))
         elif isinstance(ex, openai.error.OpenAIError):
         elif isinstance(ex, openai.error.OpenAIError):
             return LLMBadRequestError('Azure ' + ex.__class__.__name__ + ":" + str(ex))
             return LLMBadRequestError('Azure ' + ex.__class__.__name__ + ":" + str(ex))
         else:
         else:

+ 1 - 1
api/core/model_providers/models/llm/openai_model.py

@@ -185,7 +185,7 @@ class OpenAIModel(BaseLLM):
         elif isinstance(ex, openai.error.RateLimitError):
         elif isinstance(ex, openai.error.RateLimitError):
             return LLMRateLimitError(str(ex))
             return LLMRateLimitError(str(ex))
         elif isinstance(ex, openai.error.AuthenticationError):
         elif isinstance(ex, openai.error.AuthenticationError):
-            raise LLMAuthorizationError(str(ex))
+            return LLMAuthorizationError(str(ex))
         elif isinstance(ex, openai.error.OpenAIError):
         elif isinstance(ex, openai.error.OpenAIError):
             return LLMBadRequestError(ex.__class__.__name__ + ":" + str(ex))
             return LLMBadRequestError(ex.__class__.__name__ + ":" + str(ex))
         else:
         else: