{#if parentMessage}
{#each Object.keys(groupedMessageIds) as modelIdx} {#if groupedMessageIdsIdx[modelIdx] !== undefined && groupedMessageIds[modelIdx].messageIds.length > 0} {@const _messageId = groupedMessageIds[modelIdx].messageIds[groupedMessageIdsIdx[modelIdx]]}
{ if (messageId != _messageId) { let currentMessageId = _messageId; let messageChildrenIds = history.messages[currentMessageId].childrenIds; while (messageChildrenIds.length !== 0) { currentMessageId = messageChildrenIds.at(-1); messageChildrenIds = history.messages[currentMessageId].childrenIds; } history.currentId = currentMessageId; dispatch('change'); } }} > {#key history.currentId} {#if message} showPreviousMessage(modelIdx)} showNextMessage={() => showNextMessage(modelIdx)} {rateMessage} {editMessage} {continueResponse} regenerateResponse={async (message) => { regenerateResponse(message); await tick(); groupedMessageIdsIdx[modelIdx] = groupedMessageIds[modelIdx].messageIds.length - 1; }} on:submit={async (e) => { dispatch('submit', e.detail); }} on:action={async (e) => { dispatch('action', e.detail); }} on:update={async (e) => { dispatch('update', e.detail); }} on:save={async (e) => { dispatch('save', e.detail); }} {readOnly} /> {/if} {/key}
{/if} {/each}
{#if !readOnly} {#if !Object.keys(groupedMessageIds).find((modelIdx) => { const { messageIds } = groupedMessageIds[modelIdx]; const _messageId = messageIds[groupedMessageIdsIdx[modelIdx]]; return !history.messages[_messageId]?.done ?? false; })}
{#if history.messages[messageId]?.merged?.status} {@const message = history.messages[messageId]?.merged}
Merged Response {#if message.timestamp} {/if}
{#if (message?.content ?? '') === ''} {:else} {/if}
{/if}
{#if isLastMessage}
{/if}
{/if} {/if}
{/if}