From f3f6941205989033c3c5e5e681bc60d46dccf788 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Wed, 21 Aug 2024 22:54:56 +0200 Subject: [PATCH] fix: many model chat actions not working --- src/lib/components/chat/Messages.svelte | 9 +++++++++ .../chat/Messages/MultiResponseMessages.svelte | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index 9938d2b92..8535585fa 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -386,6 +386,15 @@ {continueGeneration} {mergeResponses} {regenerateResponse} + on:action={async (e) => { + console.log('action', e); + if (typeof e.detail === 'string') { + await chatActionHandler(chatId, e.detail, message.model, message.id); + } else { + const { id, event } = e.detail; + await chatActionHandler(chatId, id, message.model, message.id, event); + } + }} on:change={async () => { await updateChatById(localStorage.token, chatId, { messages: messages, diff --git a/src/lib/components/chat/Messages/MultiResponseMessages.svelte b/src/lib/components/chat/Messages/MultiResponseMessages.svelte index c4826d9af..212bd8866 100644 --- a/src/lib/components/chat/Messages/MultiResponseMessages.svelte +++ b/src/lib/components/chat/Messages/MultiResponseMessages.svelte @@ -186,6 +186,9 @@ await tick(); groupedMessagesIdx[modelIdx] = groupedMessages[modelIdx].messages.length - 1; }} + on:action={async (e) => { + dispatch('action', e.detail); + }} on:save={async (e) => { console.log('save', e);