@myun/gimi-chat 0.9.34 → 0.9.35

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 (32) hide show
  1. package/dist/apis/useApi.d.ts +24 -1
  2. package/dist/apis/useApi.js +142 -83
  3. package/dist/components/answer-item/index.js +9 -0
  4. package/dist/components/file-upload/index.js +1 -1
  5. package/dist/components/gimi-sidebar/index.module.css +1 -1
  6. package/dist/components/knowledge-trace/KnowledgeIconComponent.js +48 -19
  7. package/dist/components/knowledge-trace/classList.js +2 -4
  8. package/dist/components/knowledge-trace/config.d.ts +92 -0
  9. package/dist/components/knowledge-trace/config.js +154 -0
  10. package/dist/components/knowledge-trace/documentList.d.ts +1 -0
  11. package/dist/components/knowledge-trace/documentList.js +10 -35
  12. package/dist/components/knowledge-trace/index.d.ts +1 -1
  13. package/dist/components/knowledge-trace/index.module.css +242 -9
  14. package/dist/components/knowledge-trace/information.d.ts +7 -0
  15. package/dist/components/knowledge-trace/information.js +25 -0
  16. package/dist/components/knowledge-trace/interfaces.d.ts +2 -0
  17. package/dist/components/knowledge-trace/tryWatch.d.ts +11 -0
  18. package/dist/components/knowledge-trace/tryWatch.js +430 -0
  19. package/dist/components/knowledge-trace/videoList.d.ts +1 -0
  20. package/dist/components/knowledge-trace/videoList.js +8 -37
  21. package/dist/components/upload-list/CustomFile.js +3 -1
  22. package/dist/constants.d.ts +1 -0
  23. package/dist/constants.js +2 -1
  24. package/dist/hooks/useKnowledgeService.d.ts +2 -0
  25. package/dist/hooks/useKnowledgeService.js +70 -23
  26. package/dist/i18n/locales/en-US.d.ts +31 -0
  27. package/dist/i18n/locales/en-US.js +45 -14
  28. package/dist/i18n/locales/zh-CN.d.ts +31 -0
  29. package/dist/i18n/locales/zh-CN.js +32 -1
  30. package/dist/interfaces/knowledgeTrace.d.ts +70 -0
  31. package/dist/umd/index.min.js +1 -1
  32. package/package.json +2 -1
@@ -1,5 +1,18 @@
1
1
  import { FetchResponse } from './fetch';
