修复了SVG实时绘制问题:
使用更精确的正则表达式检测SVG代码块开始 正确处理Markdown格式的SVG代码块(svg或<svg) 实时更新SVG显示区域,自动补全结束标签确保正确显示 添加了完整的Markdown支持: 集成了marked.js库用于解析Markdown内容 配置了支持GitHub风格的Markdown选项 在所有消息渲染函数中添加了Markdown解析逻辑 添加了专门的Markdown样式: 为标题、段落、列表、代码块、引用等添加了样式 确保Markdown内容在对话气泡中正确显示 保持了原有的设计风格和颜色方案 优化了流式输出体验: SVG绘制过程中显示加载动画和"正在绘制..."提示 绘制完成后自动切换为可点击的占位符 支持SVG前后的Markdown文本内容正确渲染
This commit is contained in:
105
css/style.css
105
css/style.css
@@ -39,6 +39,111 @@ body {
|
||||
box-shadow: 2px 2px 0 rgba(16, 185, 129, 0.3);
|
||||
}
|
||||
|
||||
/* Markdown样式 */
|
||||
.chat-bubble-ai h1 {
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
margin: 0.5em 0;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.chat-bubble-ai h2 {
|
||||
font-size: 1.3em;
|
||||
font-weight: bold;
|
||||
margin: 0.5em 0;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.chat-bubble-ai h3 {
|
||||
font-size: 1.1em;
|
||||
font-weight: bold;
|
||||
margin: 0.5em 0;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.chat-bubble-ai p {
|
||||
margin: 0.5em 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.chat-bubble-ai ul, .chat-bubble-ai ol {
|
||||
margin: 0.5em 0;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
|
||||
.chat-bubble-ai li {
|
||||
margin: 0.25em 0;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.chat-bubble-ai code {
|
||||
background: #f3f4f6;
|
||||
padding: 0.2em 0.4em;
|
||||
border-radius: 3px;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 0.9em;
|
||||
color: #e11d48;
|
||||
}
|
||||
|
||||
.chat-bubble-ai pre {
|
||||
background: #f9fafb;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 4px;
|
||||
padding: 0.75em;
|
||||
overflow-x: auto;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
.chat-bubble-ai pre code {
|
||||
background: none;
|
||||
padding: 0;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.chat-bubble-ai blockquote {
|
||||
border-left: 4px solid #d1d5db;
|
||||
padding-left: 1em;
|
||||
margin: 0.5em 0;
|
||||
color: #6b7280;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.chat-bubble-ai strong {
|
||||
font-weight: bold;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.chat-bubble-ai em {
|
||||
font-style: italic;
|
||||
color: #4b5563;
|
||||
}
|
||||
|
||||
.chat-bubble-ai a {
|
||||
color: #3b82f6;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.chat-bubble-ai a:hover {
|
||||
color: #1d4ed8;
|
||||
}
|
||||
|
||||
.chat-bubble-ai table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
.chat-bubble-ai th, .chat-bubble-ai td {
|
||||
border: 1px solid #e5e7eb;
|
||||
padding: 0.5em;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.chat-bubble-ai th {
|
||||
background: #f9fafb;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* SVG占位符样式 - 块级换行 + 新配色 */
|
||||
.svg-placeholder-block {
|
||||
display: block;
|
||||
|
||||
Reference in New Issue
Block a user