mirror of
https://github.com/open-webui/open-webui
synced 2025-04-28 02:01:41 +00:00
refac: citations
This commit is contained in:
parent
7bcb430008
commit
3435de5af6
@ -54,7 +54,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (id.startsWith('http://') || id.startsWith('https://')) {
|
if (id.startsWith('http://') || id.startsWith('https://')) {
|
||||||
source = { name: id, ...source, url: id };
|
source = { ...source, name: id, url: id };
|
||||||
}
|
}
|
||||||
|
|
||||||
const existingSource = acc.find((item) => item.id === id);
|
const existingSource = acc.find((item) => item.id === id);
|
||||||
@ -89,28 +89,28 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{#if _citations.length > 0}
|
{#if _citations.length > 0}
|
||||||
<div class="mt-1 mb-2 w-full flex gap-1 items-center flex-wrap">
|
<div class="my-1 -mx-0.5 w-full flex gap-1 items-center flex-wrap">
|
||||||
{#if _citations.length <= 3}
|
{#if _citations.length <= 3}
|
||||||
|
<div class="flex gap-2 text-xs font-semibold">
|
||||||
{#each _citations as citation, idx}
|
{#each _citations as citation, idx}
|
||||||
<div class="flex gap-1 text-xs font-semibold">
|
|
||||||
<button
|
<button
|
||||||
class="no-toggle flex dark:text-gray-300 py-1 px-1 bg-gray-50 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-800 transition rounded-xl max-w-96"
|
class="no-toggle outline-none flex dark:text-gray-300 p-1 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900 dark:hover:bg-gray-850 transition rounded-xl max-w-96"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
showCitationModal = true;
|
showCitationModal = true;
|
||||||
selectedCitation = citation;
|
selectedCitation = citation;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{#if _citations.every((c) => c.distances !== undefined)}
|
{#if _citations.every((c) => c.distances !== undefined)}
|
||||||
<div class="bg-white dark:bg-gray-700 rounded-full size-4">
|
<div class="bg-gray-50 dark:bg-gray-800 rounded-full size-4">
|
||||||
{idx + 1}
|
{idx + 1}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="flex-1 mx-2 line-clamp-1 truncate">
|
<div class="flex-1 mx-1 line-clamp-1 truncate">
|
||||||
{citation.source.name}
|
{citation.source.name}
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
{/each}
|
{/each}
|
||||||
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<Collapsible bind:open={isCollapsibleOpen} className="w-full">
|
<Collapsible bind:open={isCollapsibleOpen} className="w-full">
|
||||||
<div
|
<div
|
||||||
|
Loading…
Reference in New Issue
Block a user