mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
refac
This commit is contained in:
parent
d0b20df46c
commit
63ca0b8cba
2 changed files with 28 additions and 3 deletions
|
|
@ -11,14 +11,16 @@
|
|||
let showPercentage = false;
|
||||
let showRelevance = true;
|
||||
|
||||
let citationModal = null;
|
||||
let showCitationModal = false;
|
||||
let selectedCitation: any = null;
|
||||
let isCollapsibleOpen = false;
|
||||
|
||||
export const showSourceModal = (sourceIdx) => {
|
||||
if (citations[sourceIdx]) {
|
||||
selectedCitation = citations[sourceIdx];
|
||||
showCitationModal = true;
|
||||
console.log('Showing citation modal for:', citations[sourceIdx]);
|
||||
citationModal?.showCitation(citations[sourceIdx]);
|
||||
// showCitationModal = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -94,7 +96,14 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<CitationsModal bind:show={showCitationModal} {id} {citations} {showPercentage} {showRelevance} />
|
||||
<CitationsModal
|
||||
bind:this={citationModal}
|
||||
bind:show={showCitationModal}
|
||||
{id}
|
||||
{citations}
|
||||
{showPercentage}
|
||||
{showRelevance}
|
||||
/>
|
||||
|
||||
{#if citations.length > 0}
|
||||
{@const urlCitations = citations.filter((c) => c?.source?.name?.startsWith('http'))}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import Modal from '$lib/components/common/Modal.svelte';
|
||||
import XMark from '$lib/components/icons/XMark.svelte';
|
||||
import CitationModal from './CitationModal.svelte';
|
||||
|
||||
export let id = '';
|
||||
export let show = false;
|
||||
|
|
@ -12,6 +13,14 @@
|
|||
export let showPercentage = false;
|
||||
export let showRelevance = true;
|
||||
|
||||
let showCitationModal = false;
|
||||
let selectedCitation: any = null;
|
||||
|
||||
export const showCitation = (citation) => {
|
||||
selectedCitation = citation;
|
||||
showCitationModal = true;
|
||||
};
|
||||
|
||||
const decodeString = (str: string) => {
|
||||
try {
|
||||
return decodeURIComponent(str);
|
||||
|
|
@ -21,6 +30,13 @@
|
|||
};
|
||||
</script>
|
||||
|
||||
<CitationModal
|
||||
bind:show={showCitationModal}
|
||||
citation={selectedCitation}
|
||||
{showPercentage}
|
||||
{showRelevance}
|
||||
/>
|
||||
|
||||
<Modal size="lg" bind:show>
|
||||
<div>
|
||||
<div class=" flex justify-between dark:text-gray-300 px-5 pt-4 pb-2">
|
||||
|
|
|
|||
Loading…
Reference in a new issue