mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
Merge pull request #5632 from jannikstdl/dev
enh: open PDF citations on the associated page
This commit is contained in:
commit
deedfdceae
@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext, onMount, tick } from 'svelte';
|
import { getContext, onMount, tick } from 'svelte';
|
||||||
import Modal from '$lib/components/common/Modal.svelte';
|
import Modal from '$lib/components/common/Modal.svelte';
|
||||||
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
export let show = false;
|
export let show = false;
|
||||||
@ -55,19 +56,28 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if document.source?.name}
|
{#if document.source?.name}
|
||||||
<div class="text-sm dark:text-gray-400">
|
<Tooltip
|
||||||
<a
|
content={$i18n.t('Open file')}
|
||||||
href={document?.metadata?.file_id
|
placement="left"
|
||||||
? `/api/v1/files/${document?.metadata?.file_id}/content`
|
tippyOptions={{ duration: [500, 0], animation: 'perspective' }}
|
||||||
: document.source.name.includes('http')
|
>
|
||||||
? document.source.name
|
<div class="text-sm dark:text-gray-400">
|
||||||
: `#`}
|
<a
|
||||||
target="_blank"
|
class="hover:text-gray-500 hover:dark:text-gray-100 underline"
|
||||||
>
|
href={document?.metadata?.file_id
|
||||||
{document?.metadata?.name ?? document.source.name}
|
? `/api/v1/files/${document?.metadata?.file_id}/content${document?.metadata?.page !== undefined ? `#page=${document.metadata.page + 1}` : ''}`
|
||||||
</a>
|
: document.source.name.includes('http')
|
||||||
{document?.metadata?.page ? `(page ${document.metadata.page + 1})` : ''}
|
? document.source.name
|
||||||
</div>
|
: `#`}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
{document?.metadata?.name ?? document.source.name}
|
||||||
|
</a>
|
||||||
|
{document?.metadata?.page
|
||||||
|
? `(${$i18n.t('page')} ${document.metadata.page + 1})`
|
||||||
|
: ''}
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="text-sm dark:text-gray-400">
|
<div class="text-sm dark:text-gray-400">
|
||||||
{$i18n.t('No source available')}
|
{$i18n.t('No source available')}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
export let className = 'flex';
|
export let className = 'flex';
|
||||||
export let theme = '';
|
export let theme = '';
|
||||||
export let allowHTML = true;
|
export let allowHTML = true;
|
||||||
|
export let tippyOptions = {};
|
||||||
|
|
||||||
let tooltipElement;
|
let tooltipElement;
|
||||||
let tooltipInstance;
|
let tooltipInstance;
|
||||||
@ -28,7 +29,8 @@
|
|||||||
touch: touch,
|
touch: touch,
|
||||||
...(theme !== '' ? { theme } : { theme: 'dark' }),
|
...(theme !== '' ? { theme } : { theme: 'dark' }),
|
||||||
arrow: false,
|
arrow: false,
|
||||||
offset: [0, 4]
|
offset: [0, 4],
|
||||||
|
...tippyOptions
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (tooltipInstance && content === '') {
|
} else if (tooltipInstance && content === '') {
|
||||||
|
@ -754,5 +754,7 @@
|
|||||||
"Your account status is currently pending activation.": "Ihr Kontostatus ist derzeit ausstehend und wartet auf Aktivierung.",
|
"Your account status is currently pending activation.": "Ihr Kontostatus ist derzeit ausstehend und wartet auf Aktivierung.",
|
||||||
"Your entire contribution will go directly to the plugin developer; Open WebUI does not take any percentage. However, the chosen funding platform might have its own fees.": "",
|
"Your entire contribution will go directly to the plugin developer; Open WebUI does not take any percentage. However, the chosen funding platform might have its own fees.": "",
|
||||||
"Youtube": "YouTube",
|
"Youtube": "YouTube",
|
||||||
"Youtube Loader Settings": "YouTube-Ladeeinstellungen"
|
"Youtube Loader Settings": "YouTube-Ladeeinstellungen",
|
||||||
|
"page": "Seite",
|
||||||
|
"Open file": "Datei öffnen"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user