From 94c30837a24f8c4b68bcc8dc39e68a327257ea5f Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 21 May 2025 22:39:49 +0300 Subject: [PATCH] Fix attaching files to permanent assistant from welcome screen --- public/scripts/chats.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/scripts/chats.js b/public/scripts/chats.js index 9cb753223..212c09653 100644 --- a/public/scripts/chats.js +++ b/public/scripts/chats.js @@ -351,10 +351,13 @@ async function onFileAttach(file) { $('#file_form .file_size').text(humanFileSize(file.size)); $('#file_form').removeClass('displayNone'); - // Reset form on chat change - eventSource.once(event_types.CHAT_CHANGED, () => { - $('#file_form').trigger('reset'); - }); + // Reset form on chat change (if not on a welcome screen) + const currentChatId = getCurrentChatId(); + if (currentChatId) { + eventSource.once(event_types.CHAT_CHANGED, () => { + $('#file_form').trigger('reset'); + }); + } } /**