{#each Object.keys(groupedMessages) as model} {#if groupedMessagesIdx[model] !== undefined && groupedMessages[model].messages.length > 0}
{ currentMessageId = groupedMessages[model].messages[groupedMessagesIdx[model]].id; let messageId = groupedMessages[model].messages[groupedMessagesIdx[model]].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)} {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}