2
- import { IProduct, ITeachingModuleResource, IVideoResource } from '../interfaces/knowledgeTrace';
2
+ import { IProduct, ITeachingModuleResource, IVideoResource, IInformation } from '../interfaces/knowledgeTrace';
3
+ /** 文档试看地址接口响应结果 */
4
+ export interface IDocumentTrialResult {
5
+ /** 试看地址 */
6
+ trialUrl: string;
7
+ /** 试看文件 token */
8
+ fileToken: string;
9
+ /** 文件类型(如 pdf) */
10
+ fileType: string;
11
+ /** 总页数 */
12
+ total: number;
13
+ /** 可试看页数 */
14
+ trialCount: number;
15
+ }
3
16
  export interface IUseApi {
4
17
  getSkillData: (requestId: number) => Promise<FetchResponse<any>>;
5
18
  getProductList: (params: {
@@ -15,6 +28,9 @@ export interface IUseApi {
15
28
  sliceId: string;
16
29
  }[];
17
30
  }) => Promise<FetchResponse<IVideoResource[]>>;
31
+ getInformationList: (params: {
32
+ informationIds: string[];
33
+ }) => Promise<FetchResponse<IInformation[]>>;
18
34
  getMessageTitle: (conversationId: string) => Promise<FetchResponse<any>>;
19
35
  getProbeList: (params: {
20
36
  messageId: string | number;
@@ -63,6 +79,13 @@ export interface IUseApi {
63
79
  getSearchCourseList: (query: string) => Promise<FetchResponse<any>>;
64
80
  checkProductType: (productId: number) => Promise<FetchResponse<any>>;
65
81
  getBusinessAgent: (bussinessType: number) => Promise<FetchResponse<any>>;
82
+ getVideoType: (params: {
83
+ resourceId: string;
84
+ playPlatform: string;
85
+ }) => Promise<FetchResponse<any>>;
86
+ getDocumentTrialUrl: (params: {
87
+ resourceUrl: string;
88
+ }) => Promise<FetchResponse<IDocumentTrialResult>>;
66
89
  }
67
90
  declare const useApi: (baseUrl: string, authToken: string, locale?: string) => IUseApi;
68
91
  export default useApi;
@@ -4,6 +4,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
4
4
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
5
  import { createFetch } from "./fetch";
6
6
  import { getTimeZone } from "../utils/tools";
7
+
8
+ /** 文档试看地址接口响应结果 */
9
+
7
10
  var useApi = function useApi(baseUrl, authToken) {
8
11
  var locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'zh-cn';
9
12
  var token = authToken;
@@ -250,76 +253,70 @@ var useApi = function useApi(baseUrl, authToken) {
250
253
  };
251
254
  }();
252
255
 
253
- // 创建会话
254
- var createRoomId = /*#__PURE__*/function () {
256
+ // 知识库溯源 - 信息资源
257
+ var getInformationList = /*#__PURE__*/function () {
255
258
  var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
256
259
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
257
260
  while (1) switch (_context13.prev = _context13.next) {
258
261
  case 0:
259
- return _context13.abrupt("return", fetchService.post('/mbot/web/conversation', params));
262
+ return _context13.abrupt("return", fetchService.post('/mtalksvc/api/information/info-v2', params));
260
263
  case 1:
261
264
  case "end":
262
265
  return _context13.stop();
263
266
  }
264
267
  }, _callee13);
265
268
  }));
266
- return function createRoomId(_x13) {
269
+ return function getInformationList(_x13) {
267
270
  return _ref13.apply(this, arguments);
268
271
  };
269
272
  }();
270
273
 
271
- /** 获取rtc配置 */
272
- var getRtcConfig = /*#__PURE__*/function () {
273
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
274
+ // 创建会话
275
+ var createRoomId = /*#__PURE__*/function () {
276
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
274
277
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
275
278
  while (1) switch (_context14.prev = _context14.next) {
276
279
  case 0:
277
- return _context14.abrupt("return", fetchService.post("/mbot/web/bot/rtc-config/all"));
280
+ return _context14.abrupt("return", fetchService.post('/mbot/web/conversation', params));
278
281
  case 1:
279
282
  case "end":
280
283
  return _context14.stop();
281
284
  }
282
285
  }, _callee14);
283
286
  }));
284
- return function getRtcConfig() {
287
+ return function createRoomId(_x14) {
285
288
  return _ref14.apply(this, arguments);
286
289
  };
287
290
  }();
288
291
 
289
- /** 启动语音聊天 */
290
- var startVoiceChat = /*#__PURE__*/function () {
291
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
292
- var roomId, taskId, custom;
292
+ /** 获取rtc配置 */
293
+ var getRtcConfig = /*#__PURE__*/function () {
294
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
293
295
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
294
296
  while (1) switch (_context15.prev = _context15.next) {
295
297
  case 0:
296
- roomId = params.roomId, taskId = params.taskId, custom = params.custom;
297
- return _context15.abrupt("return", fetchService.post("/mbot/web/bot/startVoiceChat", {
298
- custom: custom,
299
- roomId: roomId,
300
- taskId: taskId
301
- }));
302
- case 2:
298
+ return _context15.abrupt("return", fetchService.post("/mbot/web/bot/rtc-config/all"));
299
+ case 1:
303
300
  case "end":
304
301
  return _context15.stop();
305
302
  }
306
303
  }, _callee15);
307
304
  }));
308
- return function startVoiceChat(_x14) {
305
+ return function getRtcConfig() {
309
306
  return _ref15.apply(this, arguments);
310
307
  };
311
308
  }();
312
309
 
