File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
packages/jupyter-ai/jupyter_ai Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,23 @@ def get_chat_user(self) -> ChatUser:
112112 collaborative = self .config .get ("LabApp" , {}).get ("collaborative" , False )
113113
114114 if collaborative :
115- return ChatUser (** asdict (self .current_user ))
115+ names = self .current_user .name .split (" " , maxsplit = 2 )
116+ initials = "" .join (
117+ [(name .capitalize ()[0 ] if len (name ) > 0 else "" ) for name in names ]
118+ )
119+ chat_user_kwargs = {
120+ # set in case IdentityProvider doesn't return initials, e.g.
121+ # JupyterHub (#302)
122+ "initials" : initials ,
123+ ** asdict (self .current_user ),
124+ }
125+ return ChatUser (** chat_user_kwargs )
116126
117127 login = getpass .getuser ()
128+ initials = login [0 ].capitalize ()
118129 return ChatUser (
119130 username = login ,
120- initials = login [ 0 ]. capitalize () ,
131+ initials = initials ,
121132 name = login ,
122133 display_name = login ,
123134 color = None ,
You can’t perform that action at this time.
0 commit comments