Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
fix: marked usage errors
Manx985c0b265ea710
diff --git a/frontend/src/components/document-preview.vue b/frontend/src/components/document-preview.vueindex a9bd5dda7..b06a8a8ae 100644--- a/frontend/src/components/document-preview.vue+++ b/frontend/src/components/document-preview.vue@@ -197,7 +197,7 @@ async function renderMarkdown(blob: Blob) {gfm: true,});const renderer = new marked.Renderer();- renderer.code = function (text: string, lang?: string) {+ renderer.code = function ({text, lang}) {let highlighted = '';if (lang && hljs.getLanguage(lang)) {try { highlighted = hljs.highlight(text, { language: lang }).value; }diff --git a/frontend/src/utils/mermaidShared.ts b/frontend/src/utils/mermaidShared.tsindex 3b7b3d8b3..04efaf43f 100644--- a/frontend/src/utils/mermaidShared.ts+++ b/frontend/src/utils/mermaidShared.ts@@ -1,4 +1,5 @@import mermaid from 'mermaid';+import type {Tokens} from 'marked';let mermaidInitialized = false;@@ -40,7 +41,7 @@ export const ensureMermaidInitialized = () => {export const createMermaidCodeRenderer = (idPrefix: string) => {let mermaidCount = 0;- return (text: string, lang?: string) => {+ return ({text, lang}: Tokens.Code) => {if (lang === 'mermaid') {const id = `${idPrefix}-${++mermaidCount}`;return `<div class="mermaid" id="${id}">${text}</div>`;diff --git a/frontend/src/views/chat/components/AgentStreamDisplay.vue b/frontend/src/views/chat/components/AgentStreamDisplay.vueindex caaa9e4be..106fc0338 100644--- a/frontend/src/views/chat/components/AgentStreamDisplay.vue+++ b/frontend/src/views/chat/components/AgentStreamDisplay.vue@@ -587,10 +587,7 @@ const props = defineProps<{}>();// Configure marked for security-marked.use({- mangle: false,- headerIds: false-});+marked.use({});// Event streamconst eventStream = computed(() => props.session?.agentEventStream || []);diff --git a/frontend/src/views/chat/components/botmsg.vue b/frontend/src/views/chat/components/botmsg.vueindex cffaabb76..8f01f5d05 100644--- a/frontend/src/views/chat/components/botmsg.vue+++ b/frontend/src/views/chat/components/botmsg.vue@@ -85,8 +85,6 @@ import {} from '@/utils/mermaidShared';marked.use({- mangle: false,- headerIds: false,breaks: true, // 全局启用单个换行支持});@@ -136,7 +134,7 @@ const closePreImg = () => {// 创建自定义渲染器实例const customRenderer = new marked.Renderer();// 覆盖图片渲染方法-customRenderer.image = function(href, title, text) {+customRenderer.image = function({href, title, text}){if (!isValidImageURL(href)) {return `<p>${t('error.invalidImageLink')}</p>`;}