yt-chat-components 1.1.2 → 1.1.4

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 (42) hide show
  1. package/.idea/modules.xml +1 -1
  2. package/.idea/sonarlint/issuestore/3/6/364385cedcce4c06de1901392ffeeac0caef0f3c +0 -0
  3. package/.idea/sonarlint/issuestore/3/9/39129446b425a1d640160c068e4194e96639eedf +0 -0
  4. package/.idea/sonarlint/issuestore/4/a/4a2f33951ce07c1ff7184f91877aa13db05d3785 +0 -0
  5. package/.idea/sonarlint/issuestore/4/a/4a7b99bdbee5792679d347b6474463bf5e14b66d +0 -0
  6. package/.idea/sonarlint/issuestore/4/b/4b015aa5428c4d4c3d672893ec23f5fe3969f9be +0 -0
  7. package/.idea/sonarlint/issuestore/4/b/4b6989b8ccae808ebc45d02230d336ea53800365 +0 -0
  8. package/.idea/sonarlint/issuestore/6/1/61ebb9fd6e8cf9082658121d5d81e297791dacd0 +0 -0
  9. package/.idea/sonarlint/issuestore/6/c/6c024c1d0ad64656b9d4b0695ec3c49c0454addf +0 -0
  10. package/.idea/sonarlint/issuestore/6/e/6e75fc1c07c3a427a86fc213ca9479caaaff00ea +0 -0
  11. package/.idea/sonarlint/issuestore/8/d/8d6123af13a140f93e06299fff7ea23c547e9ec8 +0 -0
  12. package/.idea/sonarlint/issuestore/c/c/cc2352788140b6778ac06df4b33f50b390d2d8be +0 -0
  13. package/.idea/sonarlint/issuestore/d/5/d5595158cc48f9bf3e51b06f6e6805a8fd2d6262 +0 -0
  14. package/.idea/sonarlint/issuestore/d/7/d747cbed4201192dfa83a1a51345b020a050b647 +0 -0
  15. package/.idea/sonarlint/issuestore/d/9/d938938695d447dadda115e28781c6541f53fc4f +0 -0
  16. package/.idea/sonarlint/issuestore/index.pb +31 -3
  17. package/build/static/js/bundle.min.js +2 -0
  18. package/build/static/js/bundle.min.js.LICENSE.txt +132 -0
  19. package/package.json +79 -78
  20. package/public/index.html +108 -108
  21. package/src/YtChatView/chatWidget/chatWindow/chatMessage/index.tsx +498 -464
  22. package/src/YtChatView/chatWidget/chatWindow/controllers/index.ts +249 -249
  23. package/src/YtChatView/chatWidget/chatWindow/index.module.css +196 -196
  24. package/src/YtChatView/chatWidget/chatWindow/index.tsx +1099 -1086
  25. package/src/YtChatView/chatWidget/chatWindow/types/chatWidget/index.ts +50 -50
  26. package/src/YtChatView/chatWidget/index.tsx +2593 -2591
  27. package/src/YtChatView/logoBtn/index.css +3 -3
  28. package/src/YtChatView/logoBtn/index.jsx +103 -103
  29. package/src/YtChatView/logoSplitBtn/index.css +3 -3
  30. package/src/YtChatView/logoSplitBtn/index.jsx +105 -105
  31. package/src/YtChatView/mobileChat/index.jsx +945 -945
  32. package/src/YtChatView/mobileChat/index.module.css +253 -253
  33. package/src/YtChatView/previewDialog/index.jsx +600 -600
  34. package/src/YtChatView/previewDialog/index.module.css +253 -253
  35. package/src/chatWidget/chatWindow/index.tsx +426 -426
  36. package/src/chatWidget/index.tsx +2195 -2193
  37. package/src/index.tsx +10 -10
  38. package/webpack.config.js +50 -50
  39. package/dist/build/static/js/bundle.min.js +0 -1
  40. /package/.idea/{langflow-embedded-chat-clone.iml → langflow-embedded-chat.iml} +0 -0
  41. /package/.idea/sonarlint/issuestore/{7/0/7030d0b2f71b999ff89a343de08c414af32fc93a → 0/f/0f8c0c92cf798431ebb931ff6e997b1af86ecee5} +0 -0
  42. /package/.idea/sonarlint/issuestore/{9/c/9cfff9a6d27bd6c255aa751213163c7901fb8ce7 → 2/7/27e69cb561aeea20c1afbdd32d260dd60b89a81b} +0 -0
