diff --git a/src/lib/components/chat/Messages/Citations.svelte b/src/lib/components/chat/Messages/Citations.svelte index fa75589abf..a76b5def80 100644 --- a/src/lib/components/chat/Messages/Citations.svelte +++ b/src/lib/components/chat/Messages/Citations.svelte @@ -1,10 +1,6 @@ - + {#if citations.length > 0} -
- {#if citations.length <= 3} -
- {#each citations as citation, idx} - - {/each} + {@const urlCitations = citations.filter((c) => c?.source?.name?.startsWith('http'))} +
+ - {/each} -
-
-
- - {citations.length - ($mobile ? 1 : 2)} - {$i18n.t('more')} -
-
-
- {#if isCollapsibleOpen} - - {:else} - - {/if} -
- -
-
- {#each citations.slice($mobile ? 1 : 2) as citation, idx} - - {/each} -
-
- - {/if} + {/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')} +
+ +
+ +
+
+ {#each citations as citation, idx} + + {/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}