{#if Object.keys(history?.messages ?? {}).length == 0}
{ const {content, imageUrl} = p; let text = content; if (content.includes('{{CLIPBOARD}}')) { const clipboardText = await navigator.clipboard.readText().catch((err) => { toast.error($i18n.t('Failed to read clipboard contents')); return '{{CLIPBOARD}}'; }); text = content.replaceAll('{{CLIPBOARD}}', clipboardText); console.log('Clipboard text:', clipboardText, text); } if (imageUrl !== "") { files = [{ type: 'image', url: imageUrl }] } prompt = text; await tick(); const chatInputContainerElement = document.getElementById('chat-input-container'); if (chatInputContainerElement) { prompt = p; chatInputContainerElement.style.height = ''; chatInputContainerElement.style.height = Math.min(chatInputContainerElement.scrollHeight, 200) + 'px'; chatInputContainerElement.focus(); } await tick(); }} /> {:else}
{#key chatId}
{#if messages.at(0)?.parentId !== null}
{ console.log('visible'); if (!messagesLoading) { loadMoreMessages(); } }} >
Loading...
{/if} {#each messages as message, messageIdx (message.id)}
{/each}
{#if bottomPadding}
{/if} {/key}
{/if}