313
- /** 停止语音聊天 */
314
- var stopVoiceChat = /*#__PURE__*/function () {
310
+ /** 启动语音聊天 */
311
+ var startVoiceChat = /*#__PURE__*/function () {
315
312
  var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
316
- var appId, roomId, taskId;
313
+ var roomId, taskId, custom;
317
314
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
318
315
  while (1) switch (_context16.prev = _context16.next) {
319
316
  case 0:
320
- appId = params.appId, roomId = params.roomId, taskId = params.taskId;
321
- return _context16.abrupt("return", fetchService.post("/mbot/web/bot/stopVoiceChat", {
322
- appId: appId,
317
+ roomId = params.roomId, taskId = params.taskId, custom = params.custom;
318
+ return _context16.abrupt("return", fetchService.post("/mbot/web/bot/startVoiceChat", {
319
+ custom: custom,
323
320
  roomId: roomId,
324
321
  taskId: taskId
325
322
  }));
@@ -329,117 +326,121 @@ var useApi = function useApi(baseUrl, authToken) {
329
326
  }
330
327
  }, _callee16);
331
328
  }));
332
- return function stopVoiceChat(_x15) {
329
+ return function startVoiceChat(_x15) {
333
330
  return _ref16.apply(this, arguments);
334
331
  };
335
332
  }();
336
- /** 获取用户第一次使用 */
337
- var getUserFirstUse = /*#__PURE__*/function () {
338
- var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref17) {
339
- var type;
333
+
334
+ /** 停止语音聊天 */
335
+ var stopVoiceChat = /*#__PURE__*/function () {
336
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
337
+ var appId, roomId, taskId;
340
338
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
341
339
  while (1) switch (_context17.prev = _context17.next) {
342
340
  case 0:
343
- type = _ref17.type;
344
- return _context17.abrupt("return", fetchService.get("/mcourse/web/user-first-use/check-and-mark?featureType=".concat(type)));
341
+ appId = params.appId, roomId = params.roomId, taskId = params.taskId;
342
+ return _context17.abrupt("return", fetchService.post("/mbot/web/bot/stopVoiceChat", {
343
+ appId: appId,
344
+ roomId: roomId,
345
+ taskId: taskId
346
+ }));
345
347
  case 2:
346
348
  case "end":
347
349
  return _context17.stop();
348
350
  }
349
351
  }, _callee17);
350
352
  }));
351
- return function getUserFirstUse(_x16) {
352
- return _ref18.apply(this, arguments);
353
+ return function stopVoiceChat(_x16) {
354
+ return _ref17.apply(this, arguments);
353
355
  };
354
356
  }();
355
-
356
- /** 手动打断当前语音对话 */
357
- var interrupt = function interrupt(conversationId) {
358
- return fetchService.post('/mbot/api/voice/interrupt', {
359
- conversationId: conversationId
360
- });
361
- };
362
- var getCurrentReferenceVideoList = /*#__PURE__*/function () {
363
- var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
357
+ /** 获取用户第一次使用 */
358
+ var getUserFirstUse = /*#__PURE__*/function () {
359
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref18) {
360
+ var type;
364
361
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
365
362
  while (1) switch (_context18.prev = _context18.next) {
366
363
  case 0:
367
- return _context18.abrupt("return", fetchService.post('/mcourse/web/wisdomClass/quote/getCourseVideoList', params));
368
- case 1:
364
+ type = _ref18.type;
365
+ return _context18.abrupt("return", fetchService.get("/mcourse/web/user-first-use/check-and-mark?featureType=".concat(type)));
366
+ case 2:
369
367
  case "end":
370
368
  return _context18.stop();
371
369
  }
372
370
  }, _callee18);
373
371
  }));
374
- return function getCurrentReferenceVideoList(_x17) {
372
+ return function getUserFirstUse(_x17) {
375
373
  return _ref19.apply(this, arguments);
376
374
  };
377
375
  }();
378
376
 
