From a500e10b05b68432bf6b747a2c341683997bdc21 Mon Sep 17 00:00:00 2001 From: Maciej Wieczorek Date: Tue, 7 May 2024 11:30:28 +0200 Subject: [PATCH] Run on_chat_resume() before resume_thread() Execute the on_chat_resume decorator before the resume_thread emitter. This allows the `thread` in on_chat_resume to be updated on load. --- backend/chainlit/socket.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/chainlit/socket.py b/backend/chainlit/socket.py index 34c6a892f4..69b69ff371 100644 --- a/backend/chainlit/socket.py +++ b/backend/chainlit/socket.py @@ -177,8 +177,8 @@ async def connection_successful(sid): "first_interaction", {"interaction": "resume", "thread_id": thread.get("id")}, ) - await context.emitter.resume_thread(thread) await config.code.on_chat_resume(thread) + await context.emitter.resume_thread(thread) return if config.code.on_chat_start: