@huyooo/ai-chat-frontend-react 0.2.12 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +99 -84
  2. package/dist/KaTeX_AMS-Regular-CYEKBG2K.woff +0 -0
  3. package/dist/KaTeX_AMS-Regular-JKX5W2C4.ttf +0 -0
  4. package/dist/KaTeX_AMS-Regular-U6PRYMIZ.woff2 +0 -0
  5. package/dist/KaTeX_Caligraphic-Bold-5QL5CMTE.woff2 +0 -0
  6. package/dist/KaTeX_Caligraphic-Bold-WZ3QSGD3.woff +0 -0
  7. package/dist/KaTeX_Caligraphic-Bold-ZTS3R3HK.ttf +0 -0
  8. package/dist/KaTeX_Caligraphic-Regular-3LKEU76G.woff +0 -0
  9. package/dist/KaTeX_Caligraphic-Regular-A7XRTZ5Q.ttf +0 -0
  10. package/dist/KaTeX_Caligraphic-Regular-KX5MEWCF.woff2 +0 -0
  11. package/dist/KaTeX_Fraktur-Bold-2QVFK6NQ.woff2 +0 -0
  12. package/dist/KaTeX_Fraktur-Bold-T4SWXBMT.woff +0 -0
  13. package/dist/KaTeX_Fraktur-Bold-WGHVTYOR.ttf +0 -0
  14. package/dist/KaTeX_Fraktur-Regular-2PEIFJSJ.woff2 +0 -0
  15. package/dist/KaTeX_Fraktur-Regular-5U4OPH2X.ttf +0 -0
  16. package/dist/KaTeX_Fraktur-Regular-PQMHCIK6.woff +0 -0
  17. package/dist/KaTeX_Main-Bold-2GA4IZIN.woff +0 -0
  18. package/dist/KaTeX_Main-Bold-W5FBVCZM.ttf +0 -0
  19. package/dist/KaTeX_Main-Bold-YP5VVQRP.woff2 +0 -0
  20. package/dist/KaTeX_Main-BoldItalic-4P4C7HJH.woff +0 -0
  21. package/dist/KaTeX_Main-BoldItalic-N4V3DX7S.woff2 +0 -0
  22. package/dist/KaTeX_Main-BoldItalic-ODMLBJJQ.ttf +0 -0
  23. package/dist/KaTeX_Main-Italic-I43T2HSR.ttf +0 -0
  24. package/dist/KaTeX_Main-Italic-RELBIK7M.woff2 +0 -0
  25. package/dist/KaTeX_Main-Italic-SASNQFN2.woff +0 -0
  26. package/dist/KaTeX_Main-Regular-ARRPAO67.woff2 +0 -0
  27. package/dist/KaTeX_Main-Regular-P5I74A2A.woff +0 -0
  28. package/dist/KaTeX_Main-Regular-W74P5G27.ttf +0 -0
  29. package/dist/KaTeX_Math-BoldItalic-6EBV3DK5.woff +0 -0
  30. package/dist/KaTeX_Math-BoldItalic-K4WTGH3J.woff2 +0 -0
  31. package/dist/KaTeX_Math-BoldItalic-VB447A4D.ttf +0 -0
  32. package/dist/KaTeX_Math-Italic-6KGCHLFN.woff2 +0 -0
  33. package/dist/KaTeX_Math-Italic-KKK3USB2.woff +0 -0
  34. package/dist/KaTeX_Math-Italic-SON4MRCA.ttf +0 -0
  35. package/dist/KaTeX_SansSerif-Bold-RRNVJFFW.woff2 +0 -0
  36. package/dist/KaTeX_SansSerif-Bold-STQ6RXC7.ttf +0 -0
  37. package/dist/KaTeX_SansSerif-Bold-X5M5EMOD.woff +0 -0
  38. package/dist/KaTeX_SansSerif-Italic-HMPFTM52.woff2 +0 -0
  39. package/dist/KaTeX_SansSerif-Italic-PSN4QKYX.woff +0 -0
  40. package/dist/KaTeX_SansSerif-Italic-WTBAZBGY.ttf +0 -0
  41. package/dist/KaTeX_SansSerif-Regular-2TL3USAE.ttf +0 -0
  42. package/dist/KaTeX_SansSerif-Regular-OQCII6EP.woff +0 -0
  43. package/dist/KaTeX_SansSerif-Regular-XIQ62X4E.woff2 +0 -0
  44. package/dist/KaTeX_Script-Regular-72OLXYNA.ttf +0 -0
  45. package/dist/KaTeX_Script-Regular-A5IFOEBS.woff +0 -0
  46. package/dist/KaTeX_Script-Regular-APUWIHLP.woff2 +0 -0
  47. package/dist/KaTeX_Size1-Regular-4HRHTS65.woff +0 -0
  48. package/dist/KaTeX_Size1-Regular-5LRUTBFT.woff2 +0 -0
  49. package/dist/KaTeX_Size1-Regular-7K6AASVL.ttf +0 -0
  50. package/dist/KaTeX_Size2-Regular-222HN3GT.ttf +0 -0
  51. package/dist/KaTeX_Size2-Regular-K5ZHAIS6.woff +0 -0
  52. package/dist/KaTeX_Size2-Regular-LELKET5D.woff2 +0 -0
  53. package/dist/KaTeX_Size3-Regular-TLFPAHDE.woff +0 -0
  54. package/dist/KaTeX_Size3-Regular-UFCO6WCA.ttf +0 -0
  55. package/dist/KaTeX_Size3-Regular-WQRQ47UD.woff2 +0 -0
  56. package/dist/KaTeX_Size4-Regular-7PGNVPQK.ttf +0 -0
  57. package/dist/KaTeX_Size4-Regular-CDMV7U5C.woff2 +0 -0
  58. package/dist/KaTeX_Size4-Regular-PKMWZHNC.woff +0 -0
  59. package/dist/KaTeX_Typewriter-Regular-3F5K6SQ6.ttf +0 -0
  60. package/dist/KaTeX_Typewriter-Regular-MJMFSK64.woff +0 -0
  61. package/dist/KaTeX_Typewriter-Regular-VBYJ4NRC.woff2 +0 -0
  62. package/dist/index.css +2156 -603
  63. package/dist/index.css.map +1 -1
  64. package/dist/index.d.ts +126 -92
  65. package/dist/index.js +1605 -976
  66. package/dist/index.js.map +1 -1
  67. package/dist/style.css +130 -0
  68. package/package.json +3 -3
  69. package/src/components/ChatPanel.tsx +82 -19
  70. package/src/components/common/SettingsPanel.css +81 -0
  71. package/src/components/common/SettingsPanel.tsx +96 -1
  72. package/src/components/input/ChatInput.css +0 -1
  73. package/src/components/input/ChatInput.tsx +48 -26
  74. package/src/components/input/DropdownSelector.css +66 -0
  75. package/src/components/input/DropdownSelector.tsx +157 -19
  76. package/src/components/message/MessageBubble.css +5 -2
  77. package/src/components/message/MessageBubble.tsx +44 -35
  78. package/src/components/message/PartsRenderer.css +8 -0
  79. package/src/components/message/PartsRenderer.tsx +137 -83
  80. package/src/components/message/parts/CollapsibleCard.css +4 -2
  81. package/src/components/message/parts/CollapsibleCard.tsx +4 -1
  82. package/src/components/message/parts/ImagePart.css +0 -1
  83. package/src/components/message/parts/TextPart.css +574 -5
  84. package/src/components/message/parts/TextPart.tsx +201 -8
  85. package/src/components/message/parts/ToolCallPart.css +139 -115
  86. package/src/components/message/parts/ToolCallPart.tsx +138 -134
  87. package/src/components/message/parts/ToolResultPart.css +0 -1
  88. package/src/components/message/parts/index.ts +3 -1
  89. package/src/components/message/parts/visual-predicate.ts +43 -0
  90. package/src/components/message/parts/visual-render.ts +19 -0
  91. package/src/components/message/parts/visual.ts +12 -0
  92. package/src/context/RenderersContext.tsx +19 -25
  93. package/src/hooks/useChat.ts +567 -79
  94. package/src/hooks/useImageUpload.ts +104 -12
  95. package/src/hooks/useVoiceInput.ts +17 -0
  96. package/src/index.ts +19 -16
  97. package/src/styles.css +130 -0
  98. package/src/types/index.ts +52 -68
  99. package/src/components/message/ContentRenderer.tsx +0 -63
  100. package/src/components/message/ToolResultRenderer.tsx +0 -21
  101. package/src/components/message/blocks/CodeBlock.tsx +0 -60
  102. package/src/components/message/blocks/TextBlock.tsx +0 -15
  103. package/src/components/message/blocks/blocks.css +0 -141
  104. package/src/components/message/blocks/index.ts +0 -6
  105. package/src/components/message/parts/ToolResultPart.tsx +0 -96
  106. package/src/components/message/tool-results/DefaultToolResult.tsx +0 -26
  107. package/src/components/message/tool-results/SearchResults.tsx +0 -69
  108. package/src/components/message/tool-results/WeatherCard.tsx +0 -63
  109. package/src/components/message/tool-results/index.ts +0 -7
  110. package/src/components/message/tool-results/tool-results.css +0 -181
