Skip to content

Commit

Permalink
Use pn.state.user instead of self.user
Browse files Browse the repository at this point in the history
  • Loading branch information
smokestacklightnin committed Jan 6, 2025
1 parent 07eec54 commit 05d5e52
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ragna/deploy/_ui/central_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def _build_message(self, *args, **kwargs) -> Optional[RagnaChatMessage]:
# We only ever hit this function for user inputs, since we control the
# generation of the system and assistant messages manually. Thus, we can
# unconditionally create a user message here.
return RagnaChatMessage(message.object, role="user", user=self.user)
return RagnaChatMessage(message.object, role="user", user=pn.state.user)


class CentralView(pn.viewable.Viewer):
Expand Down Expand Up @@ -300,7 +300,7 @@ def get_user_from_role(self, role: Literal["system", "user", "assistant"]) -> st
if role == "system":
return "Ragna"
elif role == "user":
return cast(str, self.user)
return cast(str, pn.state.user)
elif role == "assistant":
return cast(str, self.current_chat["assistant"])
else:
Expand Down Expand Up @@ -368,7 +368,7 @@ def chat_interface(self):
for message in self.current_chat["messages"]
],
callback=self.chat_callback,
user=self.user,
user=pn.state.user,
get_user_from_role=self.get_user_from_role,
show_rerun=False,
show_undo=False,
Expand Down

0 comments on commit 05d5e52

Please sign in to comment.