@@ -1,945 +1,945 @@
1
- /* global wx */
2
- import React from 'react';
3
- import aiAvatarPng from '../../assets/aicenter/aiavatar.png';
4
- import historyPng from '../../assets/aicenter/history.png';
5
- import closePng from '../../assets/aicenter/close.png';
6
- import { getFlowInfo, getHistoryList, getSceneInfo } from '../chatWidget/chatWindow/controllers/index';
7
- import './index.module.css'
8
- import { v4 as uuidv4 } from 'uuid';
9
- import historyListEmptyPng from '../../assets/aicenter/history-list-empty.png';
10
- import {isEmpty, isFunction} from "lodash";
11
- import {Button, message as messageTip, Progress, Skeleton, Drawer, Tabs} from 'antd'
12
- import moreAi from '../../assets/aicenter/moreAi.png';
13
- import icon_history from '../../assets/aicenter/icon_history.png';
14
- import icon_agents from '../../assets/aicenter/icon_agents.png';
15
- import icon_history_upload from '../../assets/aicenter/icon_history_upload.png';
16
- import icon_history_headerbg from '../../assets/aicenter/icon_history_headerbg.png';
17
- import icon_history_add from '../../assets/aicenter/icon_history_add.png';
18
- import ChatWidget from "../chatWidget";
19
- import Draggable from 'react-draggable';
20
-
21
-
22
- const style=`
23
- .p_closeImg {
24
- width: 14px;
25
- cursor: pointer;
26
- }
27
-
28
- .p_toolDialog {
29
- display: flex;
30
- height:100%;
31
- background:url('https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/ai_modal_bg.png');
32
- background-size: cover;
33
- border-radius:8px;
34
- }
35
-
36
- .p_toolDialog .p_toolLeft {
37
- display: flex;
38
- flex-direction: column;
39
- align-items: center;
40
- width: 300px;
41
- padding: 1.7rem 1.6rem 1.7rem 1.6rem;
42
-
43
- border-top-left-radius: 8px;
44
- border-bottom-left-radius: 8px;
45
- }
46
-
47
- .p_toolDialog .p_toolLeft .p_toolLogo {
48
- user-select: none;
49
- display: flex;
50
- align-items: center;
51
- }
52
-
53
- .p_toolDialog .p_toolLeft .p_toolLogo .p_logoImg {
54
- width: 48px;
55
- }
56
-
57
- .p_toolDialog .p_toolLeft .p_toolLogo .p_logoText {
58
- font-weight: bold;
59
- margin-left: 10px;
60
- font-size: 30px;
61
- background: linear-gradient(to right, #1551FF, #8F4BFF);
62
- -webkit-background-clip: text;
63
- -webkit-text-fill-color: transparent;
64
- }
65
-
66
- .p_toolDialog .p_toolLeft .p_historyDialog {
67
- user-select: none;
68
- margin-top: 20px;
69
- margin-bottom: 20px;
70
- border-radius: 10px;
71
- flex: 1;
72
- width: 100%;
73
- background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
74
- border-image: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)) 1 1;
75
- backdrop-filter: blur(10px);
76
- position: relative;
77
- max-height:calc(100% - 5.5rem - 60px);
78
- }
79
-
80
- .p_toolDialog .p_toolLeft .p_historyDialog ::-webkit-scrollbar-thumb {
81
- border-radius: 10px;
82
- -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
83
- background: #535353 !important;
84
- }
85
-
86
- .p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle {
87
- padding: 1.3rem 16px 0 16px;
88
- display: flex;
89
- align-items: center;
90
- }
91
-
92
- .p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle .p_historyImg {
93
- width: 25px;
94
- }
95
-
96
- .p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle .p_dialogTitle {
97
- margin-left: 10px;
98
- font-weight: 500;
99
- font-size: 18px;
100
- color: #333333;
101
- line-height: 16px;
102
- text-align: left;
103
- font-style: normal;
104
- }
105
-
106
- .p_toolDialog .p_toolLeft .p_historyDialog .p_historyListEmpty {
107
- position: absolute;
108
- top: 50%;
109
- left: 50%;
110
- transform: translate(-50%, -50%);
111
- text-align: center;
112
- font-size: 12px;
113
- color: #999999;
114
- max-height: calc(100% - 3rem);
115
-
116
- }
117
-
118
- .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList {
119
- height: calc(100% - 3rem);
120
- margin-top: 10px;
121
- overflow-y: auto;
122
- scrollbar-width: none !important; /* firefox */
123
- }
124
-
125
- .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList::-webkit-scrollbar{
126
- display:none;
127
- }
128
-
129
- .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList:hover {
130
- scrollbar-width: thin !important; /* firefox */
131
- scrollbar-color: #ced4e3 transparent;
132
- }
133
-
134
- .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem {
135
- padding: 7px 16px;
136
- }
137
-
138
- .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_activeHistoryName {
139
- color: #1552FF !important;
140
- }
141
-
142
- .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_historyName {
143
- color: #333333;
144
- overflow: hidden;
145
- text-overflow: ellipsis;
146
- white-space: nowrap;
147
- cursor: pointer;
148
- }
149
-
150
- .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_historyName:hover {
151
- color: #171717;
152
- }
153
-
154
- .p_toolDialog .p_toolRight {
155
- flex: 1;
156
- }
157
-
158
- .p_toolRightToRight {
159
- width:300px;
160
- display:flex;
161
- flex-direction:column;
162
- padding:2rem 1.6rem 1.8rem 1.6rem
163
- }
164
- .rightInnerContainer{
165
- height:calc(100% - 80px);
166
- flex:1;
167
- display:flex;
168
- flex-direction:column;
169
- justify-content: space-between;
170
- }
171
- .p_toolRightToRight .rightSideTitle{
172
- margin-bottom:1.4rem;
173
- margin-top:10px;
174
- margin-top:0;
175
- font-size:18px;
176
- font-weight:500;
177
- display:flex;
178
- align-items: center;
179
- }
180
- .p_toolRightToRight .rightSideTitle img{
181
- margin-right:4px;
182
- }
183
-
184
- .p_toolRightToRight .rightSideTitle .titleSideColumn{
185
- color:#1551FF;
186
- }
187
-
188
- .p_toolRightToRight .rightSkillContainer{
189
- min-height:40%;
190
- }
191
- .p_toolRightToRight .rightSkillContainer .rightSkillList{
192
- display: flex;
193
- flex-wrap: wrap;
194
- grid-template-columns: repeat(3, 1fr);
195
- gap: 10px;
196
- }
197
- .p_toolRightToRight .rightSkillContainer .rightSkillList .rightSkillItem{
198
- text-align: center;
199
- cursor:pointer;
200
- width:30%;
201
- }
202
- .p_toolRightToRight .rightSkillContainer .rightSkillList .rightSkillItem img{
203
- width: 40px;
204
- height: 40px;
205
- border-radius:10px;
206
- }
207
- .p_toolRightToRight .rightSkillContainer .rightSkillList .rightSkillItem p{
208
- margin-top:0px;
209
- margin-bottom:4px;
210
- overflow: hidden;
211
- text-overflow: ellipsis;
212
- white-space: nowrap;
213
- color: #333333;
214
- }
215
- .p_toolRightToRight .rightKnowledgeTitle{
216
- nargin-top: 2.2rem;
217
- margin-bottom: 1.4rem;
218
- font-size:18px;
219
- font-weight:500;
220
- display:flex;
221
- align-items: center;
222
- }
223
-
224
- .p_toolRightToRight .rightKnowledgeTitle img{
225
- margin-right:4px;
226
- }
227
-
228
- .p_toolRightToRight .rightKnowledgeContainer{
229
- position:relative;
230
- }
231
- .p_toolRightToRight .rightMoreButton{
232
- background: url(${moreAi});
233
- background-size: 85% auto;
234
- background-repeat: no-repeat;
235
- background-position: bottom;
236
- position: absolute;
237
- bottom: 8px;
238
- left: 0;
239
- width: 100%;
240
- height: 100%;
241
- z-index: 1;
242
- display: flex;
243
- justify-content: center;
244
- align-items: flex-end;
245
- }
246
- .p_toolRightToRight .rightMoreButton div{
247
- width:calc(100% - 50px);
248
- padding: 16px 16px 10px 20px;
249
- font-weight: 500;
250
- color: #ffffff;
251
- line-height: 17px;
252
- font-size: 12px;
253
- cursor:pointer;
254
- }
255
-
256
- .p_newDialog {
257
- width: 252px;
258
- height: 40px;
259
- min-height:40px;
260
- background: linear-gradient( 45deg, #1551FF 0%, #8F4BFF 100%);
261
- margin-top: 20px;
262
- border-radius: 20px;
263
- cursor: pointer;
264
- display: flex;
265
- align-items: center;
266
- justify-content: center;
267
- }
268
-
269
- .p_newDialog img {
270
- width: 18px;
271
- }
272
-
273
- .p_newDialog .p_newDialogText {
274
- color: #fff;
275
- margin-left: 6px;
276
- }
277
-
278
- .drawer-history-header {
279
- margin-top: 40px;
280
- }
281
-
282
- .drawer-history-header-title {
283
- display: flex;
284
- flex-direction: row;
285
- align-items: center;
286
-
287
- > img {
288
- width:35px
289
- }
290
-
291
- > span {
292
- }
293
- }
294
-
295
- .drawer-history-header .drawer-history-header-tool {
296
-
297
- > img {
298
- }
299
-
300
- > span {
301
- }
302
- }
303
-
304
- .drawer-history-content {
305
- }
306
- .drawer-history-footer {
307
- }
308
-
309
- `
310
-
311
- const defaultList = [
312
- {
313
- backgroundImg: 'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/drop-down-item-card-01.png',
314
- title: '我这学期的课程安排是什么样?',
315
- },
316
- {
317
- backgroundImg: 'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/drop-down-item-card-02.png',
318
- title: '我上个学期的成绩是多少?',
319
- },
320
- {
321
- backgroundImg: 'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/drop-down-item-card-03.png',
322
- title: '哪里可以找到心理咨询服务?',
323
- },
324
- ];
325
-
326
- const formatFileSize = (bytes) => {
327
- // 如果字节数为0,直接返回
328
- if(isEmpty(bytes)) {
329
- return { formattedSize: 0, unit: 'B' };
330
- }
331
- if(bytes === 0) return { formattedSize: 0, unit: 'B' };
332
-
333
- // 定义单位和对应的字节数(1024进制)
334
- const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
335
- // 计算合适的单位索引
336
- const index = Math.floor(Math.log(bytes) / Math.log(1024));
337
- // 将字节数转换为目标单位
338
- const size = bytes / Math.pow(1024, index);
339
- // 保留两位小数,并去除多余的0
340
- const formattedSize = size.toFixed(2).replace(/\.?0+$/, '');
341
- return { formattedSize, unit: units[index] }
342
- }
343
-
344
-
345
- const api_key = 'sk-mniUFDpcWwvNF3iFzssXa6etN-S_Y4AApyHYcBU44L0';
346
- const drawerTabs = [
347
- {id:'agent', name:'专项技能',icon:'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/icon/icon_tab_agent.png',activeIcon:'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/icon/icon_tab_agent_1.png'},
348
- {id:'history', name:'对话记录',icon:'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/icon/icon_tab_history.png',activeIcon:'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/icon/icon_tab_history_1.png'}
349
- ]
350
-
351
- export class MobileChatPage extends React.Component {
352
- state = {
353
- historyList: [], // 历史对话列表
354
- sessionId: uuidv4(), // 当前激活的对话对应的sessionId
355
- dropDownList: [],
356
- sceneInfo: {},
357
- currentFlow: {},
358
- currentTabKey:'agent',
359
- historyDrawerVisible: false, // 抽屉历史记录状态
360
- agentDrawerVisible: false, // 多智能体切换抽屉状态
361
- };
362
-
363
- constructor(props) {
364
- super(props);
365
- this.dragging = false;
366
- }
367
-
368
- async componentDidMount() {
369
- if(isEmpty(this.props.sceneId)){
370
- // 兼容非场景打开的情况
371
- this.getHistoryList({},true);
372
- }else{
373
- const sceneData = await this.getSceneInfo();
374
- if(isEmpty(sceneData)) {
375
- this.getHistoryList({},true);
376
- } else {
377
- this.setWindowTitle(sceneData.name)
378
- this.getHistoryList(sceneData,true);
379
- }
380
- }
381
- }
382
-
383
- setWindowTitle = (title) => {
384
- if (!isEmpty(title)){
385
- document.title = 'AI校园智多星';
386
- window.document.title = 'AI校园智多星';
387
- }
388
- }
389
-
390
- getCurrentFlowHistory=(flowId)=>{
391
- let { userInfo = {} } = this.props;
392
- const { sessionId } = this.state;
393
- if(isEmpty(userInfo.code)) {
394
- userInfo.code = sessionId;
395
- }
396
- const operationId = userInfo['code'] || '';
397
- console.log('getCurrentFlowHistory', flowId, operationId)
398
- getHistoryList(this.props.hostUrl, flowId, operationId).then((res) => {
399
- if(res.status === 200){
400
- console.log('getCurrentFlowHistory', res.data)
401
- this.setState({ historyList: res.data });
402
- }
403
- });
404
- }
405
-
406
- // 获取历史对话列表
407
- getHistoryList = (sceneData, isRefreshWords) => {
408
- const { sceneId, appId: flowId, isShowSideLeft } = this.props;
409
- if(isEmpty(sceneId)){
410
- // 单独组件情况
411
- if(isRefreshWords){
412
- this.getFlowInfo().then(currentFlow=>{
413
- const dropDownList = this.getDropDownList(currentFlow.welcome_words);
414
- this.setState({ dropDownList, currentFlow })
415
- })
416
- }
417
- if(isShowSideLeft) {
418
- this.getCurrentFlowHistory(flowId)
419
- }
420
- }else{
421
- const currentScene = sceneData||this.state.sceneInfo;
422
- const currentFlow = currentScene.flows[0];
423
- console.log('getHistoryList', sceneData, currentFlow)
424
- const dropDownList = this.getDropDownList(currentFlow.welcome_words);
425
- if(!isEmpty(sceneData)){
426
- this.setState({ currentFlow, dropDownList })
427
- }else if(isEmpty(this.state.sceneInfo)){
428
- this.setState({ dropDownList:defaultList })
429
- }
430
- if(isShowSideLeft) {
431
- this.getCurrentFlowHistory(currentFlow.id)
432
- }
433
- }
434
- };
435
-
436
- getSceneInfo = async ()=>{
437
- const res = await getSceneInfo(this.props.hostUrl, this.props.sceneId, api_key);
438
- if(res.status === 200){
439
- this.setState({ sceneInfo: res.data });
440
- }
441
- return res.data;
442
- }
443
-
444
- getFlowInfo = async () => {
445
- const res = await getFlowInfo(this.props.hostUrl, this.props.appId, api_key);
446
- if(res.status === 200) {
447
- this.setState({ sceneInfo: res.data });
448
- }
449
- return res.data;
450
- }
451
-
452
- // 新建对话
453
- newDialog = () => {
454
- if(this.state.dropDownList) {
455
- messageTip.info("当前已是最新对话")
456
- return;
457
- }
458
- this.setState({ sessionId: uuidv4() });
459
- this.setState({ dropDownList: this.getDropDownList(this.state.currentFlow.welcome_words), drawerVisible: false })
460
- }
461
-
462
- updateSessionId = (sessionId) => {
463
- this.setState({ sessionId });
464
- };
465
-
466
- getDropDownList = (welcome_words)=>{
467
- if(isEmpty(welcome_words)){
468
- return defaultList;
469
- }
470
- return welcome_words.map((question,index)=>(
471
- {
472
- backgroundImg:defaultList[index].backgroundImg,
473
- title:question,
474
- }
475
- ))
476
- }
477
-
478
- render() {
479
- const {
480
- title,
481
- appId: flowId,
482
- hostUrl,
483
- setDialogVisible,
484
- userInfo,
485
- boxStyle,
486
- isShowSideRight,
487
- isShowSideLeft = true,
488
- tags = [],
489
- agentUrl = aiAvatarPng,
490
- agentName = '校园智多星',
491
- logoWidth = '42px',
492
- logoFontSize = '26px',
493
- isTitleSideIcon = false,// 是否将左侧历史顶部icon移到中间顶部左侧蓝点位置
494
- modalIndex,
495
- isShowVoiceButton,
496
- isShowUploadButton,
497
- dropManUrl,
498
- modalWidth,
499
- isLogin = false,
500
- isShowLogin = false,
501
- loginBtnClick,
502
- } = this.props;
503
- const { sceneInfo, currentFlow = {} } = this.state;
504
- const { flows = [], name: sceneName, character } = sceneInfo;
505
- return (
506
- <div style={boxStyle}>
507
- <style dangerouslySetInnerHTML={{ __html: style }}></style>
508
- <div style={{ position: 'absolute', top: '15px', right: '14px', zIndex: modalIndex }}>
509
- {isFunction(setDialogVisible) &&
510
- <img onClick={() => setDialogVisible(false)} className="p_closeImg" src={closePng}/>}
511
- </div>
512
- <div className="p_toolDialog" style={{borderRadius:0, backgroundImage:'url(https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/kai_yuan/yt/agent_list_bg2.png)'}}>
513
- {
514
- isShowSideLeft && (
515
- <>
516
- <img
517
- src={icon_history}
518
- style={{
519
- width: '40px',
520
- height: '40px',
521
- position: 'absolute',
522
- left: '0px',
523
- top: '0px',
524
- zIndex: 1000,
525
- display: 'none',
526
- }}
527
- onClick={() => this.setState({drawerVisible: true})}
528
- />
529
- <Drawer
530
- title={null}
531
- closable={false}
532
- placement="left"
533
- width={'80%'}
534
- bodyStyle={{padding: 0}}
535
- onClose={() => this.setState({drawerVisible: false})}
536
- open={this.state.drawerVisible}
537
- >
538
- <div className="drawer-history-header" style={{marginTop:0, padding: '54px 14px 14px 14px', background: 'linear-gradient( 71deg, #E1E9FF 0%, #FFFFFF 100%)', position: "relative"}}>
539
- <img src={icon_history_headerbg} style={{position: 'absolute', right: 0, bottom: 0, width: '40%', zIndex:0}}/>
540
- <div className="drawer-history-header-title" style={{display: 'flex', flexDirection: 'row', alignItems: 'center'}}>
541
- <img style={{width: 35}} src={agentUrl}/>
542
- <span style={{fontSize: 24, marginLeft: 10}}>{agentName}</span>
543
- </div>
544
- {/*<div className="drawer-history-header-tool" style={{display: 'flex',flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginTop: 32 }}>*/}
545
- {/* <div*/}
546
- {/* style={{display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', marginRight: 20, height: 44,background: '#fff', borderRadius: 5,width: '45%'}}*/}
547
- {/* onClick={() => {this.newDialog()}}*/}
548
- {/* >*/}
549
- {/* <img src={icon_history_add} style={{width: '20px', height: '20px', marginRight: 10}}/>*/}
550
- {/* <span>新建对话</span>*/}
551
- {/* </div>*/}
552
- {/* <div*/}
553
- {/* style={{*/}
554
- {/* display: 'flex',*/}
555
- {/* flexDirection: 'row',*/}
556
- {/* alignItems: 'center',*/}
557
- {/* justifyContent: 'center',*/}
558
- {/* marginRight: 20,*/}
559
- {/* height: 44,*/}
560
- {/* background: '#fff',*/}
561
- {/* borderRadius: 5,*/}
562
- {/* width: '45%',*/}
563
- {/* zIndex: 0*/}
564
- {/* }}*/}
565
- {/* onClick={() => messageTip.info("敬请期待")}*/}
566
- {/* >*/}
567
- {/* <img src={icon_history_upload} style={{width: '20px', height: '20px', marginRight: 10}}/>*/}
568
- {/* <span>个人知识库</span>*/}
569
- {/* </div>*/}
570
- {/*</div>*/}
571
- </div>
572
- <div
573
- className="p_historyDialog"
574
- style={{
575
- height: 'calc(100% - 146px - 50px)',
576
- boxSizing: 'border-box',
577
- userSelect: 'none',
578
- flex: 1,
579
- background: 'linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%)',
580
- borderImage: 'linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)) 1 1',
581
- backdropFilter: 'blur(10px)',
582
- position: 'relative',
583
- }}
584
- >
585
- <div style={{display: 'flex', flexDirection: 'row', justifyContent: 'space-between'}}>
586
- {
587
- drawerTabs.map((item, index) => (
588
- <div id={item.id} style={{
589
- width:'50%',
590
- display: 'flex',
591
- WebkitTapHighlightColor: 'transparent',
592
- userSelect: 'none',
593
- WebkitUserSelect: 'none',
594
- WebkitTouchCallout: 'none',
595
- flexDirection: 'row',
596
- alignItems: 'center',
597
- justifyContent: 'center',
598
- cursor: 'pointer',
599
- padding: '30px 14px 15px 14px',
600
- borderBottom: this.state.currentTabKey === item.id ? '2px solid #2850FF' : '2px solid #fff'
601
- }}
602
- onClick={() => this.setState({currentTabKey: item.id})}
603
- >
604
- <img style={{width:16, marginRight: 8}} src={this.state.currentTabKey === item.id ? item.activeIcon : item.icon} />
605
- <div style={{fontSize:16, fontWeight: 'bold', color: this.state.currentTabKey === item.id ? '#2850FF' : '#333'}}>{item.name}</div>
606
- </div>
607
- ))
608
- }
609
- </div>
610
- {/*专项技能*/}
611
- {
612
- this.state.currentTabKey === 'agent' &&
613
- <div className="p_historyList" style={{overflowY: 'auto', height: 'calc(100% - 90px)'}}>
614
- {flows?.map((item) => (
615
- <div
616
- key={item.id}
617
- className="p_historyItem"
618
- style={{
619
- display: 'flex',
620
- height: 44,
621
- alignItems: 'center',
622
- paddingLeft: 30,
623
- paddingRight: 30,
624
- fontWeight: 400,
625
- fontSize: 14,
626
- color: '#333',
627
- borderRadius: 10,
628
- marginBottom: 24,
629
- }}
630
- onClick={() => {
631
- // 右侧点击一个技能,更新sessionId,切换当前flow信息,重新查询历史记录
632
- this.setState({
633
- sessionId: uuidv4(),
634
- currentFlow: item,
635
- dropDownList: this.getDropDownList(item.welcome_words),
636
- agentDrawerVisible: false,
637
- drawerVisible: false,
638
- });
639
- this.setWindowTitle(item.name)
640
- this.getCurrentFlowHistory(item.id);
641
- }}
642
- >
643
- <div
644
- style={{
645
- width:'100%',
646
- display: 'flex',
647
- flexDirection: 'row',
648
- alignItems: 'center',
649
- justifyContent: 'space-between',
650
- whiteSpace: 'nowrap',
651
- overflow: 'hidden',
652
- textOverflow: 'ellipsis',
653
- color: item.session_id === this.state.sessionId ? '#1551FF' : '#333',
654
- }}
655
- >
656
- <div style={{display: 'flex', flexDirection: 'row', alignItems: 'center', color:'#333', fontSize:'16px', textAlign:'left', fontWeight:'bold'}}>
657
- <img
658
- src={item.icon}
659
- alt={item.name}
660
- style={{width: '36px', borderRadius:5, marginRight: 10}}
661
- />
662
- {item.name}
663
- </div>
664
-
665
- <img
666
- src={'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/icon/icon_arrow_right.png'}
667
- style={{ height: '5px'}}
668
- />
669
- </div>
670
- </div>
671
- ))}
672
- </div>
673
- }
674
-
675
- {/*对话记录*/}
676
- {
677
- this.state.currentTabKey === 'history' &&
678
- (this.state.historyList.length > 0 ? (
679
- <div className="p_historyList" style={{overflowY: 'auto', height: 'calc(100% - 70px)'}}>
680
- {this.state.historyList?.map((item) => (
681
- <div
682
- key={item.session_id}
683
- className="p_historyItem"
684
- style={{
685
- display: 'flex',
686
- height: 44,
687
- alignItems: 'center',
688
- paddingLeft: 30,
689
- paddingRight: 30,
690
- fontWeight: 400,
691
- fontSize: 14,
692
- color: '#333',
693
- borderRadius: 10,
694
- background: item.session_id === this.state.sessionId ? '#F5F5FF' : '#fff',
695
- }}
696
- onClick={() => {
697
- this.setState({dropDownList: undefined, drawerVisible: false})
698
- this.updateSessionId(item.session_id);
699
- }}
700
- >
701
- <div
702
- className={`p_historyName ${
703
- item.session_id === this.state.sessionId ? 'p_activeHistoryName' : ''
704
- }`}
705
- style={{
706
- whiteSpace: 'nowrap',
707
- overflow: 'hidden',
708
- textOverflow: 'ellipsis',
709
- color: item.session_id === this.state.sessionId ? '#1551FF' : '#333',
710
- }}
711
- >
712
- {item.text}
713
- </div>
714
- </div>
715
- ))}
716
- </div>
717
- ) : (
718
- <div className="p_historyListEmpty" style={{display: 'flex', flexDirection: 'column', alignItems: 'center', marginTop: 50}}>
719
- <img src={historyListEmptyPng} style={{width: '100px', height: '100px', marginBottom: 20}}/>
720
- <div className="p_historyListEmptyText" style={{fontSize: 16, color: '#999' }}>暂无对话记录</div>
721
- </div>
722
- ))
723
- }
724
- </div>
725
- <div style={{display: 'flex', justifyContent: 'center', alignItems: 'center', marginTop: 10, marginBottom: 20}}>
726
- {
727
- isShowLogin &&
728
- <div
729
- style={{
730
- display: 'flex',
731
- justifyContent: 'center',
732
- alignItems: 'center',
733
- width: '80%',
734
- height: 44,
735
- color: '#fff',
736
- background: 'linear-gradient( 30deg, #1551FF 0%, #8F4BFF 100%)',
737
- borderRadius: 10
738
- }}
739
- onClick={() => {
740
- this.setState({drawerVisible: false})
741
- this.newDialog()
742
- }}
743
- >
744
- 新建对话
745
- </div>
746
- }
747
- </div>
748
- </Drawer>
749
- </>
750
- )
751
- }
752
- <div className="p_toolRight">
753
- <ChatWidget
754
- input_container_style={{zIndex:2}}
755
- chat_window_style={{paddingTop: 0}}
756
- bot_message_style={{background: '#fff', maxWidth:'100%'}}
757
- window_title={currentFlow?.name || title}
758
- flow_id={currentFlow?.id || flowId}
759
- tags={currentFlow?.keywords || tags}
760
- host_url={hostUrl}
761
- api_key={api_key}
762
- session_id={this.state.sessionId}
763
- userInfo={userInfo}
764
- getHistoryList={this.getHistoryList}
765
- setDropDownList={(list) => this.setState({dropDownList: list})}
766
- dropDownList={this.state.dropDownList}
767
- baseConfig={{isTitleSideIcon, logoWidth, agentUrl}}
768
- isShowVoiceButton={isShowVoiceButton}
769
- isShowUploadButton={isShowUploadButton}
770
- dropManUrl={character || dropManUrl}
771
- modalWidth={modalWidth}
772
- isMobile={true}
773
- isShowChatHeader={false}
774
- />
775
- </div>
776
- {
777
- isShowSideRight && (
778
- <>
779
- <Draggable onStart={() => { this.dragging = false; }}
780
- onDrag={() => { this.dragging = true; }}
781
- onStop={(e) => {
782
- if (!this.dragging) {
783
- this.setState({drawerVisible: true})
784
- }
785
- }}>
786
- <img
787
- src={icon_agents}
788
- style={{
789
- width: '60px',
790
- height: '60px',
791
- position: 'absolute',
792
- right: '0px',
793
- bottom: '200px',
794
- zIndex: 1000
795
- }}
796
- />
797
- </Draggable>
798
- <Drawer
799
- title={'专项技能'}
800
- // closable={false}
801
- placement="right"
802
- width={'100%'}
803
- style={{
804
- backgroundImage: 'url(https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/kai_yuan/yt/agent_list_bg.png)',
805
- backgroundSize: 'cover',
806
- backgroundRepeat: 'no-repeat',
807
- backgroundPosition: 'center'
808
- }}
809
- bodyStyle={{
810
- padding: 0,
811
- }}
812
- onClose={() => this.setState({agentDrawerVisible: false})}
813
- open={this.state.agentDrawerVisible}
814
- >
815
- <div
816
- className={"p_toolRightToRight"}
817
- style={{
818
- width:'100%',
819
- display:'flex',
820
- boxSizing:'border-box',
821
- flexDirection:'column',
822
- padding: '1rem 1rem 1rem 1rem',
823
- }}
824
- >
825
- <div
826
- className={"rightInnerContainer"}
827
- style={{
828
- width:'100%',
829
- display:'flex',
830
- flexDirection:'row',
831
- justifyContent:'space-between',
832
-
833
- }}
834
- >
835
- <div style={{width:'100%'}}>
836
- {/*<h3 className={"rightSideTitle"}>*/}
837
- {/* <img width={15} src={self_skills}/>*/}
838
- {/* <span style={{color: "#333333"}}>专项技能</span>*/}
839
- {/*</h3>*/}
840
- {
841
- isEmpty(flows) ?
842
- <Skeleton
843
- title={false}
844
- active
845
- paragraph={{rows: 5, width: '100%'}}
846
- />
847
- :
848
- <div className={"rightSkillContainer"} style={{width:'100%'}}>
849
- <div
850
- className={"rightSkillList"}
851
- style={{
852
- width:'100%',
853
- display: 'grid',
854
- gridTemplateColumns: 'repeat(2, 1fr)', /* 每行 2 列 */
855
- gap: 20 /* 设置列和行之间的间距 */
856
- }}>
857
- {flows.slice(0, 12).map((item) => (
858
- <div
859
- key={item.id}
860
- className={"rightSkillItem"}
861
- style={{
862
- display: 'flex',
863
- flexDirection: 'column',
864
- background: '#fff',
865
- borderRadius: 22,
866
- opacity: 0.7,
867
- width:'100%',
868
- height: '45vw',
869
- boxSizing: 'border-box',
870
- padding: '18px',
871
- }}
872
- onClick={() => {
873
- // 右侧点击一个技能,更新sessionId,切换当前flow信息,重新查询历史记录
874
- this.setState({
875
- sessionId: uuidv4(),
876
- currentFlow: item,
877
- dropDownList: this.getDropDownList(item.welcome_words),
878
- agentDrawerVisible: false,
879
- });
880
- this.setWindowTitle(item.name)
881
- this.getCurrentFlowHistory(item.id);
882
- }}
883
- >
884
- <img
885
- src={item.icon}
886
- alt={item.name}
887
- style={{width: '40px', height: '40px'}}
888
- />
889
- <div style={{marginTop: '12px', color: '#333333', fontWeight: "bold", fontSize: '14px', textAlign: "left"}}>{item.name}</div>
890
- <div style={{marginTop: '8px', color: '#333333', fontSize: '10px', textAlign: "left"}}>{item.content}</div>
891
- </div>
892
- ))}
893
- </div>
894
- </div>
895
- }
896
- </div>
897
- {/*<div>*/}
898
- {/* <h3 className={"rightKnowledgeTitle"}>*/}
899
- {/* <img width={15} src={self_knowledge}/>*/}
900
- {/* <span style={{color: "#333333"}}>个人知识库</span>*/}
901
- {/* </h3>*/}
902
- {/* {*/}
903
- {/* isEmpty(currentFlow) ?*/}
904
- {/* <Skeleton*/}
905
- {/* title={false}*/}
906
- {/* active*/}
907
- {/* paragraph={{rows: 5, width: '100%'}}*/}
908
- {/* /> :*/}
909
- {/* <div className={"rightKnowledgeContainer"}>*/}
910
- {/* <img src={moreBg}/>*/}
911
- {/* <div style={{position: 'absolute', top: '40px', left: '16px'}}>*/}
912
- {/* <div>文件总数<span style={{*/}
913
- {/* padding: 8,*/}
914
- {/* fontSize: '20px',*/}
915
- {/* fontWeight: 700*/}
916
- {/* }}>{currentFlow.k_count || 0}</span>个*/}
917
- {/* </div>*/}
918
- {/* <div style={{marginTop: 10}}>文件总量<span style={{*/}
919
- {/* padding: 8,*/}
920
- {/* fontSize: '20px',*/}
921
- {/* fontWeight: 700*/}
922
- {/* }}>{formatFileSize(currentFlow.k_size).formattedSize}</span>{formatFileSize(currentFlow.k_size).unit}*/}
923
- {/* </div>*/}
924
- {/* </div>*/}
925
- {/* <div className={"rightMoreButton"}>*/}
926
- {/* <div className={"rightMoreTitle"}*/}
927
- {/* onClick={() => messageTip.info("敬请期待")}>训练你的专属知识库*/}
928
- {/* </div>*/}
929
- {/* </div>*/}
930
- {/* </div>*/}
931
- {/* }*/}
932
- {/*</div>*/}
933
- </div>
934
- </div>
935
- </Drawer>
936
- </>
937
- )
938
- }
939
- </div>
940
- </div>
941
- );
942
- }
943
- }
944
-
945
- export default MobileChatPage;
1
+ /* global wx */
2
+ import React from 'react';
3
+ import aiAvatarPng from '../../assets/aicenter/aiavatar.png';
4
+ import historyPng from '../../assets/aicenter/history.png';
5
+ import closePng from '../../assets/aicenter/close.png';
6
+ import { getFlowInfo, getHistoryList, getSceneInfo } from '../chatWidget/chatWindow/controllers/index';
7
+ import './index.module.css'
8
+ import { v4 as uuidv4 } from 'uuid';
9
+ import historyListEmptyPng from '../../assets/aicenter/history-list-empty.png';
10
+ import {isEmpty, isFunction} from "lodash";
11
+ import {Button, message as messageTip, Progress, Skeleton, Drawer, Tabs} from 'antd'
12
+ import moreAi from '../../assets/aicenter/moreAi.png';
13
+ import icon_history from '../../assets/aicenter/icon_history.png';
14
+ import icon_agents from '../../assets/aicenter/icon_agents.png';
15
+ import icon_history_upload from '../../assets/aicenter/icon_history_upload.png';
16
+ import icon_history_headerbg from '../../assets/aicenter/icon_history_headerbg.png';
17
+ import icon_history_add from '../../assets/aicenter/icon_history_add.png';
18
+ import ChatWidget from "../chatWidget";
19
+ import Draggable from 'react-draggable';
20
+
21
+
22
+ const style=`
23
+ .p_closeImg {
24
+ width: 14px;
25
+ cursor: pointer;
26
+ }
27
+
28
+ .p_toolDialog {
29
+ display: flex;
30
+ height:100%;
31
+ background:url('https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/ai_modal_bg.png');
32
+ background-size: cover;
33
+ border-radius:8px;
34
+ }
35
+
36
+ .p_toolDialog .p_toolLeft {
37
+ display: flex;
38
+ flex-direction: column;
39
+ align-items: center;
40
+ width: 300px;
41
+ padding: 1.7rem 1.6rem 1.7rem 1.6rem;
42
+
43
+ border-top-left-radius: 8px;
44
+ border-bottom-left-radius: 8px;
45
+ }
46
+
47
+ .p_toolDialog .p_toolLeft .p_toolLogo {
48
+ user-select: none;
49
+ display: flex;
50
+ align-items: center;
51
+ }
52
+
53
+ .p_toolDialog .p_toolLeft .p_toolLogo .p_logoImg {
54
+ width: 48px;
55
+ }
56
+
57
+ .p_toolDialog .p_toolLeft .p_toolLogo .p_logoText {
58
+ font-weight: bold;
59
+ margin-left: 10px;
60
+ font-size: 30px;
61
+ background: linear-gradient(to right, #1551FF, #8F4BFF);
62
+ -webkit-background-clip: text;
63
+ -webkit-text-fill-color: transparent;
64
+ }
65
+
66
+ .p_toolDialog .p_toolLeft .p_historyDialog {
67
+ user-select: none;
68
+ margin-top: 20px;
69
+ margin-bottom: 20px;
70
+ border-radius: 10px;
71
+ flex: 1;
72
+ width: 100%;
73
+ background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
74
+ border-image: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)) 1 1;
75
+ backdrop-filter: blur(10px);
76
+ position: relative;
77
+ max-height:calc(100% - 5.5rem - 60px);
78
+ }
79
+
80
+ .p_toolDialog .p_toolLeft .p_historyDialog ::-webkit-scrollbar-thumb {
81
+ border-radius: 10px;
82
+ -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
83
+ background: #535353 !important;
84
+ }
85
+
86
+ .p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle {
87
+ padding: 1.3rem 16px 0 16px;
88
+ display: flex;
89
+ align-items: center;
90
+ }
91
+
92
+ .p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle .p_historyImg {
93
+ width: 25px;
94
+ }
95
+
96
+ .p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle .p_dialogTitle {
97
+ margin-left: 10px;
98
+ font-weight: 500;
99
+ font-size: 18px;
100
+ color: #333333;
101
+ line-height: 16px;
102
+ text-align: left;
103
+ font-style: normal;
104
+ }
105
+
106
+ .p_toolDialog .p_toolLeft .p_historyDialog .p_historyListEmpty {
107
+ position: absolute;
108
+ top: 50%;
109
+ left: 50%;
110
+ transform: translate(-50%, -50%);
111
+ text-align: center;
112
+ font-size: 12px;
113
+ color: #999999;
114
+ max-height: calc(100% - 3rem);
115
+
116
+ }
117
+
118
+ .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList {
119
+ height: calc(100% - 3rem);
120
+ margin-top: 10px;
121
+ overflow-y: auto;
122
+ scrollbar-width: none !important; /* firefox */
123
+ }
124
+
125
+ .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList::-webkit-scrollbar{
126
+ display:none;
127
+ }
128
+
129
+ .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList:hover {
130
+ scrollbar-width: thin !important; /* firefox */
131
+ scrollbar-color: #ced4e3 transparent;
132
+ }
133
+
134
+ .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem {
135
+ padding: 7px 16px;
136
+ }
137
+
138
+ .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_activeHistoryName {
139
+ color: #1552FF !important;
140
+ }
141
+
142
+ .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_historyName {
143
+ color: #333333;
144
+ overflow: hidden;
145
+ text-overflow: ellipsis;
146
+ white-space: nowrap;
147
+ cursor: pointer;
148
+ }
149
+
150
+ .p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_historyName:hover {
151
+ color: #171717;
152
+ }
153
+
154
+ .p_toolDialog .p_toolRight {
155
+ flex: 1;
156
+ }
157
+
158
+ .p_toolRightToRight {
159
+ width:300px;
160
+ display:flex;
161
+ flex-direction:column;
162
+ padding:2rem 1.6rem 1.8rem 1.6rem
163
+ }
164
+ .rightInnerContainer{
165
+ height:calc(100% - 80px);
166
+ flex:1;
167
+ display:flex;
168
+ flex-direction:column;
169
+ justify-content: space-between;
170
+ }
171
+ .p_toolRightToRight .rightSideTitle{
172
+ margin-bottom:1.4rem;
173
+ margin-top:10px;
174
+ margin-top:0;
175
+ font-size:18px;
176
+ font-weight:500;
177
+ display:flex;
178
+ align-items: center;
179
+ }
180
+ .p_toolRightToRight .rightSideTitle img{
181
+ margin-right:4px;
182
+ }
183
+
184
+ .p_toolRightToRight .rightSideTitle .titleSideColumn{
185
+ color:#1551FF;
186
+ }
187
+
188
+ .p_toolRightToRight .rightSkillContainer{
189
+ min-height:40%;
190
+ }
191
+ .p_toolRightToRight .rightSkillContainer .rightSkillList{
192
+ display: flex;
193
+ flex-wrap: wrap;
194
+ grid-template-columns: repeat(3, 1fr);
195
+ gap: 10px;
196
+ }
197
+ .p_toolRightToRight .rightSkillContainer .rightSkillList .rightSkillItem{
198
+ text-align: center;
199
+ cursor:pointer;
200
+ width:30%;
201
+ }
202
+ .p_toolRightToRight .rightSkillContainer .rightSkillList .rightSkillItem img{
203
+ width: 40px;
204
+ height: 40px;
205
+ border-radius:10px;
206
+ }
207
+ .p_toolRightToRight .rightSkillContainer .rightSkillList .rightSkillItem p{
208
+ margin-top:0px;
209
+ margin-bottom:4px;
210
+ overflow: hidden;
211
+ text-overflow: ellipsis;
212
+ white-space: nowrap;
213
+ color: #333333;
214
+ }
215
+ .p_toolRightToRight .rightKnowledgeTitle{
216
+ nargin-top: 2.2rem;
217
+ margin-bottom: 1.4rem;
218
+ font-size:18px;
219
+ font-weight:500;
220
+ display:flex;
221
+ align-items: center;
222
+ }
223
+
224
+ .p_toolRightToRight .rightKnowledgeTitle img{
225
+ margin-right:4px;
226
+ }
227
+
228
+ .p_toolRightToRight .rightKnowledgeContainer{
229
+ position:relative;
230
+ }
231
+ .p_toolRightToRight .rightMoreButton{
232
+ background: url(${moreAi});
233
+ background-size: 85% auto;
234
+ background-repeat: no-repeat;
235
+ background-position: bottom;
236
+ position: absolute;
237
+ bottom: 8px;
238
+ left: 0;
239
+ width: 100%;
240
+ height: 100%;
241
+ z-index: 1;
242
+ display: flex;
243
+ justify-content: center;
244
+ align-items: flex-end;
245
+ }
246
+ .p_toolRightToRight .rightMoreButton div{
247
+ width:calc(100% - 50px);
248
+ padding: 16px 16px 10px 20px;
249
+ font-weight: 500;
250
+ color: #ffffff;
251
+ line-height: 17px;
252
+ font-size: 12px;
253
+ cursor:pointer;
254
+ }
255
+
256
+ .p_newDialog {
257
+ width: 252px;
258
+ height: 40px;
259
+ min-height:40px;
260
+ background: linear-gradient( 45deg, #1551FF 0%, #8F4BFF 100%);
261
+ margin-top: 20px;
262
+ border-radius: 20px;
263
+ cursor: pointer;
264
+ display: flex;
265
+ align-items: center;
266
+ justify-content: center;
267
+ }
268
+
269
+ .p_newDialog img {
270
+ width: 18px;
271
+ }
272
+
273
+ .p_newDialog .p_newDialogText {
274
+ color: #fff;
275
+ margin-left: 6px;
276
+ }
277
+
278
+ .drawer-history-header {
279
+ margin-top: 40px;
280
+ }
281
+
282
+ .drawer-history-header-title {
283
+ display: flex;
284
+ flex-direction: row;
285
+ align-items: center;
286
+
287
+ > img {
288
+ width:35px
289
+ }
290
+
291
+ > span {
292
+ }
293
+ }
294
+
295
+ .drawer-history-header .drawer-history-header-tool {
296
+
297
+ > img {
298
+ }
299
+
300
+ > span {
301
+ }
302
+ }
303
+
304
+ .drawer-history-content {
305
+ }
306
+ .drawer-history-footer {
307
+ }
308
+
309
+ `
310
+
311
+ const defaultList = [
312
+ {
313
+ backgroundImg: 'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/drop-down-item-card-01.png',
314
+ title: '我这学期的课程安排是什么样?',
315
+ },
316
+ {
317
+ backgroundImg: 'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/drop-down-item-card-02.png',
318
+ title: '我上个学期的成绩是多少?',
319
+ },
320
+ {
321
+ backgroundImg: 'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/drop-down-item-card-03.png',
322
+ title: '哪里可以找到心理咨询服务?',
323
+ },
324
+ ];
325
+
326
+ const formatFileSize = (bytes) => {
327
+ // 如果字节数为0,直接返回
328
+ if(isEmpty(bytes)) {
329
+ return { formattedSize: 0, unit: 'B' };
330
+ }
331
+ if(bytes === 0) return { formattedSize: 0, unit: 'B' };
332
+
333
+ // 定义单位和对应的字节数(1024进制)
334
+ const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
335
+ // 计算合适的单位索引
336
+ const index = Math.floor(Math.log(bytes) / Math.log(1024));
337
+ // 将字节数转换为目标单位
338
+ const size = bytes / Math.pow(1024, index);
339
+ // 保留两位小数,并去除多余的0
340
+ const formattedSize = size.toFixed(2).replace(/\.?0+$/, '');
341
+ return { formattedSize, unit: units[index] }
342
+ }
343
+
344
+
345
+ const api_key = 'sk-mniUFDpcWwvNF3iFzssXa6etN-S_Y4AApyHYcBU44L0';
346
+ const drawerTabs = [
347
+ {id:'agent', name:'专项技能',icon:'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/icon/icon_tab_agent.png',activeIcon:'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/icon/icon_tab_agent_1.png'},
348
+ {id:'history', name:'对话记录',icon:'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/icon/icon_tab_history.png',activeIcon:'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/icon/icon_tab_history_1.png'}
349
+ ]
350
+
351
+ export class MobileChatPage extends React.Component {
352
+ state = {
353
+ historyList: [], // 历史对话列表
354
+ sessionId: uuidv4(), // 当前激活的对话对应的sessionId
355
+ dropDownList: [],
356
+ sceneInfo: {},
357
+ currentFlow: {},
358
+ currentTabKey:'agent',
359
+ historyDrawerVisible: false, // 抽屉历史记录状态
360
+ agentDrawerVisible: false, // 多智能体切换抽屉状态
361
+ };
362
+
363
+ constructor(props) {
364
+ super(props);
365
+ this.dragging = false;
366
+ }
367
+
368
+ async componentDidMount() {
369
+ if(isEmpty(this.props.sceneId)){
370
+ // 兼容非场景打开的情况
371
+ this.getHistoryList({},true);
372
+ }else{
373
+ const sceneData = await this.getSceneInfo();
374
+ if(isEmpty(sceneData)) {
375
+ this.getHistoryList({},true);
376
+ } else {
377
+ this.setWindowTitle(sceneData.name)
378
+ this.getHistoryList(sceneData,true);
379
+ }
380
+ }
381
+ }
382
+
383
+ setWindowTitle = (title) => {
384
+ if (!isEmpty(title)){
385
+ document.title = 'AI校园智多星';
386
+ window.document.title = 'AI校园智多星';
387
+ }
388
+ }
389
+
390
+ getCurrentFlowHistory=(flowId)=>{
391
+ let { userInfo = {} } = this.props;
392
+ const { sessionId } = this.state;
393
+ if(isEmpty(userInfo.code)) {
394
+ userInfo.code = sessionId;
395
+ }
396
+ const operationId = userInfo['code'] || '';
397
+ console.log('getCurrentFlowHistory', flowId, operationId)
398
+ getHistoryList(this.props.hostUrl, flowId, operationId).then((res) => {
399
+ if(res.status === 200){
400
+ console.log('getCurrentFlowHistory', res.data)
401
+ this.setState({ historyList: res.data });
402
+ }
403
+ });
404
+ }
405
+
406
+ // 获取历史对话列表
407
+ getHistoryList = (sceneData, isRefreshWords) => {
408
+ const { sceneId, appId: flowId, isShowSideLeft } = this.props;
409
+ if(isEmpty(sceneId)){
410
+ // 单独组件情况
411
+ if(isRefreshWords){
412
+ this.getFlowInfo().then(currentFlow=>{
413
+ const dropDownList = this.getDropDownList(currentFlow.welcome_words);
414
+ this.setState({ dropDownList, currentFlow })
415
+ })
416
+ }
417
+ if(isShowSideLeft) {
418
+ this.getCurrentFlowHistory(flowId)
419
+ }
420
+ }else{
421
+ const currentScene = sceneData||this.state.sceneInfo;
422
+ const currentFlow = currentScene.flows[0];
423
+ console.log('getHistoryList', sceneData, currentFlow)
424
+ const dropDownList = this.getDropDownList(currentFlow.welcome_words);
425
+ if(!isEmpty(sceneData)){
426
+ this.setState({ currentFlow, dropDownList })
427
+ }else if(isEmpty(this.state.sceneInfo)){
428
+ this.setState({ dropDownList:defaultList })
429
+ }
430
+ if(isShowSideLeft) {
431
+ this.getCurrentFlowHistory(currentFlow.id)
432
+ }
433
+ }
434
+ };
435
+
436
+ getSceneInfo = async ()=>{
437
+ const res = await getSceneInfo(this.props.hostUrl, this.props.sceneId, api_key);
438
+ if(res.status === 200){
439
+ this.setState({ sceneInfo: res.data });
440
+ }
441
+ return res.data;
442
+ }
443
+
444
+ getFlowInfo = async () => {
445
+ const res = await getFlowInfo(this.props.hostUrl, this.props.appId, api_key);
446
+ if(res.status === 200) {
447
+ this.setState({ sceneInfo: res.data });
448
+ }
449
+ return res.data;
450
+ }
451
+
452
+ // 新建对话
453
+ newDialog = () => {
454
+ if(this.state.dropDownList) {
455
+ messageTip.info("当前已是最新对话")
456
+ return;
457
+ }
458
+ this.setState({ sessionId: uuidv4() });
459
+ this.setState({ dropDownList: this.getDropDownList(this.state.currentFlow.welcome_words), drawerVisible: false })
460
+ }
461
+
462
+ updateSessionId = (sessionId) => {
463
+ this.setState({ sessionId });
464
+ };
465
+
466
+ getDropDownList = (welcome_words)=>{
467
+ if(isEmpty(welcome_words)){
468
+ return defaultList;
469
+ }
470
+ return welcome_words.map((question,index)=>(
471
+ {
472
+ backgroundImg:defaultList[index].backgroundImg,
473
+ title:question,
474
+ }
475
+ ))
476
+ }
477
+
478
+ render() {
479
+ const {
480
+ title,
481
+ appId: flowId,
482
+ hostUrl,
483
+ setDialogVisible,
484
+ userInfo,
485
+ boxStyle,
486
+ isShowSideRight,
487
+ isShowSideLeft = true,
488
+ tags = [],
489
+ agentUrl = aiAvatarPng,
490
+ agentName = '校园智多星',
491
+ logoWidth = '42px',
492
+ logoFontSize = '26px',
493
+ isTitleSideIcon = false,// 是否将左侧历史顶部icon移到中间顶部左侧蓝点位置
494
+ modalIndex,
495
+ isShowVoiceButton,
496
+ isShowUploadButton,
497
+ dropManUrl,
498
+ modalWidth,
499
+ isLogin = false,
500
+ isShowLogin = false,
501
+ loginBtnClick,
502
+ } = this.props;
503
+ const { sceneInfo, currentFlow = {} } = this.state;
504
+ const { flows = [], name: sceneName, character } = sceneInfo;
505
+ return (
506
+ <div style={boxStyle}>
507
+ <style dangerouslySetInnerHTML={{ __html: style }}></style>
508
+ <div style={{ position: 'absolute', top: '15px', right: '14px', zIndex: modalIndex }}>
509
+ {isFunction(setDialogVisible) &&
510
+ <img onClick={() => setDialogVisible(false)} className="p_closeImg" src={closePng}/>}
511
+ </div>
512
+ <div className="p_toolDialog" style={{borderRadius:0, backgroundImage:'url(https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/kai_yuan/yt/agent_list_bg2.png)'}}>
513
+ {
514
+ isShowSideLeft && (
515
+ <>
516
+ <img
517
+ src={icon_history}
518
+ style={{
519
+ width: '40px',
520
+ height: '40px',
521
+ position: 'absolute',
522
+ left: '0px',
523
+ top: '0px',
524
+ zIndex: 1000,
525
+ display: 'none',
526
+ }}
527
+ onClick={() => this.setState({drawerVisible: true})}
528
+ />
529
+ <Drawer
530
+ title={null}
531
+ closable={false}
532
+ placement="left"
533
+ width={'80%'}
534
+ bodyStyle={{padding: 0}}
535
+ onClose={() => this.setState({drawerVisible: false})}
536
+ open={this.state.drawerVisible}
537
+ >
538
+ <div className="drawer-history-header" style={{marginTop:0, padding: '54px 14px 14px 14px', background: 'linear-gradient( 71deg, #E1E9FF 0%, #FFFFFF 100%)', position: "relative"}}>
539
+ <img src={icon_history_headerbg} style={{position: 'absolute', right: 0, bottom: 0, width: '40%', zIndex:0}}/>
540
+ <div className="drawer-history-header-title" style={{display: 'flex', flexDirection: 'row', alignItems: 'center'}}>
541
+ <img style={{width: 35}} src={agentUrl}/>
542
+ <span style={{fontSize: 24, marginLeft: 10}}>{agentName}</span>
543
+ </div>
544
+ {/*<div className="drawer-history-header-tool" style={{display: 'flex',flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginTop: 32 }}>*/}
545
+ {/* <div*/}
546
+ {/* style={{display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', marginRight: 20, height: 44,background: '#fff', borderRadius: 5,width: '45%'}}*/}
547
+ {/* onClick={() => {this.newDialog()}}*/}
548
+ {/* >*/}
549
+ {/* <img src={icon_history_add} style={{width: '20px', height: '20px', marginRight: 10}}/>*/}
550
+ {/* <span>新建对话</span>*/}
551
+ {/* </div>*/}
552
+ {/* <div*/}
553
+ {/* style={{*/}
554
+ {/* display: 'flex',*/}
555
+ {/* flexDirection: 'row',*/}
556
+ {/* alignItems: 'center',*/}
557
+ {/* justifyContent: 'center',*/}
558
+ {/* marginRight: 20,*/}
559
+ {/* height: 44,*/}
560
+ {/* background: '#fff',*/}
561
+ {/* borderRadius: 5,*/}
562
+ {/* width: '45%',*/}
563
+ {/* zIndex: 0*/}
564
+ {/* }}*/}
565
+ {/* onClick={() => messageTip.info("敬请期待")}*/}
566
+ {/* >*/}
567
+ {/* <img src={icon_history_upload} style={{width: '20px', height: '20px', marginRight: 10}}/>*/}
568
+ {/* <span>个人知识库</span>*/}
569
+ {/* </div>*/}
570
+ {/*</div>*/}
571
+ </div>
572
+ <div
573
+ className="p_historyDialog"
574
+ style={{
575
+ height: 'calc(100% - 146px - 50px)',
576
+ boxSizing: 'border-box',
577
+ userSelect: 'none',
578
+ flex: 1,
579
+ background: 'linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%)',
580
+ borderImage: 'linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)) 1 1',
581
+ backdropFilter: 'blur(10px)',
582
+ position: 'relative',
583
+ }}
584
+ >
585
+ <div style={{display: 'flex', flexDirection: 'row', justifyContent: 'space-between'}}>
586
+ {
587
+ drawerTabs.map((item, index) => (
588
+ <div id={item.id} style={{
589
+ width:'50%',
590
+ display: 'flex',
591
+ WebkitTapHighlightColor: 'transparent',
592
+ userSelect: 'none',
593
+ WebkitUserSelect: 'none',
594
+ WebkitTouchCallout: 'none',
595
+ flexDirection: 'row',
596
+ alignItems: 'center',
597
+ justifyContent: 'center',
598
+ cursor: 'pointer',
599
+ padding: '30px 14px 15px 14px',
600
+ borderBottom: this.state.currentTabKey === item.id ? '2px solid #2850FF' : '2px solid #fff'
601
+ }}
602
+ onClick={() => this.setState({currentTabKey: item.id})}
603
+ >
604
+ <img style={{width:16, marginRight: 8}} src={this.state.currentTabKey === item.id ? item.activeIcon : item.icon} />
605
+ <div style={{fontSize:16, fontWeight: 'bold', color: this.state.currentTabKey === item.id ? '#2850FF' : '#333'}}>{item.name}</div>
606
+ </div>
607
+ ))
608
+ }
609
+ </div>
610
+ {/*专项技能*/}
611
+ {
612
+ this.state.currentTabKey === 'agent' &&
613
+ <div className="p_historyList" style={{overflowY: 'auto', height: 'calc(100% - 90px)'}}>
614
+ {flows?.map((item) => (
615
+ <div
616
+ key={item.id}
617
+ className="p_historyItem"
618
+ style={{
619
+ display: 'flex',
620
+ height: 44,
621
+ alignItems: 'center',
622
+ paddingLeft: 30,
623
+ paddingRight: 30,
624
+ fontWeight: 400,
625
+ fontSize: 14,
626
+ color: '#333',
627
+ borderRadius: 10,
628
+ marginBottom: 24,
629
+ }}
630
+ onClick={() => {
631
+ // 右侧点击一个技能,更新sessionId,切换当前flow信息,重新查询历史记录
632
+ this.setState({
633
+ sessionId: uuidv4(),
634
+ currentFlow: item,
635
+ dropDownList: this.getDropDownList(item.welcome_words),
636
+ agentDrawerVisible: false,
637
+ drawerVisible: false,
638
+ });
639
+ this.setWindowTitle(item.name)
640
+ this.getCurrentFlowHistory(item.id);
641
+ }}
642
+ >
643
+ <div
644
+ style={{
645
+ width:'100%',
646
+ display: 'flex',
647
+ flexDirection: 'row',
648
+ alignItems: 'center',
649
+ justifyContent: 'space-between',
650
+ whiteSpace: 'nowrap',
651
+ overflow: 'hidden',
652
+ textOverflow: 'ellipsis',
653
+ color: item.session_id === this.state.sessionId ? '#1551FF' : '#333',
654
+ }}
655
+ >
656
+ <div style={{display: 'flex', flexDirection: 'row', alignItems: 'center', color:'#333', fontSize:'16px', textAlign:'left', fontWeight:'bold'}}>
657
+ <img
658
+ src={item.icon}
659
+ alt={item.name}
660
+ style={{width: '36px', borderRadius:5, marginRight: 10}}
661
+ />
662
+ {item.name}
663
+ </div>
664
+
665
+ <img
666
+ src={'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/icon/icon_arrow_right.png'}
667
+ style={{ height: '5px'}}
668
+ />
669
+ </div>
670
+ </div>
671
+ ))}
672
+ </div>
673
+ }
674
+
675
+ {/*对话记录*/}
676
+ {
677
+ this.state.currentTabKey === 'history' &&
678
+ (this.state.historyList.length > 0 ? (
679
+ <div className="p_historyList" style={{overflowY: 'auto', height: 'calc(100% - 70px)'}}>
680
+ {this.state.historyList?.map((item) => (
681
+ <div
682
+ key={item.session_id}
683
+ className="p_historyItem"
684
+ style={{
685
+ display: 'flex',
686
+ height: 44,
687
+ alignItems: 'center',
688
+ paddingLeft: 30,
689
+ paddingRight: 30,
690
+ fontWeight: 400,
691
+ fontSize: 14,
692
+ color: '#333',
693
+ borderRadius: 10,
694
+ background: item.session_id === this.state.sessionId ? '#F5F5FF' : '#fff',
695
+ }}
696
+ onClick={() => {
697
+ this.setState({dropDownList: undefined, drawerVisible: false})
698
+ this.updateSessionId(item.session_id);
699
+ }}
700
+ >
701
+ <div
702
+ className={`p_historyName ${
703
+ item.session_id === this.state.sessionId ? 'p_activeHistoryName' : ''
704
+ }`}
705
+ style={{
706
+ whiteSpace: 'nowrap',
707
+ overflow: 'hidden',
708
+ textOverflow: 'ellipsis',
709
+ color: item.session_id === this.state.sessionId ? '#1551FF' : '#333',
710
+ }}
711
+ >
712
+ {item.text}
713
+ </div>
714
+ </div>
715
+ ))}
716
+ </div>
717
+ ) : (
718
+ <div className="p_historyListEmpty" style={{display: 'flex', flexDirection: 'column', alignItems: 'center', marginTop: 50}}>
719
+ <img src={historyListEmptyPng} style={{width: '100px', height: '100px', marginBottom: 20}}/>
720
+ <div className="p_historyListEmptyText" style={{fontSize: 16, color: '#999' }}>暂无对话记录</div>
721
+ </div>
722
+ ))
723
+ }
724
+ </div>
725
+ <div style={{display: 'flex', justifyContent: 'center', alignItems: 'center', marginTop: 10, marginBottom: 20}}>
726
+ {
727
+ isShowLogin &&
728
+ <div
729
+ style={{
730
+ display: 'flex',
731
+ justifyContent: 'center',
732
+ alignItems: 'center',
733
+ width: '80%',
734
+ height: 44,
735
+ color: '#fff',
736
+ background: 'linear-gradient( 30deg, #1551FF 0%, #8F4BFF 100%)',
737
+ borderRadius: 10
738
+ }}
739
+ onClick={() => {
740
+ this.setState({drawerVisible: false})
741
+ this.newDialog()
742
+ }}
743
+ >
744
+ 新建对话
745
+ </div>
746
+ }
747
+ </div>
748
+ </Drawer>
749
+ </>
750
+ )
751
+ }
752
+ <div className="p_toolRight">
753
+ <ChatWidget
754
+ input_container_style={{zIndex:2}}
755
+ chat_window_style={{paddingTop: 0}}
756
+ bot_message_style={{background: '#fff', maxWidth:'100%'}}
757
+ window_title={currentFlow?.name || title}
758
+ flow_id={currentFlow?.id || flowId}
759
+ tags={currentFlow?.keywords || tags}
760
+ host_url={hostUrl}
761
+ api_key={api_key}
762
+ session_id={this.state.sessionId}
763
+ userInfo={userInfo}
764
+ getHistoryList={this.getHistoryList}
765
+ setDropDownList={(list) => this.setState({dropDownList: list})}
766
+ dropDownList={this.state.dropDownList}
767
+ baseConfig={{isTitleSideIcon, logoWidth, agentUrl}}
768
+ isShowVoiceButton={isShowVoiceButton}
769
+ isShowUploadButton={isShowUploadButton}
770
+ dropManUrl={character || dropManUrl}
771
+ modalWidth={modalWidth}
772
+ isMobile={true}
773
+ isShowChatHeader={false}
774
+ />
775
+ </div>
776
+ {
777
+ isShowSideRight && (
778
+ <>
779
+ <Draggable onStart={() => { this.dragging = false; }}
780
+ onDrag={() => { this.dragging = true; }}
781
+ onStop={(e) => {
782
+ if (!this.dragging) {
783
+ this.setState({drawerVisible: true})
784
+ }
785
+ }}>
786
+ <img
787
+ src={icon_agents}
788
+ style={{
789
+ width: '60px',
790
+ height: '60px',
791
+ position: 'absolute',
792
+ right: '0px',
793
+ bottom: '200px',
794
+ zIndex: 1000
795
+ }}
796
+ />
797
+ </Draggable>
798
+ <Drawer
799
+ title={'专项技能'}
800
+ // closable={false}
801
+ placement="right"
802
+ width={'100%'}
803
+ style={{
804
+ backgroundImage: 'url(https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/kai_yuan/yt/agent_list_bg.png)',
805
+ backgroundSize: 'cover',
806
+ backgroundRepeat: 'no-repeat',
807
+ backgroundPosition: 'center'
808
+ }}
809
+ bodyStyle={{
810
+ padding: 0,
811
+ }}
812
+ onClose={() => this.setState({agentDrawerVisible: false})}
813
+ open={this.state.agentDrawerVisible}
814
+ >
815
+ <div
816
+ className={"p_toolRightToRight"}
817
+ style={{
818
+ width:'100%',
819
+ display:'flex',
820
+ boxSizing:'border-box',
821
+ flexDirection:'column',
822
+ padding: '1rem 1rem 1rem 1rem',
823
+ }}
824
+ >
825
+ <div
826
+ className={"rightInnerContainer"}
827
+ style={{
828
+ width:'100%',
829
+ display:'flex',
830
+ flexDirection:'row',
831
+ justifyContent:'space-between',
832
+
833
+ }}
834
+ >
835
+ <div style={{width:'100%'}}>
836
+ {/*<h3 className={"rightSideTitle"}>*/}
837
+ {/* <img width={15} src={self_skills}/>*/}
838
+ {/* <span style={{color: "#333333"}}>专项技能</span>*/}
839
+ {/*</h3>*/}
840
+ {
841
+ isEmpty(flows) ?
842
+ <Skeleton
843
+ title={false}
844
+ active
845
+ paragraph={{rows: 5, width: '100%'}}
846
+ />
847
+ :
848
+ <div className={"rightSkillContainer"} style={{width:'100%'}}>
849
+ <div
850
+ className={"rightSkillList"}
851
+ style={{
852
+ width:'100%',
853
+ display: 'grid',
854
+ gridTemplateColumns: 'repeat(2, 1fr)', /* 每行 2 列 */
855
+ gap: 20 /* 设置列和行之间的间距 */
856
+ }}>
857
+ {flows.slice(0, 12).map((item) => (
858
+ <div
859
+ key={item.id}
860
+ className={"rightSkillItem"}
861
+ style={{
862
+ display: 'flex',
863
+ flexDirection: 'column',
864
+ background: '#fff',
865
+ borderRadius: 22,
866
+ opacity: 0.7,
867
+ width:'100%',
868
+ height: '45vw',
869
+ boxSizing: 'border-box',
870
+ padding: '18px',
871
+ }}
872
+ onClick={() => {
873
+ // 右侧点击一个技能,更新sessionId,切换当前flow信息,重新查询历史记录
874
+ this.setState({
875
+ sessionId: uuidv4(),
876
+ currentFlow: item,
877
+ dropDownList: this.getDropDownList(item.welcome_words),
878
+ agentDrawerVisible: false,
879
+ });
880
+ this.setWindowTitle(item.name)
881
+ this.getCurrentFlowHistory(item.id);
882
+ }}
883
+ >
884
+ <img
885
+ src={item.icon}
886
+ alt={item.name}
887
+ style={{width: '40px', height: '40px'}}
888
+ />
889
+ <div style={{marginTop: '12px', color: '#333333', fontWeight: "bold", fontSize: '14px', textAlign: "left"}}>{item.name}</div>
890
+ <div style={{marginTop: '8px', color: '#333333', fontSize: '10px', textAlign: "left"}}>{item.content}</div>
891
+ </div>
892
+ ))}
893
+ </div>
894
+ </div>
895
+ }
896
+ </div>
897
+ {/*<div>*/}
898
+ {/* <h3 className={"rightKnowledgeTitle"}>*/}
899
+ {/* <img width={15} src={self_knowledge}/>*/}
900
+ {/* <span style={{color: "#333333"}}>个人知识库</span>*/}
901
+ {/* </h3>*/}
902
+ {/* {*/}
903
+ {/* isEmpty(currentFlow) ?*/}
904
+ {/* <Skeleton*/}
905
+ {/* title={false}*/}
906
+ {/* active*/}
907
+ {/* paragraph={{rows: 5, width: '100%'}}*/}
908
+ {/* /> :*/}
909
+ {/* <div className={"rightKnowledgeContainer"}>*/}
910
+ {/* <img src={moreBg}/>*/}
911
+ {/* <div style={{position: 'absolute', top: '40px', left: '16px'}}>*/}
912
+ {/* <div>文件总数<span style={{*/}
913
+ {/* padding: 8,*/}
914
+ {/* fontSize: '20px',*/}
915
+ {/* fontWeight: 700*/}
916
+ {/* }}>{currentFlow.k_count || 0}</span>个*/}
917
+ {/* </div>*/}
918
+ {/* <div style={{marginTop: 10}}>文件总量<span style={{*/}
919
+ {/* padding: 8,*/}
920
+ {/* fontSize: '20px',*/}
921
+ {/* fontWeight: 700*/}
922
+ {/* }}>{formatFileSize(currentFlow.k_size).formattedSize}</span>{formatFileSize(currentFlow.k_size).unit}*/}
923
+ {/* </div>*/}
924
+ {/* </div>*/}
925
+ {/* <div className={"rightMoreButton"}>*/}
926
+ {/* <div className={"rightMoreTitle"}*/}
927
+ {/* onClick={() => messageTip.info("敬请期待")}>训练你的专属知识库*/}
928
+ {/* </div>*/}
929
+ {/* </div>*/}
930
+ {/* </div>*/}
931
+ {/* }*/}
932
+ {/*</div>*/}
933
+ </div>
934
+ </div>
935
+ </Drawer>
936
+ </>
937
+ )
938
+ }
939
+ </div>
940
+ </div>
941
+ );
942
+ }
943
+ }
944
+
945
+ export default MobileChatPage;