379
- // 搜索 - 相关视频引用列表
380
- var getReferenceVideoList = /*#__PURE__*/function () {
377
+ /** 手动打断当前语音对话 */
378
+ var interrupt = function interrupt(conversationId) {
379
+ return fetchService.post('/mbot/api/voice/interrupt', {
380
+ conversationId: conversationId
381
+ });
382
+ };
383
+ var getCurrentReferenceVideoList = /*#__PURE__*/function () {
381
384
  var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
382
385
  return _regeneratorRuntime().wrap(function _callee19$(_context19) {
383
386
  while (1) switch (_context19.prev = _context19.next) {
384
387
  case 0:
385
- return _context19.abrupt("return", fetchService.post('/mcourse/web/wisdomClass/quote/getVideoList', params));
388
+ return _context19.abrupt("return", fetchService.post('/mcourse/web/wisdomClass/quote/getCourseVideoList', params));
386
389
  case 1:
387
390
  case "end":
388
391
  return _context19.stop();
389
392
  }
390
393
  }, _callee19);
391
394
  }));
392
- return function getReferenceVideoList(_x18) {
395
+ return function getCurrentReferenceVideoList(_x18) {
393
396
  return _ref20.apply(this, arguments);
394
397
  };
395
398
  }();
396
399
 
397
- // 搜索 - 课程引用列表
398
- var getReferenceCourseList = /*#__PURE__*/function () {
400
+ // 搜索 - 相关视频引用列表
401
+ var getReferenceVideoList = /*#__PURE__*/function () {
399
402
  var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
400
403
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
401
404
  while (1) switch (_context20.prev = _context20.next) {
402
405
  case 0:
403
- return _context20.abrupt("return", fetchService.post('/mcourse/web/wisdomClass/quote/getProductList', params));
406
+ return _context20.abrupt("return", fetchService.post('/mcourse/web/wisdomClass/quote/getVideoList', params));
404
407
  case 1:
405
408
  case "end":
406
409
  return _context20.stop();
407
410
  }
408
411
  }, _callee20);
409
412
  }));
410
- return function getReferenceCourseList(_x19) {
413
+ return function getReferenceVideoList(_x19) {
411
414
  return _ref21.apply(this, arguments);
412
415
  };
413
416
  }();
414
417
 
415
- // 检查消息是否可以重新生成
416
- var checkRetry = /*#__PURE__*/function () {
418
+ // 搜索 - 课程引用列表
419
+ var getReferenceCourseList = /*#__PURE__*/function () {
417
420
  var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
418
421
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
419
422
  while (1) switch (_context21.prev = _context21.next) {
420
423
  case 0:
421
- return _context21.abrupt("return", fetchService.get('/mbot/web/agent-message/retry/judge', {
422
- params: params
423
- }));
424
+ return _context21.abrupt("return", fetchService.post('/mcourse/web/wisdomClass/quote/getProductList', params));
424
425
  case 1:
425
426
  case "end":
426
427
  return _context21.stop();
427
428
  }
428
429
  }, _callee21);
429
430
  }));
430
- return function checkRetry(_x20) {
431
+ return function getReferenceCourseList(_x20) {
431
432
  return _ref22.apply(this, arguments);
432
433
  };
433
434
  }();
434
435
 
