sg-paisou 0.0.0
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.
- package/.idea/GitCommitMessageStorage.xml +8 -0
- package/.idea/modules.xml +8 -0
- package/.idea/sg-paisou-web.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/.vscode/settings.json +2 -0
- package/README.md +2 -0
- package/auto-imports.d.ts +10 -0
- package/components.d.ts +18 -0
- package/index.html +21 -0
- package/package.json +39 -0
- package/public/mathjax/all-packages.js +34 -0
- package/public/mathjax/talEditorConfig.js +5 -0
- package/public/mathjax/tex-svg.js +3 -0
- package/src/App.vue +38 -0
- package/src/assets/images/Camera-icon.png +0 -0
- package/src/assets/images/anger.png +0 -0
- package/src/assets/images/answer-icon.png +0 -0
- package/src/assets/images/back.png +0 -0
- package/src/assets/images/bg-img.png +0 -0
- package/src/assets/images/collect.png +0 -0
- package/src/assets/images/collected.png +0 -0
- package/src/assets/images/empty-bookmark.png +0 -0
- package/src/assets/images/empty-history.png +0 -0
- package/src/assets/images/feedback-thinkie-img.png +0 -0
- package/src/assets/images/history.png +0 -0
- package/src/assets/images/image 5.png +0 -0
- package/src/assets/images/insolubility.png +0 -0
- package/src/assets/images/key-points.png +0 -0
- package/src/assets/images/photograph-icon.png +0 -0
- package/src/assets/images/praise-icon.png +0 -0
- package/src/assets/images/praiseing-icon.png +0 -0
- package/src/assets/images/question.png +0 -0
- package/src/assets/images/smiling.png +0 -0
- package/src/assets/images/solution-icon.png +0 -0
- package/src/assets/images/star-icon.png +0 -0
- package/src/assets/images/trample-icon.png +0 -0
- package/src/assets/images/trampleing-icon.png +0 -0
- package/src/assets/images/volume-icon.png +0 -0
- package/src/assets/images/volumeing-icon.png +0 -0
- package/src/components/AIChatSDK/AIChatComponent.vue +963 -0
- package/src/components/AIChatSDK/component/Dialogs.vue +340 -0
- package/src/components/AIChatSDK/component/SpecialQuestions.vue +208 -0
- package/src/components/AIChatSDK/index.ts +146 -0
- package/src/components/AIChatSDK/style.scss +432 -0
- package/src/components/AIChatSDK/types.ts +275 -0
- package/src/components/AIChatSDK/utils/imageUtils.ts +61 -0
- package/src/components/AIChatSDK/utils/latex.ts +34 -0
- package/src/components/AIChatSDK/utils/mergeConfig.ts +125 -0
- package/src/components/ImagePreview.vue +62 -0
- package/src/components/PageHeader/index.vue +121 -0
- package/src/config.ts +11 -0
- package/src/env.d.ts +11 -0
- package/src/main.ts +12 -0
- package/src/router.ts +20 -0
- package/src/style.css +33 -0
- package/src/type.ts +106 -0
- package/src/utils/TTS_README.md +232 -0
- package/src/utils/bridge.ts +42 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/listenOsEvent.ts +3 -0
- package/src/utils/messageToast.ts +43 -0
- package/src/utils/render.ts +81 -0
- package/src/utils/request.ts +87 -0
- package/src/utils/tts.ts +319 -0
- package/src/utils/typewriter.ts +61 -0
- package/src/utils/useSSE.ts +113 -0
- package/src/views/History/index.vue +419 -0
- package/src/views/QuestionChatPage/index.vue +480 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.app.json +24 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +22 -0
- package/vite.config.ts +41 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
.ai-chat-container {
|
|
2
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
3
|
+
|
|
4
|
+
.ai-avatar {
|
|
5
|
+
flex-shrink: 0;
|
|
6
|
+
|
|
7
|
+
img {
|
|
8
|
+
object-fit: cover;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ai-info {
|
|
13
|
+
flex: 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.chat-content {
|
|
17
|
+
background: white;
|
|
18
|
+
|
|
19
|
+
.chat-messages {
|
|
20
|
+
flex: 1;
|
|
21
|
+
overflow-y: auto;
|
|
22
|
+
padding: 20px;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
|
|
26
|
+
.message {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
width: 100%;
|
|
30
|
+
|
|
31
|
+
.message-wrapper {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: flex-start;
|
|
34
|
+
gap: 12px;
|
|
35
|
+
width: 80%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.user-message-wrapper {
|
|
39
|
+
align-self: flex-end;
|
|
40
|
+
margin-left: auto;
|
|
41
|
+
justify-content: flex-end;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.message-avatar {
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
|
|
47
|
+
img {
|
|
48
|
+
object-fit: cover;
|
|
49
|
+
display: block;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.message-content {
|
|
54
|
+
font-size: 16px;
|
|
55
|
+
line-height: 24px;
|
|
56
|
+
max-width: calc(100% - 60px);
|
|
57
|
+
|
|
58
|
+
/* 文字和呼吸灯的包裹容器 */
|
|
59
|
+
.message-text-wrapper {
|
|
60
|
+
display: inline;
|
|
61
|
+
|
|
62
|
+
/* 呼吸灯样式 - 紧跟在文字后面 */
|
|
63
|
+
.typing-indicator {
|
|
64
|
+
display: inline-block;
|
|
65
|
+
width: 8px;
|
|
66
|
+
height: 8px;
|
|
67
|
+
margin-left: 4px;
|
|
68
|
+
background-color: #FF9D00;
|
|
69
|
+
border-radius: 50%;
|
|
70
|
+
animation: breathing 1.5s ease-in-out infinite;
|
|
71
|
+
vertical-align: middle;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* 消息图片样式 */
|
|
76
|
+
.message-image {
|
|
77
|
+
margin-bottom: 8px;
|
|
78
|
+
border-radius: 12px;
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
max-width: 100%;
|
|
81
|
+
|
|
82
|
+
img {
|
|
83
|
+
width: 100%;
|
|
84
|
+
height: auto;
|
|
85
|
+
display: block;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* 消息按钮样式 */
|
|
90
|
+
.message-buttons {
|
|
91
|
+
display: flex;
|
|
92
|
+
gap: 20px;
|
|
93
|
+
margin-top: 16px;
|
|
94
|
+
justify-content: flex-end;
|
|
95
|
+
|
|
96
|
+
button {
|
|
97
|
+
padding: 8px 16px;
|
|
98
|
+
border: none;
|
|
99
|
+
border-radius: 70px;
|
|
100
|
+
font-weight: 500;
|
|
101
|
+
line-height: 24px;
|
|
102
|
+
font-size: 16px;
|
|
103
|
+
background: transparent;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.btn-primary {
|
|
107
|
+
background: linear-gradient(91.95deg, #FFCB00 0%, #FFAB03 100%);
|
|
108
|
+
color: #FFFFFF;
|
|
109
|
+
|
|
110
|
+
&:hover {
|
|
111
|
+
transform: translateY(-1px);
|
|
112
|
+
box-shadow: 0 4px 12px rgba(255, 171, 3, 0.3);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:active {
|
|
116
|
+
transform: translateY(0);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.btn-secondary {
|
|
121
|
+
color: #999999;
|
|
122
|
+
|
|
123
|
+
&:hover {
|
|
124
|
+
color: #666666;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* 只显示反馈按钮(追问后的回复) */
|
|
130
|
+
.feedback-actions-only {
|
|
131
|
+
display: flex;
|
|
132
|
+
gap: 20px;
|
|
133
|
+
margin-top: 16px;
|
|
134
|
+
|
|
135
|
+
img {
|
|
136
|
+
width: 20px;
|
|
137
|
+
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* 反馈按钮和 Continue 按钮容器 */
|
|
142
|
+
.feedback-and-continue {
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: space-between;
|
|
146
|
+
margin-top: 16px;
|
|
147
|
+
gap: 16px;
|
|
148
|
+
|
|
149
|
+
.feedback-actions {
|
|
150
|
+
display: flex;
|
|
151
|
+
gap: 16px;
|
|
152
|
+
|
|
153
|
+
img {
|
|
154
|
+
width: 20px;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.btn-continue {
|
|
159
|
+
padding: 8px 16px;
|
|
160
|
+
border: none;
|
|
161
|
+
border-radius: 70px;
|
|
162
|
+
font-weight: 500;
|
|
163
|
+
line-height: 24px;
|
|
164
|
+
font-size: 16px;
|
|
165
|
+
background: #FF9D001A;
|
|
166
|
+
color: #FF9D00;
|
|
167
|
+
white-space: nowrap;
|
|
168
|
+
letter-spacing: 1px;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* 呼吸灯动画 */
|
|
173
|
+
@keyframes breathing {
|
|
174
|
+
0%, 100% {
|
|
175
|
+
opacity: 1;
|
|
176
|
+
transform: scale(1);
|
|
177
|
+
}
|
|
178
|
+
50% {
|
|
179
|
+
opacity: 0.3;
|
|
180
|
+
transform: scale(0.8);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* 流式数据接收时的呼吸灯(更快的闪烁) */
|
|
185
|
+
@keyframes blinking {
|
|
186
|
+
0%, 100% {
|
|
187
|
+
opacity: 1;
|
|
188
|
+
}
|
|
189
|
+
50% {
|
|
190
|
+
opacity: 0.2;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* 讲题完成区域样式 */
|
|
196
|
+
.completion-section {
|
|
197
|
+
margin-top: 12px;
|
|
198
|
+
width: 100%;
|
|
199
|
+
|
|
200
|
+
.helpful-section {
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
justify-content: center;
|
|
204
|
+
gap: 12px;
|
|
205
|
+
padding-bottom: 12px;
|
|
206
|
+
|
|
207
|
+
.helpful-text {
|
|
208
|
+
color: #666666;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
img {
|
|
212
|
+
width: 24px;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.follow-up-questions {
|
|
217
|
+
display: flex;
|
|
218
|
+
flex-direction: column;
|
|
219
|
+
gap: 12px;
|
|
220
|
+
|
|
221
|
+
.follow-up-item {
|
|
222
|
+
width: max-content;
|
|
223
|
+
display: flex;
|
|
224
|
+
align-items: flex-start;
|
|
225
|
+
gap: 8px;
|
|
226
|
+
padding: 7px 12px;
|
|
227
|
+
background: #FFFFFF;
|
|
228
|
+
border-radius: 70px;
|
|
229
|
+
border: 1px solid #EEEEEE;
|
|
230
|
+
|
|
231
|
+
img {
|
|
232
|
+
width: 20px;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.question-text {
|
|
236
|
+
color: #222222;
|
|
237
|
+
line-height: 24px;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.btn-snap-another {
|
|
244
|
+
width: max-content;
|
|
245
|
+
margin-top: 12px;
|
|
246
|
+
padding: 8px 16px;
|
|
247
|
+
border: none;
|
|
248
|
+
border-radius: 70px;
|
|
249
|
+
font-weight: 500;
|
|
250
|
+
line-height: 24px;
|
|
251
|
+
font-size: 16px;
|
|
252
|
+
background: #FF9D001A;
|
|
253
|
+
color: #FF9D00;
|
|
254
|
+
display: flex;
|
|
255
|
+
align-items: center;
|
|
256
|
+
justify-content: center;
|
|
257
|
+
gap: 8px;
|
|
258
|
+
|
|
259
|
+
img {
|
|
260
|
+
width: 20px;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.message:last-child {
|
|
267
|
+
margin-bottom: 0 !important;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.feedback-buttons {
|
|
273
|
+
display: flex;
|
|
274
|
+
gap: 12px;
|
|
275
|
+
|
|
276
|
+
.feedback-btn {
|
|
277
|
+
padding: 6px 12px 6px 8px;
|
|
278
|
+
border: none;
|
|
279
|
+
background: #00000008;
|
|
280
|
+
border-radius: 38px;
|
|
281
|
+
font-size: 14px;
|
|
282
|
+
color: #222222;
|
|
283
|
+
display: flex;
|
|
284
|
+
align-items: center;
|
|
285
|
+
transition: all 0.2s;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.input-wrapper {
|
|
290
|
+
background: white;
|
|
291
|
+
|
|
292
|
+
.chat-input::placeholder {
|
|
293
|
+
color: #adb5bd;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.send-button.disabled {
|
|
297
|
+
opacity: 0.5;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.ai-message {
|
|
303
|
+
align-items: flex-start;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.user-message {
|
|
307
|
+
align-items: flex-end;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.options {
|
|
311
|
+
margin-top: 8px;
|
|
312
|
+
display: flex;
|
|
313
|
+
flex-wrap: wrap;
|
|
314
|
+
gap: 8px;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.options span {
|
|
318
|
+
padding: 4px 8px;
|
|
319
|
+
background: rgba(255, 255, 255, 0.2);
|
|
320
|
+
border-radius: 6px;
|
|
321
|
+
font-size: 12px;
|
|
322
|
+
display: flex;
|
|
323
|
+
align-items: center;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
/* LaTeX样式 */
|
|
329
|
+
:deep(.katex) {
|
|
330
|
+
font-size: 1em;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
:deep(.katex-display) {
|
|
334
|
+
margin: 0.5em 0;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.background-transparent {
|
|
338
|
+
background: transparent !important;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/* 禁用状态样式 */
|
|
342
|
+
.chat-input:disabled {
|
|
343
|
+
background-color: #F5F5F5;
|
|
344
|
+
cursor: not-allowed;
|
|
345
|
+
opacity: 0.6;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.feedback-buttons.disabled {
|
|
349
|
+
opacity: 0.5;
|
|
350
|
+
pointer-events: none;
|
|
351
|
+
|
|
352
|
+
button {
|
|
353
|
+
cursor: not-allowed;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/* 长按反馈弹窗遮罩 */
|
|
358
|
+
.feedback-overlay {
|
|
359
|
+
position: fixed;
|
|
360
|
+
top: 0;
|
|
361
|
+
left: 0;
|
|
362
|
+
right: 0;
|
|
363
|
+
bottom: 0;
|
|
364
|
+
background: transparent;
|
|
365
|
+
z-index: 999;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/* 长按反馈弹窗 */
|
|
369
|
+
.message-feedback-popup {
|
|
370
|
+
position: fixed;
|
|
371
|
+
z-index: 1000;
|
|
372
|
+
|
|
373
|
+
.popup-arrow {
|
|
374
|
+
position: absolute;
|
|
375
|
+
left: 50%;
|
|
376
|
+
transform: translateX(-50%);
|
|
377
|
+
width: 0;
|
|
378
|
+
height: 0;
|
|
379
|
+
border-left: 8px solid transparent;
|
|
380
|
+
border-right: 8px solid transparent;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.popup-buttons {
|
|
384
|
+
display: flex;
|
|
385
|
+
gap: 20px;
|
|
386
|
+
padding: 8px;
|
|
387
|
+
background: #FFFFFF;
|
|
388
|
+
border-radius: 12px;
|
|
389
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
|
|
390
|
+
padding: 12px;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/* 显示在下方时,三角在上方 */
|
|
394
|
+
&:not(.show-above) {
|
|
395
|
+
.popup-arrow {
|
|
396
|
+
top: 0;
|
|
397
|
+
border-bottom: 8px solid #FFFFFF;
|
|
398
|
+
filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.05));
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.popup-buttons {
|
|
402
|
+
margin-top: 8px;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/* 显示在上方时,三角在下方 */
|
|
407
|
+
&.show-above {
|
|
408
|
+
.popup-arrow {
|
|
409
|
+
bottom: 0;
|
|
410
|
+
border-top: 8px solid #FFFFFF;
|
|
411
|
+
filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.05));
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.popup-buttons {
|
|
415
|
+
margin-bottom: 8px;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.helpful-section img,
|
|
420
|
+
.feedback-actions img,
|
|
421
|
+
.feedback-actions-only img,
|
|
422
|
+
.popup-buttons img {
|
|
423
|
+
transition: transform 0.1s ease;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.helpful-section img:active,
|
|
427
|
+
.feedback-actions img:active,
|
|
428
|
+
.feedback-actions-only img:active,
|
|
429
|
+
.popup-buttons img:active {
|
|
430
|
+
transform: scale(1.2);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
// AI聊天SDK的类型定义
|
|
2
|
+
|
|
3
|
+
export interface IAvatarConfig {
|
|
4
|
+
src?: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
width?: string;
|
|
7
|
+
height?: string;
|
|
8
|
+
borderRadius?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface IAIInfoConfig {
|
|
12
|
+
name?: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
nameStyle?: Partial<CSSStyleDeclaration>;
|
|
15
|
+
titleStyle?: Partial<CSSStyleDeclaration>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface IMuteButtonConfig {
|
|
19
|
+
soundOnIcon?: string;
|
|
20
|
+
soundOffIcon?: string;
|
|
21
|
+
width?: string;
|
|
22
|
+
height?: string;
|
|
23
|
+
onClick?: (isSoundOn: boolean) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface IFeedbackButton {
|
|
27
|
+
id: string;
|
|
28
|
+
text: string;
|
|
29
|
+
icon?: string;
|
|
30
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
31
|
+
onClick?: (id: string) => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IFeedbackConfig {
|
|
35
|
+
buttons?: IFeedbackButton[];
|
|
36
|
+
containerStyle?: Partial<CSSStyleDeclaration>;
|
|
37
|
+
show?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface IMessage {
|
|
41
|
+
id: string;
|
|
42
|
+
type: 'ai' | 'user';
|
|
43
|
+
content: string;
|
|
44
|
+
timestamp?: number;
|
|
45
|
+
options?: string[];
|
|
46
|
+
imageUrl?: string; // 消息中的图片URL
|
|
47
|
+
showButtons?: boolean; // 是否显示操作按钮(Not my question / Start Explaining)
|
|
48
|
+
isTyping?: boolean; // 是否正在打字
|
|
49
|
+
isStreaming?: boolean; // 是否正在接收流式数据
|
|
50
|
+
isThinking?: boolean; // 是否正在思考(显示占位文本)
|
|
51
|
+
showFeedbackAndContinue?: boolean; // 是否显示反馈按钮和 Continue 按钮
|
|
52
|
+
showCompletionSection?: boolean; // 是否显示讲题完成区域(Was this helpful + 追问 + Snap another one)
|
|
53
|
+
followUpQuestions?: string[]; // 追问问题列表
|
|
54
|
+
showFeedbackOnly?: boolean; // 是否只显示反馈按钮(不显示Continue)
|
|
55
|
+
vote?: 'upvote' | 'downvote'; // 用户投票状态
|
|
56
|
+
isDownvote?: number; // 是否不喜欢
|
|
57
|
+
disableLongPress?: boolean; // 是否禁用长按弹框功能
|
|
58
|
+
isPlayingTTS?: boolean; // 是否正在播放TTS
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface IMessageStyle {
|
|
62
|
+
aiMessage?: {
|
|
63
|
+
background?: string;
|
|
64
|
+
color?: string;
|
|
65
|
+
borderRadius?: string;
|
|
66
|
+
padding?: string;
|
|
67
|
+
maxWidth?: string;
|
|
68
|
+
border?: string;
|
|
69
|
+
};
|
|
70
|
+
userMessage?: {
|
|
71
|
+
background?: string;
|
|
72
|
+
color?: string;
|
|
73
|
+
borderRadius?: string;
|
|
74
|
+
padding?: string;
|
|
75
|
+
maxWidth?: string;
|
|
76
|
+
};
|
|
77
|
+
messageGap?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface IInputConfig {
|
|
81
|
+
placeholder?: string;
|
|
82
|
+
sendIcon?: string;
|
|
83
|
+
sendIconWidth?: string;
|
|
84
|
+
sendIconHeight?: string;
|
|
85
|
+
borderRadius?: string;
|
|
86
|
+
padding?: string;
|
|
87
|
+
boxShadow?: string;
|
|
88
|
+
onSend?: (message: string) => void;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface IStyleConfig {
|
|
92
|
+
container?: Partial<CSSStyleDeclaration>;
|
|
93
|
+
header?: Partial<CSSStyleDeclaration>;
|
|
94
|
+
chatContent?: Partial<CSSStyleDeclaration>;
|
|
95
|
+
inputContainer?: Partial<CSSStyleDeclaration>;
|
|
96
|
+
messages?: IMessageStyle;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface IAIChatConfig {
|
|
100
|
+
// AI头像配置
|
|
101
|
+
avatar?: IAvatarConfig;
|
|
102
|
+
|
|
103
|
+
// 用户头像配置
|
|
104
|
+
userAvatar?: IAvatarConfig;
|
|
105
|
+
|
|
106
|
+
// AI信息配置
|
|
107
|
+
aiInfo?: IAIInfoConfig;
|
|
108
|
+
|
|
109
|
+
// 静音按钮配置
|
|
110
|
+
muteButton?: IMuteButtonConfig;
|
|
111
|
+
|
|
112
|
+
// 反馈按钮配置
|
|
113
|
+
feedback?: IFeedbackConfig;
|
|
114
|
+
|
|
115
|
+
// 输入框配置
|
|
116
|
+
input?: IInputConfig;
|
|
117
|
+
|
|
118
|
+
// 样式配置
|
|
119
|
+
styles?: IStyleConfig;
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
// 是否显示LaTeX渲染
|
|
123
|
+
enableLatex?: boolean;
|
|
124
|
+
|
|
125
|
+
// 自定义CSS类名
|
|
126
|
+
customClasses?: {
|
|
127
|
+
container?: string;
|
|
128
|
+
header?: string;
|
|
129
|
+
chatContent?: string;
|
|
130
|
+
inputContainer?: string;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface IAIChatSDKProps {
|
|
135
|
+
config?: IAIChatConfig;
|
|
136
|
+
onMessageSend?: (message: string) => void;
|
|
137
|
+
onFeedback?: (feedbackId: string) => void;
|
|
138
|
+
onMuteToggle?: (isMuted: boolean) => void;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
import { IMAGE_ASSETS } from './utils/imageUtils'
|
|
142
|
+
|
|
143
|
+
// 默认配置
|
|
144
|
+
export const DEFAULT_CONFIG: Required<IAIChatConfig> = {
|
|
145
|
+
avatar: {
|
|
146
|
+
src: IMAGE_ASSETS.maskGroup,
|
|
147
|
+
alt: 'AI Avatar',
|
|
148
|
+
width: '40px',
|
|
149
|
+
height: '40px',
|
|
150
|
+
borderRadius: '50%'
|
|
151
|
+
},
|
|
152
|
+
userAvatar: {
|
|
153
|
+
src: IMAGE_ASSETS.userAvatar,
|
|
154
|
+
alt: 'User Avatar',
|
|
155
|
+
width: '40px',
|
|
156
|
+
height: '40px',
|
|
157
|
+
borderRadius: '50%'
|
|
158
|
+
},
|
|
159
|
+
aiInfo: {
|
|
160
|
+
name: 'Thinkie',
|
|
161
|
+
title: 'AI Tutor',
|
|
162
|
+
nameStyle: {
|
|
163
|
+
color: '#222222',
|
|
164
|
+
fontWeight: '600',
|
|
165
|
+
fontSize: '20px',
|
|
166
|
+
lineHeight: '150%',
|
|
167
|
+
margin: '0'
|
|
168
|
+
},
|
|
169
|
+
titleStyle: {
|
|
170
|
+
color: '#999999',
|
|
171
|
+
fontSize: '14px',
|
|
172
|
+
lineHeight: '150%',
|
|
173
|
+
textTransform: 'capitalize',
|
|
174
|
+
margin: '0'
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
muteButton: {
|
|
178
|
+
soundOnIcon: IMAGE_ASSETS.soundOn,
|
|
179
|
+
soundOffIcon: IMAGE_ASSETS.soundOff,
|
|
180
|
+
width: '32px',
|
|
181
|
+
height: '32px'
|
|
182
|
+
},
|
|
183
|
+
feedback: {
|
|
184
|
+
show: true,
|
|
185
|
+
buttons: [
|
|
186
|
+
{
|
|
187
|
+
id: 'happy',
|
|
188
|
+
text: 'I got it!',
|
|
189
|
+
icon: IMAGE_ASSETS.smile
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: 'confused',
|
|
193
|
+
text: "I Don't understand",
|
|
194
|
+
icon: IMAGE_ASSETS.confused
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: 'good',
|
|
198
|
+
text: 'Good! Thank you',
|
|
199
|
+
icon: IMAGE_ASSETS.lightbulb
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
containerStyle: {
|
|
203
|
+
padding: '0 0 12px 0',
|
|
204
|
+
display: 'flex',
|
|
205
|
+
gap: '12px'
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
input: {
|
|
209
|
+
placeholder: 'Start explaining, and feel free to ask Thinkie any questions',
|
|
210
|
+
sendIcon: IMAGE_ASSETS.voiceTube,
|
|
211
|
+
sendIconWidth: '32px',
|
|
212
|
+
sendIconHeight: '32px',
|
|
213
|
+
borderRadius: '40px',
|
|
214
|
+
padding: '13px 17px',
|
|
215
|
+
boxShadow: '0px 0px 12px 0px #0000001A'
|
|
216
|
+
},
|
|
217
|
+
styles: {
|
|
218
|
+
container: {
|
|
219
|
+
width: 'calc(100% - 424px)',
|
|
220
|
+
display: 'flex',
|
|
221
|
+
flexDirection: 'column',
|
|
222
|
+
flexShrink: '0',
|
|
223
|
+
background: 'rgba(255, 255, 255, 1)',
|
|
224
|
+
borderRadius: '20px'
|
|
225
|
+
},
|
|
226
|
+
header: {
|
|
227
|
+
display: 'flex',
|
|
228
|
+
alignItems: 'center',
|
|
229
|
+
gap: '12px',
|
|
230
|
+
padding: '12px 20px',
|
|
231
|
+
borderBottom: '1px solid #e9ecef',
|
|
232
|
+
flexShrink: '0',
|
|
233
|
+
position: 'sticky',
|
|
234
|
+
top: '0',
|
|
235
|
+
zIndex: '10'
|
|
236
|
+
},
|
|
237
|
+
chatContent: {
|
|
238
|
+
flex: '1',
|
|
239
|
+
display: 'flex',
|
|
240
|
+
flexDirection: 'column',
|
|
241
|
+
overflow: 'hidden'
|
|
242
|
+
},
|
|
243
|
+
inputContainer: {
|
|
244
|
+
padding: '12px 20px 20px',
|
|
245
|
+
flexShrink: '0',
|
|
246
|
+
position: 'sticky',
|
|
247
|
+
bottom: '0',
|
|
248
|
+
zIndex: '10'
|
|
249
|
+
},
|
|
250
|
+
messages: {
|
|
251
|
+
aiMessage: {
|
|
252
|
+
background: '#F8F7F6',
|
|
253
|
+
color: '#222222',
|
|
254
|
+
borderRadius: '12px',
|
|
255
|
+
padding: '12px 16px',
|
|
256
|
+
maxWidth: '85%',
|
|
257
|
+
},
|
|
258
|
+
userMessage: {
|
|
259
|
+
background: 'linear-gradient(91.95deg, #FFCB00 0%, #FFAB03 100%)',
|
|
260
|
+
color: 'white',
|
|
261
|
+
borderRadius: '16px',
|
|
262
|
+
padding: '12px 16px',
|
|
263
|
+
maxWidth: '85%'
|
|
264
|
+
},
|
|
265
|
+
messageGap: '20px'
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
enableLatex: true,
|
|
269
|
+
customClasses: {
|
|
270
|
+
container: '',
|
|
271
|
+
header: '',
|
|
272
|
+
chatContent: '',
|
|
273
|
+
inputContainer: ''
|
|
274
|
+
}
|
|
275
|
+
};
|