{#key currentMessageId} {#each Object.keys(groupedMessages) as model} {#if groupedMessagesIdx[model] !== undefined && groupedMessages[model].messages.length > 0} {@const message = groupedMessages[model].messages[groupedMessagesIdx[model]]}
{ if (currentMessageId != message.id) { currentMessageId = message.id; let messageId = message.id; console.log(messageId); // let messageChildrenIds = history.messages[messageId].childrenIds; while (messageChildrenIds.length !== 0) { messageId = messageChildrenIds.at(-1); messageChildrenIds = history.messages[messageId].childrenIds; } history.currentId = messageId; dispatch('change'); } }} > m.id)} isLastMessage={true} {updateChatMessages} {confirmEditResponseMessage} showPreviousMessage={() => showPreviousMessage(model)} showNextMessage={() => showNextMessage(model)} {readOnly} {rateMessage} {copyToClipboard} {continueGeneration} regenerateResponse={async (message) => { regenerateResponse(message); await tick(); groupedMessagesIdx[model] = groupedMessages[model].messages.length - 1; }} on:save={async (e) => { console.log('save', e); const message = e.detail; history.messages[message.id] = message; await updateChatById(localStorage.token, chatId, { messages: messages, history: history }); }} />
{/if} {/each} {/key}