435
- // AI搜索 - 相关课程列表
436
- var getSearchCourseList = /*#__PURE__*/function () {
437
- var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(query) {
436
+ // 检查消息是否可以重新生成
437
+ var checkRetry = /*#__PURE__*/function () {
438
+ var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
438
439
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
439
440
  while (1) switch (_context22.prev = _context22.next) {
440
441
  case 0:
441
- return _context22.abrupt("return", fetchService.post('/mcourse/web/search/ai/product', {
442
- query: query
442
+ return _context22.abrupt("return", fetchService.get('/mbot/web/agent-message/retry/judge', {
443
+ params: params
443
444
  }));
444
445
  case 1:
445
446
  case "end":
@@ -447,21 +448,19 @@ var useApi = function useApi(baseUrl, authToken) {
447
448
  }
448
449
  }, _callee22);
449
450
  }));
450
- return function getSearchCourseList(_x21) {
451
+ return function checkRetry(_x21) {
451
452
  return _ref23.apply(this, arguments);
452
453
  };
453
454
  }();
454
455
 
455
- // 检查课程类型
456
- var checkProductType = /*#__PURE__*/function () {
457
- var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(productId) {
456
+ // AI搜索 - 相关课程列表
457
+ var getSearchCourseList = /*#__PURE__*/function () {
458
+ var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(query) {
458
459
  return _regeneratorRuntime().wrap(function _callee23$(_context23) {
459
460
  while (1) switch (_context23.prev = _context23.next) {
460
461
  case 0:
461
- return _context23.abrupt("return", fetchService.get('/mcourse/web/product/type', {
462
- params: {
463
- productId: productId
464
- }
462
+ return _context23.abrupt("return", fetchService.post('/mcourse/web/search/ai/product', {
463
+ query: query
465
464
  }));
466
465
  case 1:
467
466
  case "end":
@@ -469,20 +468,20 @@ var useApi = function useApi(baseUrl, authToken) {
469
468
  }
470
469
  }, _callee23);
471
470
  }));
472
- return function checkProductType(_x22) {
471
+ return function getSearchCourseList(_x22) {
473
472
  return _ref24.apply(this, arguments);
474
473
  };
475
474
  }();
476
475
 
477
- // 获取特定业务智能体
478
- var getBusinessAgent = /*#__PURE__*/function () {
479
- var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(businessType) {
476
+ // 检查课程类型
477
+ var checkProductType = /*#__PURE__*/function () {
478
+ var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(productId) {
480
479
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
481
480
  while (1) switch (_context24.prev = _context24.next) {
482
481
  case 0:
483
- return _context24.abrupt("return", fetchService.get('/mcourse/web/agent/queryByBusinessType', {
482
+ return _context24.abrupt("return", fetchService.get('/mcourse/web/product/type', {
484
483
  params: {
485
- businessType: businessType
484
+ productId: productId
486
485
  }
487
486
  }));
488
487
  case 1:
@@ -491,15 +490,73 @@ var useApi = function useApi(baseUrl, authToken) {
491
490
  }
492
491
  }, _callee24);
493
492
  }));
494
- return function getBusinessAgent(_x23) {
493
+ return function checkProductType(_x23) {
495
494
  return _ref25.apply(this, arguments);
496
495
  };
497
496
  }();
497
+
498
+ // 获取特定业务智能体
499
+ var getBusinessAgent = /*#__PURE__*/function () {
500
+ var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(businessType) {
501
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
502
+ while (1) switch (_context25.prev = _context25.next) {
503
+ case 0:
504
+ return _context25.abrupt("return", fetchService.get('/mcourse/web/agent/queryByBusinessType', {
505
+ params: {
506
+ businessType: businessType
507
+ }
508
+ }));
509
+ case 1:
510
+ case "end":
511
+ return _context25.stop();
512
+ }
513
+ }, _callee25);
514
+ }));
515
+ return function getBusinessAgent(_x24) {
516
+ return _ref26.apply(this, arguments);
517
+ };
518
+ }();
519
+ // 获取视频类型
520
+ var getVideoType = /*#__PURE__*/function () {
521
+ var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
522
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
523
+ while (1) switch (_context26.prev = _context26.next) {
524
+ case 0:
525
+ return _context26.abrupt("return", fetchService.post('/mcourse/web/vod/show', params));
526
+ case 1:
527
+ case "end":
528
+ return _context26.stop();
529
+ }
530
+ }, _callee26);
531
+ }));
532
+ return function getVideoType(_x25) {
533
+ return _ref27.apply(this, arguments);
534
+ };
535
+ }();
536
+
537
+ // 文档试看 - 获取试看地址
538
+ var getDocumentTrialUrl = /*#__PURE__*/function () {
539
+ var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
540
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
541
+ while (1) switch (_context27.prev = _context27.next) {
542
+ case 0:
543
+ return _context27.abrupt("return", fetchService.post('/mfilesvc/trial', params));
544
+ case 1:
545
+ case "end":
546
+ return _context27.stop();
547
+ }
548
+ }, _callee27);
549
+ }));
550
+ return function getDocumentTrialUrl(_x26) {
551
+ return _ref28.apply(this, arguments);
552
+ };
553
+ }();
498
554
  return {
499
555
  getSkillData: getSkillData,
500
556
  getProductList: getProductList,
501
557
  getFileResourceList: getFileResourceList,
502
558
  getVideoSliceList: getVideoSliceList,
559
+ getInformationList: getInformationList,
503
560
  getMessageTitle: getMessageTitle,
504
561
  getProbeList: getProbeList,
505
562
  getMessageList: getMessageList,
@@ -520,7 +577,9 @@ var useApi = function useApi(baseUrl, authToken) {
520
577
  interrupt: interrupt,
521
578
  getSearchCourseList: getSearchCourseList,
522
579
  checkProductType: checkProductType,
523
- getBusinessAgent: getBusinessAgent
580
+ getBusinessAgent: getBusinessAgent,
581
+ getVideoType: getVideoType,
582
+ getDocumentTrialUrl: getDocumentTrialUrl
524
583
  };
525
584
  };
