- {#each citations as citation, idx}
-
- {/each}
+ {@const urlCitations = citations.filter((c) => c?.source?.name?.startsWith('http'))}
+
+
{/if}
diff --git a/src/lib/components/chat/Messages/CitationsModal.svelte b/src/lib/components/chat/Messages/Citations/CitationModal.svelte
similarity index 100%
rename from src/lib/components/chat/Messages/CitationsModal.svelte
rename to src/lib/components/chat/Messages/Citations/CitationModal.svelte
diff --git a/src/lib/components/chat/Messages/Citations/CitationsModal.svelte b/src/lib/components/chat/Messages/Citations/CitationsModal.svelte
new file mode 100644
index 0000000000..1f53c8e186
--- /dev/null
+++ b/src/lib/components/chat/Messages/Citations/CitationsModal.svelte
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+ {$i18n.t('Citations')}
+
+
{
+ show = false;
+ }}
+ >
+
+
+
+
+
+
+ {#each citations as citation, idx}
+
{
+ showCitationModal = true;
+ selectedCitation = citation;
+ }}
+ >
+ {#if citations.every((c) => c.distances !== undefined)}
+
+ {idx + 1}
+
+ {/if}
+
+ {decodeString(citation.source.name)}
+
+
+ {/each}
+
+
+
+
diff --git a/src/lib/components/chat/Messages/Markdown/Source.svelte b/src/lib/components/chat/Messages/Markdown/Source.svelte
index f87de43461..b298337320 100644
--- a/src/lib/components/chat/Messages/Markdown/Source.svelte
+++ b/src/lib/components/chat/Messages/Markdown/Source.svelte
@@ -37,6 +37,14 @@
return title;
}
+ const getDisplayTitle = (title: string) => {
+ if (!title) return 'N/A';
+ if (title.length > 30) {
+ return title.slice(0, 15) + '...' + title.slice(-10);
+ }
+ return title;
+ };
+
$: attributes = extractAttributes(token.text);
@@ -48,9 +56,11 @@
}}
>
- {decodeURIComponent(attributes.title)
- ? formattedTitle(decodeURIComponent(attributes.title))
- : ''}
+ {getDisplayTitle(
+ decodeURIComponent(attributes.title)
+ ? formattedTitle(decodeURIComponent(attributes.title))
+ : ''
+ )}
{/if}