Skip to content

Commit

Permalink
feat: display user message too
Browse files Browse the repository at this point in the history
  • Loading branch information
CNSeniorious000 committed Aug 18, 2024
1 parent 5eff338 commit 1be0600
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib/components/Chat.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@

<main class="mb-50 mt-10 w-[min(70rem,calc(100vw-5rem))] flex flex-col justify-between">
<div class="group w-full flex flex-col-reverse text-sm">
{#each context?.snapshots ?? [] as ctx}
{#each context?.snapshots ?? [] as ctx, i}
<div class="relative flex flex-col gap-4.5 overflow-scroll border-t-1 border-neutral-6 border-dashed px-7 py-7 hover:(border-neutral-4 border-solid bg-white/2)">
<div>
<span class="bg-neutral-2 text-neutral-9">
{messages.filter(msg => msg.role === "user").at(-1 - i)?.content}
</span>
</div>
{#if ctx.response?.length}
<section class="flex flex-col gap-1">
{#each ctx.response ?? [] as text}
Expand All @@ -64,7 +69,10 @@
<Highlight source={ctx.sources.join("\n")} lang="python" />
{/if}
{#if ctx.results?.length}
<Highlight source={JSON.stringify(Object.assign({}, ...ctx.results), null, 4)} lang="json" />
{@const entries = ctx.results.flatMap(Object.entries)}
{#if entries.length}
<Highlight source={JSON.stringify(Object.fromEntries(entries), null, 4)} lang="json" />
{/if}
{/if}
<div class="absolute right-0 top-0 flex flex-row translate-x-0.25em select-none items-center text-7xl op-5 -translate-y-2/7">
<span class="font-bold font-fira">&lt;/</span>
Expand Down

0 comments on commit 1be0600

Please sign in to comment.