{#if messages.length == 0}
{#if selectedModelfile && selectedModelfile.imageUrl}
{:else}
{/if}
{#if selectedModelfile}
{selectedModelfile.title}
{selectedModelfile.desc}
{#if selectedModelfile.user}
By
{selectedModelfile.user.name ? selectedModelfile.user.name : `@${selectedModelfile.user.username}`}
{/if} {:else} How can I help you today? {/if}
{:else} {#each messages as message, messageIdx}
{#if message.role === 'user'} {#if $config === null || !($config?.auth ?? true)}
{:else}
{/if} {:else if selectedModelfile}
{:else}
{/if}
{#if message.role === 'user'} You {:else if selectedModelfile}
{selectedModelfile.title}
{: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.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} {/if} {#if message.role === 'assistant'}
{#if message?.edit === true}
{ e.target.style.height = `${e.target.scrollHeight}px`; }} />
{ confirmEditResponseMessage(message.id); }} > Save
{ cancelEditMessage(message.id); }} > Cancel
{: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}
{ editMessageHandler(message.id); }} >
{ copyToClipboard(message.content); }} >
{ rateMessage(messageIdx, 1); }} >
{ rateMessage(messageIdx, -1); }} >
{ speakMessage(message.content); }} >
{#if messageIdx + 1 === messages.length}
{/if}
{/if}
{/if}
{/if}
{/if}
{/each} {/if}