mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-23 23:29:31 +01:00
refac
This commit is contained in:
@@ -3,6 +3,33 @@
|
||||
export let selectedModelId = '';
|
||||
|
||||
import { marked } from 'marked';
|
||||
// Configure marked with extensions
|
||||
marked.use({
|
||||
breaks: true,
|
||||
gfm: true,
|
||||
renderer: {
|
||||
list(body, ordered, start) {
|
||||
const isTaskList = body.includes('data-checked=');
|
||||
|
||||
if (isTaskList) {
|
||||
return `<ul data-type="taskList">${body}</ul>`;
|
||||
}
|
||||
|
||||
const type = ordered ? 'ol' : 'ul';
|
||||
const startatt = ordered && start !== 1 ? ` start="${start}"` : '';
|
||||
return `<${type}${startatt}>${body}</${type}>`;
|
||||
},
|
||||
|
||||
listitem(text, task, checked) {
|
||||
if (task) {
|
||||
const checkedAttr = checked ? 'true' : 'false';
|
||||
return `<li data-type="taskItem" data-checked="${checkedAttr}">${text}</li>`;
|
||||
}
|
||||
return `<li>${text}</li>`;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
import { toast } from 'svelte-sonner';
|
||||
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
Reference in New Issue
Block a user