{#if messages.length == 0}
How can I help you today?
{:else} {#each messages as message, messageIdx}
{#if message.role === 'user'} {#if $config === null || !($config?.auth ?? true)}
{:else}
{/if} {:else}
{/if}
{#if message.role === 'user'} You {:else} Ollama
{message.model ? ` ${message.model}` : ''}
{/if}
{#if message.role !== 'user' && message.content === ''}
{:else}
{#if message.role == 'user'} {#if message?.edit === true}
{ e.target.style.height = ''; e.target.style.height = `${e.target.scrollHeight}px`; }} on:focus={(e) => { e.target.style.height = ''; e.target.style.height = `${e.target.scrollHeight}px`; }} />
{ confirmEditMessage(message.id); }} > Save & Submit
{ cancelEditMessage(message.id); }} > Cancel
{:else}
{#if message.files}
{#each message.files as file}
{#if file.type === 'image'}
{/if}
{/each}
{/if} {message.content}
{#if message.parentId !== null && message.parentId in history.messages && (history.messages[message.parentId]?.childrenIds.length ?? 0) > 1}
{ showPreviousMessage(message); }} >
{history.messages[message.parentId].childrenIds.indexOf(message.id) + 1} / {history.messages[message.parentId].childrenIds.length}
{ showNextMessage(message); }} >
{:else if message.parentId === null && Object.values(history.messages).filter((message) => message.parentId === null).length > 1}
{ showPreviousMessage(message); }} >
{Object.values(history.messages) .filter((message) => message.parentId === null) .map((message) => message.id) .indexOf(message.id) + 1} / {Object.values(history.messages).filter( (message) => message.parentId === null ).length}
{ showNextMessage(message); }} >
{/if}
{ editMessageHandler(message.id); }} >
{ copyToClipboard(message.content); }} >
{/if} {:else}
{@html marked(message.content.replace('\\\\', '\\\\\\'))} {#if message.done}
{#if message.parentId !== null && message.parentId in history.messages && (history.messages[message.parentId]?.childrenIds.length ?? 0) > 1}
{ showPreviousMessage(message); }} >
{history.messages[message.parentId].childrenIds.indexOf(message.id) + 1} / {history.messages[message.parentId].childrenIds.length}
{ showNextMessage(message); }} >
{/if}
{ copyToClipboard(message.content); }} >
{ rateMessage(messageIdx, 1); }} >
{ rateMessage(messageIdx, -1); }} >
{ speakMessage(message.content); }} >
{#if messageIdx + 1 === messages.length}
{/if}
{/if}
{/if}
{/if}
{/each} {/if}