Skip to content

Commit ef04a70

Browse files
committed
chore: format
1 parent 5fda814 commit ef04a70

61 files changed

Lines changed: 192 additions & 40 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/lib/components/chat/Messages/Citations/CitationModal.svelte

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -211,37 +211,47 @@
211211
</div>
212212

213213
{#if document.metadata?.html}
214-
<iframe
215-
class="w-full border-0 h-auto rounded-none"
216-
sandbox="allow-scripts allow-forms{($settings?.iframeSandboxAllowSameOrigin ??
217-
false)
218-
? ' allow-same-origin'
219-
: ''}"
220-
srcdoc={document.document}
221-
title={$i18n.t('Content')}
222-
></iframe>
223-
{:else}
224-
{@const rawContent = document.document.trim().replace(/\n\n+/g, '\n\n')}
225-
{@const isTruncated = ($settings?.renderMarkdownInPreviews ?? true) && rawContent.length > CONTENT_PREVIEW_LIMIT && !expandedDocs.has(documentIdx)}
226-
{#if $settings?.renderMarkdownInPreviews ?? true}
227-
<div class="text-sm prose dark:prose-invert max-w-full">
228-
<Markdown content={isTruncated ? rawContent.slice(0, CONTENT_PREVIEW_LIMIT) : rawContent} id="citation-{documentIdx}" />
229-
</div>
230-
{#if isTruncated}
231-
<button
232-
class="mt-1 text-xs text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition"
233-
on:click={() => {
234-
expandedDocs.add(documentIdx);
235-
expandedDocs = expandedDocs;
236-
}}
237-
>
238-
{$i18n.t('Show all ({{COUNT}} characters)', { COUNT: rawContent.length.toLocaleString() })}
239-
</button>
214+
<iframe
215+
class="w-full border-0 h-auto rounded-none"
216+
sandbox="allow-scripts allow-forms{($settings?.iframeSandboxAllowSameOrigin ??
217+
false)
218+
? ' allow-same-origin'
219+
: ''}"
220+
srcdoc={document.document}
221+
title={$i18n.t('Content')}
222+
></iframe>
223+
{:else}
224+
{@const rawContent = document.document.trim().replace(/\n\n+/g, '\n\n')}
225+
{@const isTruncated =
226+
($settings?.renderMarkdownInPreviews ?? true) &&
227+
rawContent.length > CONTENT_PREVIEW_LIMIT &&
228+
!expandedDocs.has(documentIdx)}
229+
{#if $settings?.renderMarkdownInPreviews ?? true}
230+
<div class="text-sm prose dark:prose-invert max-w-full">
231+
<Markdown
232+
content={isTruncated
233+
? rawContent.slice(0, CONTENT_PREVIEW_LIMIT)
234+
: rawContent}
235+
id="citation-{documentIdx}"
236+
/>
237+
</div>
238+
{#if isTruncated}
239+
<button
240+
class="mt-1 text-xs text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition"
241+
on:click={() => {
242+
expandedDocs.add(documentIdx);
243+
expandedDocs = expandedDocs;
244+
}}
245+
>
246+
{$i18n.t('Show all ({{COUNT}} characters)', {
247+
COUNT: rawContent.length.toLocaleString()
248+
})}
249+
</button>
250+
{/if}
251+
{:else}
252+
<pre class="text-sm dark:text-gray-400 whitespace-pre-line">{rawContent}</pre>
253+
{/if}
240254
{/if}
241-
{:else}
242-
<pre class="text-sm dark:text-gray-400 whitespace-pre-line">{rawContent}</pre>
243-
{/if}
244-
{/if}
245255
</div>
246256
</div>
247257
{/each}

src/lib/components/common/FileItemModal.svelte

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -371,17 +371,29 @@
371371
{:else if selectedTab === ''}
372372
{#if item?.file?.data}
373373
{@const rawContent = (item?.file?.data?.content ?? '').trim() || 'No content'}
374-
{@const isTruncated = ($settings?.renderMarkdownInPreviews ?? true) && rawContent.length > CONTENT_PREVIEW_LIMIT && !expandedContent}
374+
{@const isTruncated =
375+
($settings?.renderMarkdownInPreviews ?? true) &&
376+
rawContent.length > CONTENT_PREVIEW_LIMIT &&
377+
!expandedContent}
375378
{#if $settings?.renderMarkdownInPreviews ?? true}
376-
<div class="max-h-96 overflow-scroll scrollbar-hidden text-sm prose dark:prose-invert max-w-full">
377-
<Markdown content={isTruncated ? rawContent.slice(0, CONTENT_PREVIEW_LIMIT) : rawContent} id="file-preview" />
379+
<div
380+
class="max-h-96 overflow-scroll scrollbar-hidden text-sm prose dark:prose-invert max-w-full"
381+
>
382+
<Markdown
383+
content={isTruncated ? rawContent.slice(0, CONTENT_PREVIEW_LIMIT) : rawContent}
384+
id="file-preview"
385+
/>
378386
</div>
379387
{#if isTruncated}
380388
<button
381389
class="mt-1 text-xs text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition"
382-
on:click={() => { expandedContent = true; }}
390+
on:click={() => {
391+
expandedContent = true;
392+
}}
383393
>
384-
{$i18n.t('Show all ({{COUNT}} characters)', { COUNT: rawContent.length.toLocaleString() })}
394+
{$i18n.t('Show all ({{COUNT}} characters)', {
395+
COUNT: rawContent.length.toLocaleString()
396+
})}
385397
</button>
386398
{/if}
387399
{:else}
@@ -391,17 +403,29 @@
391403
{/if}
392404
{:else if item?.content}
393405
{@const rawContent = (item?.content ?? '').trim() || 'No content'}
394-
{@const isTruncated = ($settings?.renderMarkdownInPreviews ?? true) && rawContent.length > CONTENT_PREVIEW_LIMIT && !expandedContent}
406+
{@const isTruncated =
407+
($settings?.renderMarkdownInPreviews ?? true) &&
408+
rawContent.length > CONTENT_PREVIEW_LIMIT &&
409+
!expandedContent}
395410
{#if $settings?.renderMarkdownInPreviews ?? true}
396-
<div class="max-h-96 overflow-scroll scrollbar-hidden text-sm prose dark:prose-invert max-w-full">
397-
<Markdown content={isTruncated ? rawContent.slice(0, CONTENT_PREVIEW_LIMIT) : rawContent} id="file-preview-content" />
411+
<div
412+
class="max-h-96 overflow-scroll scrollbar-hidden text-sm prose dark:prose-invert max-w-full"
413+
>
414+
<Markdown
415+
content={isTruncated ? rawContent.slice(0, CONTENT_PREVIEW_LIMIT) : rawContent}
416+
id="file-preview-content"
417+
/>
398418
</div>
399419
{#if isTruncated}
400420
<button
401421
class="mt-1 text-xs text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition"
402-
on:click={() => { expandedContent = true; }}
422+
on:click={() => {
423+
expandedContent = true;
424+
}}
403425
>
404-
{$i18n.t('Show all ({{COUNT}} characters)', { COUNT: rawContent.length.toLocaleString() })}
426+
{$i18n.t('Show all ({{COUNT}} characters)', {
427+
COUNT: rawContent.length.toLocaleString()
428+
})}
405429
</button>
406430
{/if}
407431
{:else}

src/lib/i18n/locales/ar-BH/translation.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@
14791479
"Remove image": "",
14801480
"Remove Model": "حذف الموديل",
14811481
"Rename": "إعادة تسمية",
1482+
"Render Markdown in Previews": "",
14821483
"Reorder Models": "",
14831484
"Reply": "",
14841485
"Reply in Thread": "",
@@ -1643,6 +1644,7 @@
16431644
"Show": "عرض",
16441645
"Show \"What's New\" modal on login": "",
16451646
"Show Admin Details in Account Pending Overlay": "",
1647+
"Show all ({{COUNT}} characters)": "",
16461648
"Show Files": "",
16471649
"Show Formatting Toolbar": "",
16481650
"Show image preview": "",

src/lib/i18n/locales/ar/translation.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@
14791479
"Remove image": "",
14801480
"Remove Model": "حذف الموديل",
14811481
"Rename": "إعادة تسمية",
1482+
"Render Markdown in Previews": "",
14821483
"Reorder Models": "إعادة ترتيب النماذج",
14831484
"Reply": "",
14841485
"Reply in Thread": "الرد داخل سلسلة الرسائل",
@@ -1643,6 +1644,7 @@
16431644
"Show": "عرض",
16441645
"Show \"What's New\" modal on login": "عرض نافذة \"ما الجديد\" عند تسجيل الدخول",
16451646
"Show Admin Details in Account Pending Overlay": "عرض تفاصيل المشرف في نافذة \"الحساب قيد الانتظار\"",
1647+
"Show all ({{COUNT}} characters)": "",
16461648
"Show Files": "",
16471649
"Show Formatting Toolbar": "",
16481650
"Show image preview": "",

src/lib/i18n/locales/bg-BG/translation.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@
14791479
"Remove image": "",
14801480
"Remove Model": "Изтриване на модела",
14811481
"Rename": "Преименуване",
1482+
"Render Markdown in Previews": "",
14821483
"Reorder Models": "Преорганизиране на моделите",
14831484
"Reply": "",
14841485
"Reply in Thread": "Отговори в тред",
@@ -1639,6 +1640,7 @@
16391640
"Show": "Покажи",
16401641
"Show \"What's New\" modal on login": "Покажи модалния прозорец \"Какво е ново\" при вписване",
16411642
"Show Admin Details in Account Pending Overlay": "Покажи детайлите на администратора в наслагването на изчакващ акаунт",
1643+
"Show all ({{COUNT}} characters)": "",
16421644
"Show Files": "",
16431645
"Show Formatting Toolbar": "",
16441646
"Show image preview": "",

src/lib/i18n/locales/bn-BD/translation.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@
14791479
"Remove image": "",
14801480
"Remove Model": "মডেল রিমুভ করুন",
14811481
"Rename": "রেনেম",
1482+
"Render Markdown in Previews": "",
14821483
"Reorder Models": "",
14831484
"Reply": "",
14841485
"Reply in Thread": "",
@@ -1639,6 +1640,7 @@
16391640
"Show": "দেখান",
16401641
"Show \"What's New\" modal on login": "",
16411642
"Show Admin Details in Account Pending Overlay": "",
1643+
"Show all ({{COUNT}} characters)": "",
16421644
"Show Files": "",
16431645
"Show Formatting Toolbar": "",
16441646
"Show image preview": "",

src/lib/i18n/locales/bo-TB/translation.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@
14791479
"Remove image": "",
14801480
"Remove Model": "དཔེ་དབྱིབས་འདོར་བ།",
14811481
"Rename": "མིང་བསྐྱར་འདོགས།",
1482+
"Render Markdown in Previews": "",
14821483
"Reorder Models": "དཔེ་དབྱིབས་བསྐྱར་སྒྲིག",
14831484
"Reply": "",
14841485
"Reply in Thread": "བརྗོད་གཞིའི་ནང་ལན་འདེབས།",
@@ -1638,6 +1639,7 @@
16381639
"Show": "སྟོན་པ།",
16391640
"Show \"What's New\" modal on login": "ནང་འཛུལ་སྐབས་ \"གསར་པ་ཅི་ཡོད\" modal སྟོན་པ།",
16401641
"Show Admin Details in Account Pending Overlay": "རྩིས་ཁྲ་སྒུག་བཞིན་པའི་གཏོགས་ངོས་སུ་དོ་དམ་པའི་ཞིབ་ཕྲ་སྟོན་པ།",
1642+
"Show all ({{COUNT}} characters)": "",
16411643
"Show Files": "",
16421644
"Show Formatting Toolbar": "",
16431645
"Show image preview": "",

src/lib/i18n/locales/bs-BA/translation.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@
14791479
"Remove image": "",
14801480
"Remove Model": "Ukloni model",
14811481
"Rename": "Preimenuj",
1482+
"Render Markdown in Previews": "",
14821483
"Reorder Models": "",
14831484
"Reply": "",
14841485
"Reply in Thread": "",
@@ -1640,6 +1641,7 @@
16401641
"Show": "Pokaži",
16411642
"Show \"What's New\" modal on login": "",
16421643
"Show Admin Details in Account Pending Overlay": "",
1644+
"Show all ({{COUNT}} characters)": "",
16431645
"Show Files": "",
16441646
"Show Formatting Toolbar": "",
16451647
"Show image preview": "",

src/lib/i18n/locales/ca-ES/translation.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@
14791479
"Remove image": "Eliminar imatge",
14801480
"Remove Model": "Eliminar el model",
14811481
"Rename": "Canviar el nom",
1482+
"Render Markdown in Previews": "",
14821483
"Reorder Models": "Reordenar els models",
14831484
"Reply": "Respondre",
14841485
"Reply in Thread": "Respondre al fil",
@@ -1640,6 +1641,7 @@
16401641
"Show": "Mostrar",
16411642
"Show \"What's New\" modal on login": "Veure 'Què hi ha de nou' a l'entrada",
16421643
"Show Admin Details in Account Pending Overlay": "Mostrar els detalls de l'administrador a la superposició del compte pendent",
1644+
"Show all ({{COUNT}} characters)": "",
16431645
"Show Files": "Mostra els arxius",
16441646
"Show Formatting Toolbar": "Mostrar la barra de format",
16451647
"Show image preview": "Mostrar la previsualització de la imatge",

src/lib/i18n/locales/ceb-PH/translation.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@
14791479
"Remove image": "",
14801480
"Remove Model": "",
14811481
"Rename": "",
1482+
"Render Markdown in Previews": "",
14821483
"Reorder Models": "",
14831484
"Reply": "",
14841485
"Reply in Thread": "",
@@ -1639,6 +1640,7 @@
16391640
"Show": "Pagpakita",
16401641
"Show \"What's New\" modal on login": "",
16411642
"Show Admin Details in Account Pending Overlay": "",
1643+
"Show all ({{COUNT}} characters)": "",
16421644
"Show Files": "",
16431645
"Show Formatting Toolbar": "",
16441646
"Show image preview": "",

0 commit comments

Comments
 (0)