Skip to content

Commit

Permalink
use provider_name in auth error message
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-i committed Dec 12, 2023
1 parent 2b060c9 commit dd25501
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,13 @@ def is_api_key_error(self, e: Exception):
return isinstance(e, self.API_KEY_EXCEPTIONS)

def handle_api_key_error(self, e: Exception, message: HumanChatMessage):
llm_id = f" {self.llm.id}" if self.llm and self.llm.id else ""
response = f"Oops! It seems there's an issue with your{llm_id} API key. Please update your{llm_id} API key in the chat Settings."
provider_name = ""
if hasattr(self.config_manager, "lm_provider") and hasattr(
self.config_manager.lm_provider, "name"
):
name = getattr(self.config_manager.lm_provider, "name", "")
provider_name = f" {name}" if name else ""
response = f"Oops! It seems there's an issue with your{provider_name} API key. Please update your{provider_name} API key in the chat Settings."
self.reply(response, message)

async def _default_handle_exc(self, e: Exception, message: HumanChatMessage):
Expand Down

0 comments on commit dd25501

Please sign in to comment.