refac: citation styling

This commit is contained in:
Timothy J. Baek 2024-05-07 23:13:37 -07:00
parent 1ea91f9060
commit 72675ec15f

View File

@ -444,12 +444,10 @@
})} })}
{/if} {/if}
{/each} {/each}
<!-- {@html marked(message.content.replaceAll('\\', '\\\\'))} -->
{/if} {/if}
{#if message.citations} {#if message.citations}
<hr class=" dark:border-gray-800 my-1" /> <div class="mt-1 mb-2 w-full flex gap-1 items-center">
<div class="my-2.5 w-full flex flex-col gap-1">
{#each message.citations.reduce((acc, citation) => { {#each message.citations.reduce((acc, citation) => {
citation.document.forEach((document, index) => { citation.document.forEach((document, index) => {
const metadata = citation.metadata?.[index]; const metadata = citation.metadata?.[index];
@ -467,18 +465,19 @@
return acc; return acc;
}, []) as citation, idx} }, []) as citation, idx}
<div class="flex gap-1 text-xs font-semibold"> <div class="flex gap-1 text-xs font-semibold">
<div>
[{idx + 1}]
</div>
<button <button
class="dark:text-gray-500 underline" class="flex dark:text-gray-300 py-0.5 px-0.5 bg-gray-50 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-800 transition rounded-xl"
on:click={() => { on:click={() => {
showCitationModal = true; showCitationModal = true;
selectedCitation = citation; selectedCitation = citation;
}} }}
> >
<div class="bg-white dark:bg-gray-700 rounded-full size-4 mr-1.5">
{idx + 1}
</div>
<div class=" mr-1.5">
{citation.source.name} {citation.source.name}
</div>
</button> </button>
</div> </div>
{/each} {/each}