@@ -1,10 +1,579 @@
1
- /* 导入 Markdown 渲染样式 */
2
- @import '@huyooo/ai-chat-shared/styles';
1
+ /* ============================================
2
+ Vercel + GitHub 混合风格 Markdown 主题
3
+ ============================================ */
3
4
 
4
5
  .text-part {
6
+ max-width: 100%;
7
+ }
8
+
9
+ /* 文本块基础样式 */
10
+ .text-block {
5
11
  font-size: 14px;
6
- line-height: 1.7;
7
- color: var(--chat-text, #ccc);
12
+ line-height: 1.75;
13
+ color: var(--chat-text, #e5e7eb);
8
14
  word-break: break-word;
9
- overflow-wrap: break-word;
15
+ letter-spacing: 0.01em;
16
+ }
17
+
18
+ /* 段落 */
19
+ .text-block p {
20
+ margin: 0.75em 0;
21
+ }
22
+
23
+ .text-block p:first-child {
24
+ margin-top: 0;
25
+ }
26
+
27
+ .text-block p:last-child {
28
+ margin-bottom: 0;
29
+ }
30
+
31
+ /* 标题 - GitHub 风格层级 + Vercel 现代感 */
32
+ .text-block h1 {
33
+ font-size: 1.5em;
34
+ font-weight: 700;
35
+ margin: 1.5em 0 0.75em;
36
+ padding-bottom: 0.4em;
37
+ border-bottom: 1px solid var(--chat-border, rgba(255, 255, 255, 0.1));
38
+ color: var(--chat-text-strong, #fff);
39
+ letter-spacing: -0.02em;
40
+ }
41
+
42
+ .text-block h2 {
43
+ font-size: 1.3em;
44
+ font-weight: 600;
45
+ margin: 1.25em 0 0.6em;
46
+ padding-bottom: 0.3em;
47
+ border-bottom: 1px solid var(--chat-border, rgba(255, 255, 255, 0.08));
48
+ color: var(--chat-text-strong, #fff);
49
+ letter-spacing: -0.01em;
50
+ }
51
+
52
+ .text-block h3 {
53
+ font-size: 1.15em;
54
+ font-weight: 600;
55
+ margin: 1em 0 0.5em;
56
+ color: var(--chat-text-strong, #fff);
57
+ }
58
+
59
+ .text-block h4,
60
+ .text-block h5,
61
+ .text-block h6 {
62
+ font-size: 1em;
63
+ font-weight: 600;
64
+ margin: 0.8em 0 0.4em;
65
+ color: var(--chat-text, #e5e7eb);
66
+ }
67
+
68
+ .text-block h1:first-child,
69
+ .text-block h2:first-child,
70
+ .text-block h3:first-child {
71
+ margin-top: 0;
72
+ }
73
+
74
+ /* 列表 */
75
+ .text-block ul,
76
+ .text-block ol {
77
+ margin: 0.75em 0;
78
+ padding-left: 1.5em;
79
+ }
80
+
81
+ .text-block li {
82
+ margin: 0.4em 0;
83
+ line-height: 1.6;
84
+ }
85
+
86
+ .text-block li::marker {
87
+ color: var(--chat-text-muted, #9ca3af);
88
+ }
89
+
90
+ /* 嵌套列表 */
91
+ .text-block li ul,
92
+ .text-block li ol {
93
+ margin: 0.25em 0;
94
+ }
95
+
96
+ /* 任务列表 */
97
+ .text-block .markdown-task-item {
98
+ list-style: none;
99
+ margin-left: -1.5em;
100
+ padding-left: 0;
101
+ }
102
+
103
+ .text-block .markdown-task-checkbox {
104
+ display: inline-block;
105
+ width: 1.2em;
106
+ margin-right: 0.4em;
107
+ font-family: "Monaco", "Menlo", monospace;
108
+ font-size: 0.85em;
109
+ color: var(--chat-accent, #60a5fa);
110
+ }
111
+
112
+ /* 链接 - Vercel 风格下划线动画 */
113
+ .text-block a {
114
+ color: var(--chat-accent, #60a5fa);
115
+ text-decoration: none;
116
+ background-image: linear-gradient(var(--chat-accent, #60a5fa), var(--chat-accent, #60a5fa));
117
+ background-size: 0% 1px;
118
+ background-position: 0 100%;
119
+ background-repeat: no-repeat;
120
+ transition: background-size 0.25s ease-out;
121
+ }
122
+
123
+ .text-block a:hover {
124
+ background-size: 100% 1px;
125
+ }
126
+
127
+ /* 粗体和斜体 */
128
+ .text-block strong {
129
+ font-weight: 600;
130
+ color: var(--chat-text-strong, #fff);
131
+ }
132
+
133
+ .text-block em {
134
+ font-style: italic;
135
+ color: var(--chat-text, #e5e7eb);
136
+ }
137
+
138
+ /* 删除线 */
139
+ .text-block s,
140
+ .text-block del {
141
+ text-decoration: line-through;
142
+ color: var(--chat-text-muted, #9ca3af);
143
+ }
144
+
145
+ /* 行内代码 - 突出显示 */
146
+ .text-block code {
147
+ font-family: "JetBrains Mono", "Fira Code", "Monaco", "Menlo", "Consolas", monospace;
148
+ font-size: 0.875em;
149
+ background: var(--chat-inline-code-bg, rgba(110, 118, 129, 0.25));
150
+ padding: 0.2em 0.45em;
151
+ border-radius: 6px;
152
+ color: var(--chat-inline-code-text, #f472b6);
153
+ font-weight: 500;
154
+ }
155
+
156
+ /* 引用块 - VitePress 风格 */
157
+ .text-block blockquote {
158
+ margin: 1em 0;
159
+ padding: 0.75em 1em;
160
+ border-left: 4px solid var(--chat-accent, #60a5fa);
161
+ background: var(--chat-blockquote-bg, rgba(96, 165, 250, 0.08));
162
+ border-radius: 0 8px 8px 0;
163
+ color: var(--chat-text-muted, #d1d5db);
164
+ }
165
+
166
+ .text-block blockquote p {
167
+ margin: 0.25em 0;
168
+ }
169
+
170
+ .text-block blockquote p:first-child {
171
+ margin-top: 0;
172
+ }
173
+
174
+ .text-block blockquote p:last-child {
175
+ margin-bottom: 0;
176
+ }
177
+
178
+ /* 分隔线 - 渐变效果 */
179
+ .text-block hr {
180
+ border: none;
181
+ height: 1px;
182
+ margin: 1.5em 0;
183
+ background: linear-gradient(
184
+ 90deg,
185
+ transparent,
186
+ var(--chat-border, rgba(255, 255, 255, 0.15)) 20%,
187
+ var(--chat-border, rgba(255, 255, 255, 0.15)) 80%,
188
+ transparent
189
+ );
190
+ }
191
+
192
+ /* 表格 - GitHub 风格 + 现代感 */
193
+ .text-block .markdown-table-wrapper {
194
+ margin: 1em 0;
195
+ overflow-x: auto;
196
+ border-radius: 8px;
197
+ border: 1px solid var(--chat-border, rgba(255, 255, 255, 0.1));
198
+ scrollbar-gutter: stable;
199
+ }
200
+
201
+ .text-block .markdown-table {
202
+ min-width: 100%;
203
+ width: max-content;
204
+ border-collapse: collapse;
205
+ font-size: 0.9em;
206
+ }
207
+
208
+ .text-block .markdown-table th {
209
+ background: var(--chat-table-header-bg, rgba(255, 255, 255, 0.06));
210
+ font-weight: 600;
211
+ text-align: left;
212
+ padding: 0.75em 1em;
213
+ border-bottom: 1px solid var(--chat-border, rgba(255, 255, 255, 0.1));
214
+ color: var(--chat-text-strong, #fff);
215
+ }
216
+
217
+ .text-block .markdown-table td {
218
+ padding: 0.65em 1em;
219
+ border-bottom: 1px solid var(--chat-border, rgba(255, 255, 255, 0.06));
220
+ }
221
+
222
+ .text-block .markdown-table tr:last-child td {
223
+ border-bottom: none;
224
+ }
225
+
226
+ .text-block .markdown-table tbody tr:hover {
227
+ background: var(--chat-table-row-hover-bg, rgba(255, 255, 255, 0.05));
228
+ }
229
+
230
+ /* 图片 */
231
+ .text-block img {
232
+ max-width: 100%;
233
+ height: auto;
234
+ border-radius: 8px;
235
+ margin: 0.75em 0;
236
+ }
237
+
238
+ /* ============================================
239
+ 代码块样式 - 简洁边框风格
240
+ ============================================ */
241
+
242
+ .code-block-wrapper {
243
+ margin: 1em 0;
244
+ border-radius: 8px;
245
+ overflow: hidden;
246
+ border: 1px solid var(--chat-border, rgba(255, 255, 255, 0.15));
247
+ background: transparent;
248
+ }
249
+
250
+ .code-header {
251
+ display: flex;
252
+ justify-content: space-between;
253
+ align-items: center;
254
+ padding: 8px 14px;
255
+ border-bottom: 1px solid var(--chat-border, rgba(255, 255, 255, 0.08));
256
+ }
257
+
258
+ .code-language {
259
+ font-size: 12px;
260
+ font-weight: 500;
261
+ color: var(--chat-text-muted, #8b949e);
262
+ text-transform: lowercase;
263
+ letter-spacing: 0.03em;
264
+ }
265
+
266
+ /* 按钮组容器 */
267
+ .code-actions {
268
+ display: flex;
269
+ align-items: center;
270
+ gap: 4px;
271
+ }
272
+
273
+ /* 统一的操作按钮样式 */
274
+ .code-action-btn {
275
+ display: flex;
276
+ align-items: center;
277
+ gap: 5px;
278
+ padding: 4px 8px;
279
+ font-size: 12px;
280
+ font-weight: 500;
281
+ color: var(--chat-text-muted, #8b949e);
282
+ background: transparent;
283
+ border: 1px solid transparent;
284
+ border-radius: 5px;
285
+ cursor: pointer;
286
+ appearance: none;
287
+ -webkit-appearance: none;
288
+ line-height: 1;
289
+ transition: all 0.15s ease;
290
+ }
291
+
292
+ .code-action-btn:hover {
293
+ color: var(--chat-text, #e5e7eb);
294
+ background: var(--chat-hover-bg, rgba(255, 255, 255, 0.08));
295
+ border-color: var(--chat-border, rgba(255, 255, 255, 0.1));
296
+ }
297
+
298
+ .code-action-btn:active {
299
+ transform: scale(0.97);
300
+ }
301
+
302
+ .code-action-btn svg {
303
+ flex-shrink: 0;
304
+ width: 14px;
305
+ height: 14px;
306
+ }
307
+
308
+ .code-block {
309
+ margin: 0;
310
+ padding: 14px 18px;
311
+ overflow-x: auto;
312
+ font-family: "JetBrains Mono", "Fira Code", "Monaco", "Menlo", "Consolas", monospace;
313
+ font-size: 13px;
314
+ line-height: 1.6;
315
+ color: var(--chat-code-text, #e6edf3);
316
+ background: transparent;
317
+ border: none;
318
+ border-radius: 0;
319
+ -webkit-font-smoothing: antialiased;
320
+ }
321
+
322
+ .code-block code {
323
+ display: block;
324
+ white-space: pre;
325
+ tab-size: 2;
326
+ }
327
+
328
+ /* 代码块滚动条 */
329
+ .code-block::-webkit-scrollbar {
330
+ height: 6px;
331
+ }
332
+
333
+ .code-block::-webkit-scrollbar-track {
334
+ background: transparent;
335
+ }
336
+
337
+ .code-block::-webkit-scrollbar-thumb {
338
+ background: var(--chat-scrollbar, rgba(255, 255, 255, 0.2));
339
+ border-radius: 3px;
340
+ }
341
+
342
+ .code-block::-webkit-scrollbar-thumb:hover {
343
+ background: var(--chat-scrollbar-hover, rgba(255, 255, 255, 0.3));
344
+ }
345
+
346
+ /* ============================================
347
+ 代码高亮主题 - 跟随主题变化
348
+ 使用 CSS 变量,支持浅色/深色主题
349
+ ============================================ */
350
+
351
+ /* 关键字: if, const, function, return, import, export 等 */
352
+ .code-block .hljs-keyword,
353
+ .code-block .hljs-selector-tag {
354
+ color: var(--chat-hljs-keyword, #ff7b72);
355
+ }
356
+
357
+ /* 内置: console, document, window, Array, Object 等 */
358
+ .code-block .hljs-built_in {
359
+ color: var(--chat-hljs-built-in, #ffa657);
360
+ }
361
+
362
+ /* 类型: string, number, boolean, interface, type 等 */
363
+ .code-block .hljs-type,
364
+ .code-block .hljs-class {
365
+ color: var(--chat-hljs-type, #ffa657);
366
+ }
367
+
368
+ /* 函数名 */
369
+ .code-block .hljs-title,
370
+ .code-block .hljs-title.function_,
371
+ .code-block .hljs-function {
372
+ color: var(--chat-hljs-function, #d2a8ff);
373
+ }
374
+
375
+ /* 字符串 */
376
+ .code-block .hljs-string,
377
+ .code-block .hljs-template-variable {
378
+ color: var(--chat-hljs-string, #a5d6ff);
379
+ }
380
+
381
+ /* 数字 */
382
+ .code-block .hljs-number {
383
+ color: var(--chat-hljs-number, #79c0ff);
384
+ }
385
+
386
+ /* 布尔值、null、undefined */
387
+ .code-block .hljs-literal,
388
+ .code-block .hljs-null {
389
+ color: var(--chat-hljs-literal, #79c0ff);
390
+ }
391
+
392
+ /* 注释 */
393
+ .code-block .hljs-comment,
394
+ .code-block .hljs-quote {
395
+ color: var(--chat-hljs-comment, #8b949e);
396
+ font-style: italic;
397
+ }
398
+
399
+ /* 变量 */
400
+ .code-block .hljs-variable,
401
+ .code-block .hljs-template-tag {
402
+ color: var(--chat-hljs-variable, #ffa657);
403
+ }
404
+
405
+ /* 属性 */
406
+ .code-block .hljs-attr,
407
+ .code-block .hljs-attribute {
408
+ color: var(--chat-hljs-attr, #79c0ff);
409
+ }
410
+
411
+ /* 对象属性名 */
412
+ .code-block .hljs-property {
413
+ color: var(--chat-hljs-property, #7ee787);
414
+ }
415
+
416
+ /* 操作符 */
417
+ .code-block .hljs-operator {
418
+ color: var(--chat-hljs-operator, #ff7b72);
419
+ }
420
+
421
+ /* 标点符号 */
422
+ .code-block .hljs-punctuation {
423
+ color: var(--chat-hljs-punctuation, #e6edf3);
424
+ }
425
+
426
+ /* 参数 */
427
+ .code-block .hljs-params {
428
+ color: var(--chat-hljs-params, #e6edf3);
429
+ }
430
+
431
+ /* 正则表达式 */
432
+ .code-block .hljs-regexp {
433
+ color: var(--chat-hljs-regexp, #7ee787);
434
+ }
435
+
436
+ /* 选择器 (CSS) */
437
+ .code-block .hljs-selector-class,
438
+ .code-block .hljs-selector-id {
439
+ color: var(--chat-hljs-selector, #7ee787);
440
+ }
441
+
442
+ /* 标签 (HTML/XML) */
443
+ .code-block .hljs-tag {
444
+ color: var(--chat-hljs-tag, #7ee787);
445
+ }
446
+
447
+ .code-block .hljs-name {
448
+ color: var(--chat-hljs-name, #7ee787);
449
+ }
450
+
451
+ /* 删除 (diff) */
452
+ .code-block .hljs-deletion {
453
+ color: var(--chat-hljs-deletion, #ffa198);
454
+ background: var(--chat-hljs-deletion-bg, rgba(248, 81, 73, 0.15));
455
+ }
456
+
457
+ /* 添加 (diff) */
458
+ .code-block .hljs-addition {
459
+ color: var(--chat-hljs-addition, #7ee787);
460
+ background: var(--chat-hljs-addition-bg, rgba(46, 160, 67, 0.15));
461
+ }
462
+
463
+ /* meta 信息 */
464
+ .code-block .hljs-meta {
465
+ color: var(--chat-hljs-meta, #8b949e);
466
+ }
467
+
468
+ /* 链接 */
469
+ .code-block .hljs-link {
470
+ color: var(--chat-hljs-link, #a5d6ff);
471
+ text-decoration: underline;
472
+ }
473
+
474
+ /* 符号 */
475
+ .code-block .hljs-symbol {
476
+ color: var(--chat-hljs-symbol, #79c0ff);
477
+ }
478
+
479
+ /* 子字符串 (模板字符串中的 ${}) */
480
+ .code-block .hljs-subst {
481
+ color: var(--chat-hljs-subst, #e6edf3);
482
+ }
483
+
484
+ /* section (markdown 标题等) */
485
+ .code-block .hljs-section {
486
+ color: var(--chat-hljs-section, #79c0ff);
487
+ font-weight: bold;
488
+ }
489
+
490
+ /* bullet (markdown 列表) */
491
+ .code-block .hljs-bullet {
492
+ color: var(--chat-hljs-bullet, #ffa657);
493
+ }
494
+
495
+ /* emphasis */
496
+ .code-block .hljs-emphasis {
497
+ font-style: italic;
498
+ }
499
+
500
+ /* strong */
501
+ .code-block .hljs-strong {
502
+ font-weight: bold;
503
+ }
504
+
505
+ /* ============================================
506
+ LaTeX 数学公式样式
507
+ ============================================ */
508
+
509
+ /* 块级公式 */
510
+ .text-block .latex-block {
511
+ display: block;
512
+ margin: 1em 0;
513
+ padding: 0.75em 1em;
514
+ overflow-x: auto;
515
+ background: var(--chat-latex-bg, rgba(255, 255, 255, 0.02));
516
+ border-radius: 8px;
517
+ border: 1px solid var(--chat-border, rgba(255, 255, 255, 0.08));
518
+ }
519
+
520
+ .text-block .latex-block .katex-display {
521
+ margin: 0;
522
+ overflow-x: auto;
523
+ overflow-y: hidden;
524
+ text-align: left;
525
+ }
526
+
527
+ .text-block .latex-block .katex {
528
+ text-align: left;
529
+ }
530
+
531
+ /* 行内公式 */
532
+ .text-block .latex-inline {
533
+ display: inline;
534
+ padding: 0 0.15em;
535
+ }
536
+
537
+ /* 公式错误提示 */
538
+ .text-block .latex-error {
539
+ color: var(--chat-error, #ef4444);
540
+ background: rgba(239, 68, 68, 0.1);
541
+ padding: 0.2em 0.4em;
542
+ border-radius: 4px;
543
+ font-family: monospace;
544
+ font-size: 0.9em;
545
+ }
546
+
547
+ /* KaTeX 样式覆盖 - 适配暗色主题 */
548
+ .text-block .katex {
549
+ font-size: 1.1em;
550
+ color: var(--chat-text, #e5e7eb);
551
+ }
552
+
553
+ /* KaTeX 分数线颜色 */
554
+ .text-block .katex .frac-line {
555
+ background: var(--chat-text, #e5e7eb);
556
+ }
557
+
558
+ /* KaTeX 根号 */
559
+ .text-block .katex .sqrt > .sqrt-sign {
560
+ color: var(--chat-text, #e5e7eb);
561
+ }
562
+
563
+ /* 滚动条样式 */
564
+ .text-block .latex-block::-webkit-scrollbar {
565
+ height: 6px;
566
+ }
567
+
568
+ .text-block .latex-block::-webkit-scrollbar-track {
569
+ background: transparent;
570
+ }
571
+
572
+ .text-block .latex-block::-webkit-scrollbar-thumb {
573
+ background: var(--chat-scrollbar, rgba(255, 255, 255, 0.2));
574
+ border-radius: 3px;
575
+ }
576
+
577
+ .text-block .latex-block::-webkit-scrollbar-thumb:hover {
578
+ background: var(--chat-scrollbar-hover, rgba(255, 255, 255, 0.3));
10
579
  }