mirror of
https://github.com/open-webui/open-webui
synced 2025-01-18 08:40:58 +00:00
refac: styling
This commit is contained in:
parent
38590da0b1
commit
4c490132ba
@ -320,6 +320,7 @@ def rag_messages(
|
|||||||
extracted_collections.extend(collection)
|
extracted_collections.extend(collection)
|
||||||
|
|
||||||
context_string = ""
|
context_string = ""
|
||||||
|
|
||||||
citations = []
|
citations = []
|
||||||
for context in relevant_contexts:
|
for context in relevant_contexts:
|
||||||
try:
|
try:
|
||||||
@ -335,6 +336,7 @@ def rag_messages(
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(e)
|
log.exception(e)
|
||||||
|
|
||||||
context_string = context_string.strip()
|
context_string = context_string.strip()
|
||||||
|
|
||||||
ra_content = rag_template(
|
ra_content = rag_template(
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<Modal size="lg" bind:show>
|
<Modal size="lg" bind:show>
|
||||||
<div>
|
<div>
|
||||||
<div class=" flex justify-between dark:text-gray-300 px-5 pt-4">
|
<div class=" flex justify-between dark:text-gray-300 px-5 pt-4 pb-2">
|
||||||
<div class=" text-lg font-medium self-center capitalize">
|
<div class=" text-lg font-medium self-center capitalize">
|
||||||
{$i18n.t('Citation')}
|
{$i18n.t('Citation')}
|
||||||
</div>
|
</div>
|
||||||
@ -45,29 +45,32 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col w-full px-5 py-4 dark:text-gray-200 overflow-y-scroll max-h-[22rem]">
|
|
||||||
{#each mergedDocuments as document, documentIdx}
|
|
||||||
<div class="flex flex-col w-full">
|
|
||||||
<div class=" font-medium dark:text-gray-300">
|
|
||||||
{$i18n.t('Source')}
|
|
||||||
</div>
|
|
||||||
<div class="text-sm dark:text-gray-400">
|
|
||||||
{document.metadata?.source ?? $i18n.t('No source available')}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col w-full">
|
|
||||||
<div class=" font-medium dark:text-gray-300">
|
|
||||||
{$i18n.t('Content')}
|
|
||||||
</div>
|
|
||||||
<pre class="text-sm dark:text-gray-400">
|
|
||||||
{document.document}
|
|
||||||
</pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if documentIdx !== mergedDocuments.length - 1}
|
<div class="flex flex-col md:flex-row w-full px-5 pb-5 md:space-x-4">
|
||||||
<hr class=" dark:border-gray-850" />
|
<div class="flex flex-col w-full dark:text-gray-200 overflow-y-scroll max-h-[22rem]">
|
||||||
{/if}
|
{#each mergedDocuments as document, documentIdx}
|
||||||
{/each}
|
<div class="flex flex-col w-full">
|
||||||
|
<div class="text-sm font-medium dark:text-gray-300">
|
||||||
|
{$i18n.t('Source')}
|
||||||
|
</div>
|
||||||
|
<div class="text-sm dark:text-gray-400">
|
||||||
|
{document.metadata?.source ?? $i18n.t('No source available')}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col w-full">
|
||||||
|
<div class=" text-sm font-medium dark:text-gray-300">
|
||||||
|
{$i18n.t('Content')}
|
||||||
|
</div>
|
||||||
|
<pre class="text-sm dark:text-gray-400 whitespace-pre-line">
|
||||||
|
{document.document}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if documentIdx !== mergedDocuments.length - 1}
|
||||||
|
<hr class=" dark:border-gray-850 my-3" />
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@ -141,6 +141,7 @@
|
|||||||
const zipped = (citation?.document ?? []).map(function (document, index) {
|
const zipped = (citation?.document ?? []).map(function (document, index) {
|
||||||
return [document, citation.metadata?.[index]];
|
return [document, citation.metadata?.[index]];
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const [document, metadata] of zipped) {
|
for (const [document, metadata] of zipped) {
|
||||||
const source = metadata?.source ?? 'N/A';
|
const source = metadata?.source ?? 'N/A';
|
||||||
if (source in flattenedCitations) {
|
if (source in flattenedCitations) {
|
||||||
@ -154,6 +155,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(flattenedCitations);
|
console.log(flattenedCitations);
|
||||||
console.log(Object.keys(flattenedCitations));
|
console.log(Object.keys(flattenedCitations));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user