526
585
  export default useApi;
@@ -134,6 +134,15 @@ var AnswerItem = function AnswerItem(_ref) {
134
134
  onCurrentTraceVideoClick: onCurrentTraceVideoClick
135
135
  });
136
136
  }
137
+ }, {
138
+ type: 'trace',
139
+ component: function component(value) {
140
+ return /*#__PURE__*/React.createElement(KnowledgeIconGroup, {
141
+ content: value.value,
142
+ messageId: item.id,
143
+ onCurrentTraceVideoClick: onCurrentTraceVideoClick
144
+ });
145
+ }
137
146
  }, {
138
147
  type: 'myunproduct',
139
148
  component: ProductTag
@@ -22,7 +22,7 @@ import { useStore } from 'react-redux';
22
22
  import { setFileList } from "../../store/slices/gimiMenuSlice";
23
23
  import { FileStatus } from "../../interfaces/fileInterface";
24
24
  import { useGimiFileUpload } from "../../hooks/useFile";
25
- var DEFAULT_ACCEPT = '.xlsx,.txt,.png,.jpg,.jpeg,.gif,.webp';
25
+ var DEFAULT_ACCEPT = '.xlsx,.txt,.png,.jpg,.jpeg,.gif,.webp,.docx,.doc';
26
26
  var MAX_RETRY_COUNT = 3;
27
27
  var IMAGE_TYPES = ['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/webp'];
28
28
  var MAX_IMAGE_COUNT = 10;
@@ -52,7 +52,7 @@
52
52
  min-width: 300px;
53
53
  background-color: white;
54
54
  flex-direction: column;
55
- padding: 10px;
55
+ padding: 10px 16px;
56
56
  border-left: 1px solid #EEEEEE;
57
57
  height: 100%;
58
58
  box-sizing: border-box;
@@ -11,7 +11,6 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import styles from "./index.module.css";
12
12
  import { knowledgeConstants } from "../../constants";
13
13
  import { useAppDispatch, useAppSelector } from "../../store/hooks";
14
- import { openSidebar } from "../../store/slices/gimiMenuSlice";
15
14
  import React, { useMemo, useState } from 'react';
16
15
  import { useTranslation } from 'react-i18next';
17
16
  import { Popover } from '@douyinfe/semi-ui';
@@ -20,6 +19,8 @@ import VideoList from "./videoList";
20
19
  import ClassList from "./classList";
21
20
  import DocumentList from "./documentList";
22
21
  import AiLoading from "../ai-loading";
22
+ import TryWatch from "./tryWatch";
23
+ import InformationList from "./information";
23
24
  var Empty = function Empty() {
24
25
  return /*#__PURE__*/React.createElement("div", {
25
26
  style: {
@@ -50,6 +51,14 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
50
51
  _useState2 = _slicedToArray(_useState, 2),
51
52
  showPanel = _useState2[0],
52
53
  setShowPanel = _useState2[1];
54
+ var _useState3 = useState(false),
55
+ _useState4 = _slicedToArray(_useState3, 2),
56
+ tryWatchVisible = _useState4[0],
57
+ setTryWatchVisible = _useState4[1];
58
+ var _useState5 = useState(),
59
+ _useState6 = _slicedToArray(_useState5, 2),
60
+ curTrace = _useState6[0],
61
+ setCurTrace = _useState6[1];
53
62
  var _useTranslation2 = useTranslation(),
54
63
  t = _useTranslation2.t;
55
64
  var dispatch = useAppDispatch();
@@ -62,7 +71,7 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
62
71
  return state.gimiMenu.isMsgRecieving;
63
72
  });
64
73
  var isLastMessage = lastMessageId !== undefined && lastMessageId === messageId;
65
- var iconUrl = type === 'video' ? knowledgeConstants.VIDEO_ICON_KNOWLADGE_TRACE_ADDRESS : type === 'document' ? knowledgeConstants.DOCUMENT_ICON_ADDRESS : knowledgeConstants.CLASS_ICON_ADDRESS;
74
+ var iconUrl = type === 'video' ? knowledgeConstants.VIDEO_ICON_KNOWLADGE_TRACE_ADDRESS : type === 'document' ? knowledgeConstants.DOCUMENT_ICON_ADDRESS : type === "information" ? knowledgeConstants.INFORMATION_ICON_ADRESS : knowledgeConstants.CLASS_ICON_ADDRESS;
66
75
  var kowledgeTrace = {
67
76
  type: type,
68
77
  resources: resources || []
@@ -74,7 +83,14 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
74
83
  videoSliceList = _useKnowledgeService.videoSliceList,
75
84
  documentList = _useKnowledgeService.documentList,
76
85
  productList = _useKnowledgeService.productList,
86
+ informationList = _useKnowledgeService.informationList,
77
87
  isLoading = _useKnowledgeService.isLoading;
88
+ var handleCurrentTrace = React.useCallback(function (trace) {
89
+ if (trace.isDelete === 1) return;
90
+ setShowPanel(false);
91
+ setCurTrace(trace);
92
+ setTryWatchVisible(true);
93
+ }, [setCurTrace]);
78
94
  var hoverPanelContent = useMemo(function () {
79
95
  if (isLoading) return /*#__PURE__*/React.createElement("div", {
80
96
  style: {
@@ -86,6 +102,7 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
86
102
  return videoSliceList !== null && videoSliceList !== void 0 && videoSliceList.length ? /*#__PURE__*/React.createElement(VideoList, {
87
103
  list: videoSliceList,
88
104
  hiddenTitle: true,
105
+ handleCurrentTrace: handleCurrentTrace,
89
106
  onCurrentTraceVideoClick: onCurrentTraceVideoClick
90
107
  }) : /*#__PURE__*/React.createElement(Empty, null);
91
108
  case 'product':
@@ -96,36 +113,40 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
96
113
  case 'document':
97
114
  return documentList !== null && documentList !== void 0 && documentList.length ? /*#__PURE__*/React.createElement(DocumentList, {
98
115
  list: documentList,
99
- hiddenTitle: true
116
+ hiddenTitle: true,
117
+ handleCurrentTrace: handleCurrentTrace
118
+ }) : /*#__PURE__*/React.createElement(Empty, null);
119
+ case "information":
120
+ return informationList !== null && informationList !== void 0 && informationList.length ? /*#__PURE__*/React.createElement(InformationList, {
121
+ list: informationList,
122
+ handleCurrentTrace: handleCurrentTrace
100
123
  }) : /*#__PURE__*/React.createElement(Empty, null);
101
124
  default:
102
125
  return null;
103
126
  }
104
- }, [showPanel, videoSliceList, productList, documentList, isLoading]);
127
+ }, [showPanel, videoSliceList, productList, informationList, isLoading]);
105
128
  var onVisibleChange = React.useCallback(function (visible) {
106
129
  setShowPanel(visible);
107
130
  }, []);
108
131
  var handleIconClick = React.useCallback(function () {
109
132
  // 先不要了
110
133
  return;
111
- if (isMsgRecieving && isLastMessage) return; // 最新一条正在流式输出的消息,不打开溯源面板
112
- dispatch(openSidebar({
113
- type: 'knowledgeTrace',
114
- data: {
115
- knowledgeTrace: {
116
- type: type,
117
- resources: resources,
118
- messageId: messageId
119
- }
120
- }
121
- }));
134
+
135
+ // if (isMsgRecieving && isLastMessage) return; // 最新一条正在流式输出的消息,不打开溯源面板
136
+ // dispatch(openSidebar({
137
+ // type: 'knowledgeTrace',
138
+ // data: {
139
+ // knowledgeTrace: { type, resources, messageId }
140
+ // }
141
+ // }));
122
142
  }, [isMsgRecieving, isLastMessage, dispatch, messageId, resources, type]);
123
- return /*#__PURE__*/React.createElement(Popover, {
143
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Popover, {
124
144
  content: /*#__PURE__*/React.createElement(React.Fragment, null, hoverPanelContent),
125
145
  visible: showPanel,
126
146
  onVisibleChange: onVisibleChange,
127
147
  className: "knowledgeHoverPanel",
128
- position: "bottomLeft"
148
+ position: "bottomLeft",
149
+ trigger: "click"
129
150
  }, /*#__PURE__*/React.createElement("div", {
130
151
  className: styles.icon_btn,
131
152
  onClick: handleIconClick
@@ -133,8 +154,16 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
133
154
  url: iconUrl
134
155
  }), /*#__PURE__*/React.createElement("span", null, t('trace.countByType', {
135
156
  count: resources === null || resources === void 0 ? void 0 : resources.length,
136
- type: type === 'video' ? t('knowledgeTrace.type.video') : type === 'product' ? t('knowledgeTrace.type.course') : t('knowledgeTrace.type.document')
137
- }))));
157
+ type: type === 'video' ? t('knowledgeTrace.type.video') : type === 'product' ? t('knowledgeTrace.type.course') : type === "information" ? t('knowledgeTrace.type.information') : t('knowledgeTrace.type.document')
158
+ })))), /*#__PURE__*/React.createElement(TryWatch, {
159
+ item: curTrace,
160
+ type: type,
161
+ visible: tryWatchVisible,
162
+ onCancel: function onCancel() {
163
+ return setTryWatchVisible(false);
164
+ },
165
+ onCurrentTraceVideoClick: onCurrentTraceVideoClick
166
+ }));
138
167
  };
