From 9e6a5b2d850cf988811084d9824052d48e33fd8f Mon Sep 17 00:00:00 2001 From: Maciej Wieczorek Date: Tue, 7 May 2024 13:05:05 +0200 Subject: [PATCH] Run on_chat_resume() before resume_thread() (#968) 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: