chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

How get user_session on upsert_feedback custom data layer ?

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

I want to impelement user feedback without literal AI and i got tutorial from this link. https://medium.com/@yukthihettiarachchissck/enable-human-feedback-in-chainlit-without-literal-api-key-and-save-feedback-95bfd3a01073

i want to get variabel from cl.user_session in method upsert_feedback. so that i can make an action after user give feedback like store to database or something. but i always got an error "Internal Server Error: Chainlit context not found".

please somebody help me!

this is my simple script ------

class TestDataLayer(cl_data.BaseDataLayer): async def upsert_feedback(self, feedback: Feedback):
message_id = cl.user_session.get("message_id") print(message_id) print(feedback) return 'done'

image

fahmyqwee avatar Jul 11 '24 04:07 fahmyqwee