139
168
  var KnowledgeIconGroup = function KnowledgeIconGroup(_ref3) {
140
169
  var content = _ref3.content,
@@ -2,7 +2,7 @@ import styles from "./index.module.css";
2
2
  import classNames from 'classnames';
3
3
  import React from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
- import { Toast, Tooltip } from '@douyinfe/semi-ui';
5
+ import { Toast } from '@douyinfe/semi-ui';
6
6
  import { useAppSelector } from "../../store/hooks";
7
7
  var ClassItem = function ClassItem(_ref) {
8
8
  var _konwledgeTraceState$, _item$name;
@@ -53,9 +53,7 @@ var ClassItem = function ClassItem(_ref) {
53
53
  className: styles.class_description
54
54
  }, /*#__PURE__*/React.createElement("div", {
55
55
  className: styles.text
56
- }, tagContent, /*#__PURE__*/React.createElement(Tooltip, {
57
- content: item.name
58
- }, ((_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name.length) > 33 ? "".concat(item.name.substring(0, 33), "...") : item.name || '')), item.isDelete === 1 && /*#__PURE__*/React.createElement("div", {
56
+ }, tagContent, ((_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name.length) > 33 ? "".concat(item.name.substring(0, 33), "...") : item.name || ''), item.isDelete === 1 && /*#__PURE__*/React.createElement("div", {
59
57
  className: styles.knowledge_trace_deactive
60
58
  }, t('trace.course.invalid'))));
61
59
  };