返回 AiToEarn
ChatMessage.module.scss
根目录 / project / aitoearn-web / src / components / Chat / ChatMessage / ChatMessage.module.scss
1 /**
2 * ChatMessage 样式
3 * 包含 Markdown 内容渲染和多步骤工作流展示样式
4 */
5
6 // 消息步骤容器
7 .messageStep {
8 animation: fadeIn 0.2s ease-out;
9 }
10
11 @keyframes fadeIn {
12 from {
13 opacity: 0;
14 transform: translateY(4px);
15 }
16 to {
17 opacity: 1;
18 transform: translateY(0);
19 }
20 }
21
22 // 工作流区域样式
23 .workflowSection {
24 animation: slideIn 0.15s ease-out;
25
26 button {
27 transition:
28 transform 0.15s ease,
29 background-color 0.15s ease,
30 box-shadow 0.15s ease;
31
32 &:active {
33 transform: scale(0.98);
34 }
35 }
36 }
37
38 // 工作流详情列表 - 高度限制和滚动条
39 .workflowDetailList {
40 max-height: 200px;
41 scrollbar-width: thin;
42 scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
43
44 &::-webkit-scrollbar {
45 width: 4px;
46 }
47
48 &::-webkit-scrollbar-track {
49 background: transparent;
50 border-radius: 2px;
51 }
52
53 &::-webkit-scrollbar-thumb {
54 background: rgba(139, 92, 246, 0.3);
55 border-radius: 2px;
56
57 &:hover {
58 background: rgba(139, 92, 246, 0.5);
59 }
60 }
61 }
62
63 @keyframes slideIn {
64 from {
65 opacity: 0;
66 transform: translateY(-4px);
67 }
68 to {
69 opacity: 1;
70 transform: translateY(0);
71 }
72 }
73
74 .markdownContent {
75 /* 允许内部长单词/URL在必要时换行,避免溢出父容器 */
76 overflow-wrap: anywhere;
77 word-wrap: break-word;
78 word-break: break-word;
79 -webkit-hyphens: auto;
80 -ms-hyphens: auto;
81 hyphens: auto;
82
83 // 段落
84 :global(p) {
85 margin: 0 0 12px 0;
86 line-height: 1.7;
87 font-size: 14px;
88 }
89
90 :global(p:first-child) {
91 margin-top: 0;
92 }
93
94 :global(p:last-child) {
95 margin-bottom: 0;
96 }
97
98 // 标题
99 :global(h1),
100 :global(h2),
101 :global(h3),
102 :global(h4),
103 :global(h5),
104 :global(h6) {
105 margin: 16px 0 8px 0;
106 font-weight: 600;
107 line-height: 1.4;
108 color: #1a1a1a;
109 }
110
111 :global(h1:first-child),
112 :global(h2:first-child),
113 :global(h3:first-child),
114 :global(h4:first-child),
115 :global(h5:first-child),
116 :global(h6:first-child) {
117 margin-top: 0;
118 }
119
120 :global(h1) {
121 font-size: 1.5em;
122 }
123
124 :global(h2) {
125 font-size: 1.3em;
126 }
127
128 :global(h3) {
129 font-size: 1.15em;
130 }
131
132 :global(h4),
133 :global(h5),
134 :global(h6) {
135 font-size: 1em;
136 }
137
138 // 列表
139 :global(ul),
140 :global(ol) {
141 margin: 0 0 12px 0;
142 padding-left: 20px;
143 }
144
145 :global(ul:last-child),
146 :global(ol:last-child) {
147 margin-bottom: 0;
148 }
149
150 :global(li) {
151 margin-bottom: 4px;
152 line-height: 1.7;
153 font-size: 14px;
154 }
155
156 :global(li:last-child) {
157 margin-bottom: 0;
158 }
159
160 :global(ul) {
161 list-style-type: disc;
162 }
163
164 :global(ul ul) {
165 list-style-type: circle;
166 margin-top: 4px;
167 margin-bottom: 0;
168 }
169
170 :global(ul ul ul) {
171 list-style-type: square;
172 }
173
174 :global(ol) {
175 list-style-type: decimal;
176 }
177
178 :global(ol ol) {
179 margin-top: 4px;
180 margin-bottom: 0;
181 }
182
183 // 代码块
184 :global(code) {
185 padding: 2px 6px;
186 background: rgba(139, 92, 246, 0.1);
187 border-radius: 4px;
188 font-family: 'Menlo', 'Monaco', 'Consolas', 'Courier New', monospace;
189 font-size: 13px;
190 color: #7c3aed;
191 }
192
193 :global(pre) {
194 margin: 12px 0;
195 padding: 12px 16px;
196 background: #1e1e1e;
197 border-radius: 8px;
198 overflow-x: auto;
199 }
200
201 :global(pre:last-child) {
202 margin-bottom: 0;
203 }
204
205 :global(pre code) {
206 padding: 0;
207 background: transparent;
208 color: #d4d4d4;
209 font-size: 13px;
210 line-height: 1.5;
211 }
212
213 // 引用
214 :global(blockquote) {
215 margin: 12px 0;
216 padding: 8px 16px;
217 border-left: 4px solid #a855f7;
218 background: rgba(168, 85, 247, 0.05);
219 border-radius: 0 8px 8px 0;
220 }
221
222 :global(blockquote:last-child) {
223 margin-bottom: 0;
224 }
225
226 :global(blockquote p) {
227 margin: 0;
228 color: #4b5563;
229 font-style: italic;
230 }
231
232 // 链接
233 :global(a) {
234 color: #7c3aed;
235 text-decoration: none;
236 font-weight: 500;
237 /* 支持长链接/无空格字符串换行,防止溢出气泡容器 */
238 overflow-wrap: anywhere;
239 word-wrap: break-word;
240 /* break-all 可在必要时强制断行(对英语长链接生效) */
241 word-break: break-all;
242 hyphens: auto;
243 }
244
245 :global(a:hover) {
246 text-decoration: underline;
247 color: #6d28d9;
248 }
249
250 // 粗体 & 斜体
251 :global(strong) {
252 font-weight: 600;
253 color: #1a1a1a;
254 }
255
256 :global(em) {
257 font-style: italic;
258 }
259
260 // 分割线
261 :global(hr) {
262 margin: 16px 0;
263 border: none;
264 border-top: 1px solid #e5e7eb;
265 }
266
267 // 表格
268 :global(table) {
269 width: 100%;
270 margin: 12px 0;
271 border-collapse: collapse;
272 font-size: 14px;
273 }
274
275 :global(table:last-child) {
276 margin-bottom: 0;
277 }
278
279 :global(th),
280 :global(td) {
281 padding: 8px 12px;
282 border: 1px solid #e5e7eb;
283 text-align: left;
284 }
285
286 :global(th) {
287 background: #f9fafb;
288 font-weight: 600;
289 color: #374151;
290 }
291
292 :global(tr:nth-child(even)) {
293 background: #fafafa;
294 }
295
296 // 图片
297 :global(img) {
298 max-width: 100%;
299 height: auto;
300 border-radius: 8px;
301 margin: 8px 0;
302 }
303
304 // 删除线
305 :global(del) {
306 text-decoration: line-through;
307 color: #9ca3af;
308 }
309 }
310
310 lines Plain Text