mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-04 23:18:44 +08:00
perf(agent): smooth SSE streaming updates
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import MarkdownIt from 'markdown-it'
|
||||
import mdLinkAttributes from 'markdown-it-link-attributes'
|
||||
|
||||
const agentMarkdown = new MarkdownIt({
|
||||
html: false,
|
||||
breaks: true,
|
||||
linkify: true,
|
||||
typographer: true,
|
||||
})
|
||||
|
||||
agentMarkdown.use(mdLinkAttributes, {
|
||||
attrs: {
|
||||
target: '_blank',
|
||||
rel: 'noopener noreferrer',
|
||||
},
|
||||
})
|
||||
|
||||
// Agent 内容来自模型和工具输出,禁用原始 HTML 后统一转换为可展示 Markdown。
|
||||
export function renderAgentMarkdown(content: string) {
|
||||
return content ? agentMarkdown.render(content) : ''
|
||||
}
|
||||
Reference in New Issue
Block a user