mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 05:24:02 +00:00
refac
This commit is contained in:
parent
35f64cc53f
commit
e06667ead8
@ -128,7 +128,6 @@
|
|||||||
: 30
|
: 30
|
||||||
: 0}
|
: 0}
|
||||||
onResize={(size) => {
|
onResize={(size) => {
|
||||||
console.log(size);
|
|
||||||
if (size === 0) {
|
if (size === 0) {
|
||||||
showControls.set(false);
|
showControls.set(false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
export let lang = '';
|
export let lang = '';
|
||||||
export let code = '';
|
export let code = '';
|
||||||
|
|
||||||
|
let _token = null;
|
||||||
|
|
||||||
let mermaidHtml = null;
|
let mermaidHtml = null;
|
||||||
|
|
||||||
let highlightedCode = null;
|
let highlightedCode = null;
|
||||||
@ -226,7 +228,7 @@ __builtins__.input = input`);
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$: if (token) {
|
const render = async () => {
|
||||||
if (lang === 'mermaid' && (token?.raw ?? '').slice(-4).includes('```')) {
|
if (lang === 'mermaid' && (token?.raw ?? '').slice(-4).includes('```')) {
|
||||||
(async () => {
|
(async () => {
|
||||||
await drawMermaidDiagram();
|
await drawMermaidDiagram();
|
||||||
@ -242,6 +244,17 @@ __builtins__.input = input`);
|
|||||||
// Set a new timeout to debounce the code highlighting
|
// Set a new timeout to debounce the code highlighting
|
||||||
debounceTimeout = setTimeout(highlightCode, 10);
|
debounceTimeout = setTimeout(highlightCode, 10);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$: if (token) {
|
||||||
|
if (JSON.stringify(token) !== JSON.stringify(_token)) {
|
||||||
|
console.log('hi');
|
||||||
|
_token = token;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$: if (_token) {
|
||||||
|
render();
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user