This commit is contained in:
2025-12-30 18:22:59 +08:00
parent 01e21b2398
commit a2e60bb944
5 changed files with 68 additions and 19 deletions

View File

@@ -585,6 +585,9 @@ function formatMessageTime(dateStr: string | undefined) {
function formatMarkdown(content: string) {
let html = content;
// 过滤掉思考标签和data:前缀
html = html.replace(/<\/?think>/gi, '');
html = html.replace(/^data:/gm, '');
html = html.replace(/```([\s\S]*?)```/g, '<pre><code>$1</code></pre>');
html = html.replace(/`([^`]+)`/g, '<code>$1</code>');
html = html.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');

View File

@@ -1114,6 +1114,10 @@ function formatMarkdown(content: string) {
// 简单的 Markdown 转换(可以使用 marked.js 等库进行更复杂的转换)
let html = content;
// 过滤掉思考标签和data:前缀
html = html.replace(/<\/?think>/gi, '');
html = html.replace(/^data:/gm, '');
// 代码块
html = html.replace(/```(\w+)?\n([\s\S]*?)```/g, '<pre><code>$2</code></pre>');