Skip to content

Commit

Permalink
use current_user.name for default initials
Browse files Browse the repository at this point in the history
  • Loading branch information
dlqqq committed Aug 3, 2023
1 parent 6e6fc1a commit 3360c40
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/jupyter-ai/jupyter_ai/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,9 @@ def get_chat_user(self) -> ChatUser:
"jupyter_collaboration", False
)

login = getpass.getuser()
initials = login[0].capitalize()

if collaborative:
names = self.current_user.name.split(" ", maxsplit=2)
initials = "".join([(name[0] if len(name) > 0 else "") for name in names])
chat_user_kwargs = {
# set in case IdentityProvider doesn't return initials, e.g.
# JupyterHub (#302)
Expand All @@ -126,6 +125,8 @@ def get_chat_user(self) -> ChatUser:
}
return ChatUser(**chat_user_kwargs)

login = getpass.getuser()
initials = login[0].capitalize()
return ChatUser(
username=login,
initials=initials,
Expand Down

0 comments on commit 3360c40

Please sign in to comment.