| title | on_chat_resume |
|---|
Decorator to enable users to continue a conversation. Requires both data persistence and authentication to be enabled.
This decorator will automatically:
- Send the persisted messages and elements to the UI.
- Restore the user session.
At minimum, you will need to use the @chainlit.on_chat_resume decorator to resume conversations.
import chainlit
from chainlit import ThreadDict
@chainlit.on_chat_resume
async def on_chat_resume(thread: ThreadDict):
passHowever, if you are using a Langchain agent for instance, you will need to reinstantiate and set it in the user session yourself.
<Card title="Resume Langchain Chat Example" color="#F80061" icon="message" href="https://github.com/Chainlit/cookbook/tree/main/resume-chat"
Practical example of how to resume a chat with context.