+
-
- {message.content}
+
+ {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}
+
+
+ [{idx + 1}]
+
+
+
-
- {:else}
- {#each tokens as token}
- {#if token.type === 'code'}
-
- {:else}
- {@html marked.parse(token.raw, {
- ...defaults,
- gfm: true,
- breaks: true,
- renderer
- })}
- {/if}
{/each}
-
- {/if}
+
- {#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}
-
-
- [{idx + 1}]
-
-
-
+ {/if}
- {#if showRateComment}
-
{
- updateChatMessages();
- }}
- />
- {/if}
-