{#key message.id}
{#if message.model in modelfiles} {modelfiles[message.model]?.title} {:else} {message.model ? ` ${message.model}` : ''} {/if} {#if message.timestamp}
{dayjs(message.timestamp * 1000).format($i18n.t('DD/MM/YYYY HH:mm'))}
{/if}
{#if message.files}
{#each message.files as file}
{#if file.type === 'image'}
{/if}
{/each}
{/if}
{#if edit === true}
{ e.target.style.height = ''; e.target.style.height = `${e.target.scrollHeight}px`; }} />
{ editMessageConfirmHandler(); }} > {$i18n.t('Save')}
{ cancelEditMessage(); }} > {$i18n.t('Cancel')}
{:else}
{#if message?.error === true}
{message.content}
{:else if message.content === ''}
{:else} {#each tokens as token} {#if token.type === 'code'}
{:else} {@html marked.parse(token.raw, { ...defaults, gfm: true, breaks: true, renderer })} {/if} {/each} {/if} {#if message.citations}
{#each message.citations.reduce((acc, citation) => { citation.document.forEach((document, index) => { const metadata = citation.metadata?.[index]; const id = metadata?.source ?? 'N/A'; const existingSource = acc.find((item) => item.id === id); if (existingSource) { existingSource.document.push(document); existingSource.metadata.push(metadata); } else { acc.push( { id: id, source: citation?.source, document: [document], metadata: metadata ? [metadata] : [] } ); } }); return acc; }, []) as citation, idx}
{ showCitationModal = true; selectedCitation = citation; }} >
{idx + 1}
{citation.source.name}
{/each}
{/if} {#if message.done || siblings.length > 1}
{#if siblings.length > 1}
{ showPreviousMessage(message); }} >
{siblings.indexOf(message.id) + 1} / {siblings.length}
{ showNextMessage(message); }} >
{/if} {#if message.done} {#if !readOnly}
{ editMessageHandler(); }} >
{/if}
{ copyToClipboard(message.content); }} >
{#if !readOnly}
{ rateMessage(message.id, 1); showRateComment = true; window.setTimeout(() => { document .getElementById(`message-feedback-${message.id}`) ?.scrollIntoView(); }, 0); }} >
{ rateMessage(message.id, -1); showRateComment = true; window.setTimeout(() => { document .getElementById(`message-feedback-${message.id}`) ?.scrollIntoView(); }, 0); }} >
{/if}
{ if (!loadingSpeech) { toggleSpeakMessage(message); } }} > {#if loadingSpeech}
{:else if speaking}
{:else}
{/if}
{#if $config.images && !readOnly}
{ if (!generatingImage) { generateImage(message); } }} > {#if generatingImage}
{:else}
{/if}
{/if} {#if message.info}
{ console.log(message); }} id="info-{message.id}" >
{/if} {#if isLastMessage && !readOnly}
{ continueGeneration(); }} >
{/if} {/if}
{/if} {#if message.done && showRateComment}
{ updateChatMessages(); }} /> {/if}
{/if}
{/key}