使用更精确的正则表达式检测SVG代码块开始 正确处理Markdown格式的SVG代码块(svg或<svg) 实时更新SVG显示区域,自动补全结束标签确保正确显示 添加了完整的Markdown支持: 集成了marked.js库用于解析Markdown内容 配置了支持GitHub风格的Markdown选项 在所有消息渲染函数中添加了Markdown解析逻辑 添加了专门的Markdown样式: 为标题、段落、列表、代码块、引用等添加了样式 确保Markdown内容在对话气泡中正确显示 保持了原有的设计风格和颜色方案 优化了流式输出体验: SVG绘制过程中显示加载动画和"正在绘制..."提示 绘制完成后自动切换为可点击的占位符 支持SVG前后的Markdown文本内容正确渲染
351 lines
6.8 KiB
CSS
351 lines
6.8 KiB
CSS
body {
|
|
font-family: 'Inter', sans-serif;
|
|
}
|
|
|
|
/* 狂野线条效果 */
|
|
.wild-border {
|
|
border: 3px solid;
|
|
box-shadow: 4px 4px 0px rgba(0,0,0,0.3);
|
|
}
|
|
|
|
/* 切换按钮激活状态 */
|
|
.mode-btn-active {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 0 rgba(0,0,0,0.3);
|
|
}
|
|
|
|
.mode-btn-inactive {
|
|
opacity: 0.6;
|
|
}
|
|
|
|
/* 对话气泡样式 */
|
|
.chat-bubble-user {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
padding: 10px 14px;
|
|
max-width: 80%;
|
|
border: 2px solid #000;
|
|
box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
|
|
}
|
|
|
|
.chat-bubble-ai {
|
|
background: #fff;
|
|
color: #1f2937;
|
|
padding: 10px 14px;
|
|
max-width: 85%;
|
|
max-height: 300px;
|
|
overflow-y: auto;
|
|
border: 2px solid #10b981;
|
|
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;
|
|
background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
|
|
color: white;
|
|
padding: 8px 14px;
|
|
margin: 8px 0;
|
|
border: 2px solid #000;
|
|
box-shadow: 3px 3px 0 rgba(0,0,0,0.25);
|
|
font-weight: bold;
|
|
font-size: 13px;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
text-align: center;
|
|
}
|
|
|
|
.svg-placeholder-block:hover {
|
|
transform: translateX(2px) translateY(-2px);
|
|
box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
|
|
background: linear-gradient(135deg, #fb923c 0%, #f87171 100%);
|
|
}
|
|
|
|
/* SVG绘制中状态占位符 */
|
|
.svg-drawing-placeholder {
|
|
display: block;
|
|
background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
|
|
color: white;
|
|
padding: 8px 14px;
|
|
margin: 8px 0;
|
|
border: 2px solid #000;
|
|
box-shadow: 3px 3px 0 rgba(0,0,0,0.25);
|
|
font-weight: bold;
|
|
font-size: 13px;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
text-align: center;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.svg-drawing-placeholder:hover {
|
|
transform: translateX(2px) translateY(-2px);
|
|
box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
|
|
background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
|
|
}
|
|
|
|
/* 绘制中动画效果 */
|
|
@keyframes drawing-pulse {
|
|
0% { opacity: 1; }
|
|
50% { opacity: 0.7; }
|
|
100% { opacity: 1; }
|
|
}
|
|
|
|
.svg-drawing-placeholder::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: -100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
|
|
animation: drawing-shine 2s infinite;
|
|
}
|
|
|
|
@keyframes drawing-shine {
|
|
0% { left: -100%; }
|
|
100% { left: 100%; }
|
|
}
|
|
|
|
.svg-drawing-text {
|
|
animation: drawing-pulse 1.5s infinite;
|
|
}
|
|
|
|
/* 气泡操作按钮 */
|
|
.bubble-action-btn {
|
|
opacity: 0;
|
|
transition: opacity 0.2s;
|
|
}
|
|
|
|
.chat-bubble-ai:hover .bubble-action-btn {
|
|
opacity: 1;
|
|
}
|
|
|
|
/* 小手摇摆动画 */
|
|
@keyframes wave {
|
|
0%, 100% {transform: translateX(0px) rotate(90deg);}
|
|
10%, 30%, 50%, 70%, 90% {transform: translateX(-1px) rotate(90deg);}
|
|
20%, 40%, 60%, 80% {transform: translateX(1px) rotate(90deg);}
|
|
}
|
|
|
|
.wave-hand {
|
|
animation: wave 3s ease-in-out infinite;
|
|
display: inline-block;
|
|
transform: rotate(90deg);
|
|
}
|
|
|
|
/* 模态窗样式 */
|
|
.modal-overlay {
|
|
display: none;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background: rgba(0, 0, 0, 0.7);
|
|
z-index: 1000;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.modal-overlay.active {
|
|
display: flex;
|
|
}
|
|
|
|
.modal-content {
|
|
background: white;
|
|
border: 4px solid #000;
|
|
box-shadow: 8px 8px 0 rgba(0,0,0,0.4);
|
|
max-width: 500px;
|
|
width: 90%;
|
|
max-height: 90vh;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
/* 表单输入框样式 */
|
|
.config-input {
|
|
width: 100%;
|
|
padding: 10px;
|
|
border: 2px solid #000;
|
|
font-size: 14px;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.config-input:focus {
|
|
outline: none;
|
|
border-color: #667eea;
|
|
box-shadow: 3px 3px 0 rgba(102, 126, 234, 0.3);
|
|
}
|
|
|
|
/* 齿轮旋转动画 */
|
|
@keyframes rotate {
|
|
from { transform: rotate(0deg); }
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
.settings-btn:hover iconify-icon {
|
|
animation: rotate 1s linear infinite;
|
|
}
|
|
|
|
/* 自适应高度输入框 */
|
|
.auto-resize-input {
|
|
min-height: 40px;
|
|
max-height: 120px; /* 5行左右的高度 */
|
|
resize: none;
|
|
overflow-y: auto;
|
|
line-height: 1.5;
|
|
padding: 8px 12px;
|
|
}
|
|
|
|
/* 清空按钮样式 */
|
|
.clear-btn {
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.clear-btn:hover {
|
|
transform: scale(1.05);
|
|
}
|
|
|
|
.clear-btn:active {
|
|
transform: scale(0.95);
|
|
}
|
|
|
|
/* 流式输出动画 */
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; transform: translateY(10px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
|
|
.streaming-text {
|
|
animation: fadeIn 0.3s ease-in-out;
|
|
}
|
|
|
|
/* 打字机效果光标 */
|
|
@keyframes blink {
|
|
0%, 50% { opacity: 1; }
|
|
51%, 100% { opacity: 0; }
|
|
}
|
|
|
|
.typing-cursor::after {
|
|
content: '|';
|
|
animation: blink 1s infinite;
|
|
color: #667eea;
|
|
font-weight: bold;
|
|
}
|
|
|
|
/* 清空历史按钮摇动动画 */
|
|
@keyframes shake {
|
|
0%, 100% { transform: translateX(0); }
|
|
10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
|
|
20%, 40%, 60%, 80% { transform: translateX(2px); }
|
|
}
|
|
|
|
.clear-history-btn:hover iconify-icon {
|
|
animation: shake 0.5s ease-in-out;
|
|
} |