mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-18 07:15:20 +00:00
refac
This commit is contained in:
parent
10e39956ef
commit
d8ad384b06
1 changed files with 25 additions and 2 deletions
|
|
@ -3,8 +3,31 @@
|
||||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||||
|
|
||||||
export let token: Token;
|
export let token: Token;
|
||||||
|
|
||||||
|
let triggerChar = '';
|
||||||
|
let label = '';
|
||||||
|
|
||||||
|
let idType = '';
|
||||||
|
let id = '';
|
||||||
|
|
||||||
|
$: if (token) {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
const init = () => {
|
||||||
|
const _id = token?.id;
|
||||||
|
if (_id?.includes(':')) {
|
||||||
|
idType = _id.split(':')[0];
|
||||||
|
id = _id.split(':')[1];
|
||||||
|
} else {
|
||||||
|
id = _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
label = token?.label ?? id;
|
||||||
|
triggerChar = token?.triggerChar ?? '@';
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Tooltip as="span" className="mention" content={token.id} placement="top">
|
<Tooltip as="span" className="mention" content={id} placement="top">
|
||||||
{token?.triggerChar ?? '@'}{token?.label ?? token?.id}
|
{triggerChar}{label}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue