chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

chainlit.context.ChainlitContextException: Chainlit context not found when trying cl.user_session.get("languages") in set_starters function

Open jayabdulraman opened this issue 1 year ago • 1 comments
trafficstars

Describe the bug I am getting chainlit.context.ChainlitContextException: Chainlit context not found when trying to get languages stored in the user_session in set_starters function.

To Reproduce Steps to reproduce the behavior:

  1. Run server with -w
  2. Type 'cl.user_session.get("languages")' in set_starters function.
  3. See error

Expected behavior My goal is to get users' browser language, do a conditional check and return conversational starters in their language. cl.user_session.get("languages") works in the other decorators like on_message and on_chat_start. I want it to work on set_starters as well.

Screenshots image

jayabdulraman avatar Jul 17 '24 04:07 jayabdulraman