@myun/gimi-chat 0.3.7 → 0.3.9

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.
@@ -296,6 +296,12 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
296
296
  }))
297
297
  });
298
298
  }, [props.enableVoiceChat, props.enableVoiceRecord, props.disabled, props.disableVoiceCommunication, props.isVoiceGetting, isMsgRecieving, openChatCommunication, props.shortAsrClick, agentObj === null || agentObj === void 0 ? void 0 : agentObj.isEnableVoiceCall]);
299
+ var renderQuotedContent = React.useMemo(function () {
300
+ if (!props.enableSourceQuote) {
301
+ return null;
302
+ }
303
+ return /*#__PURE__*/React.createElement(QuotedContent, null);
304
+ }, [props.enableSourceQuote]);
299
305
  var renderActionArea = React.useCallback(function (renderProps) {
300
306
  return /*#__PURE__*/React.createElement("div", {
301
307
  className: renderProps.className,
@@ -305,13 +311,13 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
305
311
  display: 'flex',
306
312
  alignItems: 'center'
307
313
  }
308
- }, props.enableSourceQuote && /*#__PURE__*/React.createElement(QuotedContent, null), VoiceTools, UploadFileTool, /*#__PURE__*/React.createElement(Divider, {
314
+ }, renderQuotedContent, VoiceTools, UploadFileTool, /*#__PURE__*/React.createElement(Divider, {
309
315
  layout: "vertical",
310
316
  style: {
311
317
  marginLeft: 8
312
318
  }
313
319
  })), renderProps.menuItem);
314
- }, [VoiceTools, UploadFileTool, props.enableSourceQuote]);
320
+ }, [VoiceTools, UploadFileTool, renderQuotedContent]);
315
321
  var onMessageSend = React.useCallback(function (content) {
316
322
  var _props$onSend;
317
323
  var inputContents = content.inputContents || [];
@@ -48,4 +48,46 @@
48
48
  margin: 0px 10px 10px 10px;
49
49
  padding: 16px;
50
50
  max-width: 800px;
51
+ max-height: 400px;
52
+ overflow-y: auto;
53
+ scrollbar-width: thin;
54
+ scrollbar-color: #d1d1d1 transparent;
55
+ }
56
+ .chatInput::-webkit-scrollbar {
57
+ width: 4px;
58
+ }
59
+ .chatInput::-webkit-scrollbar-thumb {
60
+ background-color: #d1d1d1;
61
+ border-radius: 2px;
62
+ border: none;
63
+ }
64
+ .chatInput::-webkit-scrollbar-track {
65
+ background-color: transparent;
66
+ border: none;
67
+ }
68
+
69
+ .reference {
70
+ max-height: 180px;
71
+ overflow: auto;
72
+ flex: 1;
73
+ scrollbar-width: thin;
74
+ scrollbar-color: #d1d1d1 transparent;
75
+ }
76
+ .reference::-webkit-scrollbar {
77
+ width: 4px;
78
+ }
79
+ .reference::-webkit-scrollbar-thumb {
80
+ background-color: #d1d1d1;
81
+ border-radius: 2px;
82
+ border: none;
83
+ }
84
+ .reference::-webkit-scrollbar-track {
85
+ background-color: transparent;
86
+ border: none;
87
+ }
88
+ .reference .references {
89
+ display: flex;
90
+ flex-wrap: wrap;
91
+ align-items: center;
92
+ padding-top: 5px;
51
93
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  declare const FileCardSideBar: (props: {
3
- targetElement?: HTMLElement;
3
+ sidebarTargetElm?: HTMLElement;
4
4
  isOverFlow: boolean;
5
5
  className?: string;
6
6
  style?: React.CSSProperties;
@@ -7,7 +7,7 @@ import ReactDOM from 'react-dom';
7
7
  import styles from "./index.module.css";
8
8
  import { FileCard } from ".";
9
9
  var FileCardSideBar = function FileCardSideBar(props) {
10
- var targetElement = props.targetElement,
10
+ var sidebarTargetElm = props.sidebarTargetElm,
11
11
  isOverFlow = props.isOverFlow,
12
12
  className = props.className,
13
13
  style = props.style;
@@ -48,7 +48,7 @@ var FileCardSideBar = function FileCardSideBar(props) {
48
48
  })));
49
49
  };
50
50
  if (isOverFlow) {
51
- var targetElm = targetElement || document.getElementById('myun_gimi_design_chat');
51
+ var targetElm = sidebarTargetElm || document.getElementById('myun_gimi_design_chat');
52
52
  if (!targetElm) return null;
53
53
  return /*#__PURE__*/ReactDOM.createPortal(renderContent(), targetElm);
54
54
  }
@@ -1,6 +1,7 @@
1
1
  .overflow_layout {
2
2
  position: absolute;
3
3
  right: 0;
4
+ top: 0;
4
5
  z-index: 10;
5
6
  height: 100%;
6
7
  box-shadow: -1px 0 10px 0 rgb(233, 235, 242);
@@ -9,10 +9,11 @@ export interface KonwledgeTraceState {
9
9
  messageId: number;
10
10
  }
11
11
  declare const KonwledgeTrace: React.FC<{
12
- targetElement?: HTMLElement;
12
+ sidebarTargetElm?: HTMLElement;
13
13
  chatList: any[];
14
14
  isOverFlow: boolean;
15
15
  className?: string;
16
16
  style?: React.CSSProperties;
17
+ onCurrentTraceVideoClick?: (time?: string) => void;
17
18
  }>;
18
19
  export default KonwledgeTrace;
@@ -18,11 +18,12 @@ import AiLoading from "../ai-loading";
18
18
  import ReactDOM from 'react-dom';
19
19
  import GimiSideBar from "../gimi-sidebar";
20
20
  var KonwledgeTrace = function KonwledgeTrace(_ref) {
21
- var targetElement = _ref.targetElement,
21
+ var sidebarTargetElm = _ref.sidebarTargetElm,
22
22
  chatList = _ref.chatList,
23
23
  isOverFlow = _ref.isOverFlow,
24
24
  className = _ref.className,
25
- style = _ref.style;
25
+ style = _ref.style,
26
+ onCurrentTraceVideoClick = _ref.onCurrentTraceVideoClick;
26
27
  var showKonwledgeTrace = useAppSelector(function (state) {
27
28
  return state.gimiMenu.showKonwledgeTrace;
28
29
  });
@@ -107,7 +108,8 @@ var KonwledgeTrace = function KonwledgeTrace(_ref) {
107
108
  switch (activeKey) {
108
109
  case 'video':
109
110
  return /*#__PURE__*/React.createElement(VideoList, {
110
- list: videoSliceList
111
+ list: videoSliceList,
112
+ onCurrentTraceVideoClick: onCurrentTraceVideoClick
111
113
  });
112
114
  case 'product':
113
115
  return /*#__PURE__*/React.createElement(ClassList, {
@@ -146,7 +148,7 @@ var KonwledgeTrace = function KonwledgeTrace(_ref) {
146
148
  })) : tabContent));
147
149
  };
148
150
  if (isOverFlow && (kowledgeTraceList === null || kowledgeTraceList === void 0 ? void 0 : kowledgeTraceList.length) > 0) {
149
- var targetElm = targetElement || document.getElementById('myun_gimi_design_chat');
151
+ var targetElm = sidebarTargetElm || document.getElementById('myun_gimi_design_chat');
150
152
  if (!targetElm) return null;
151
153
  return /*#__PURE__*/ReactDOM.createPortal(renderContent(), targetElm);
152
154
  }
@@ -2,5 +2,6 @@ import React from 'react';
2
2
  import type { IVideoResource } from './interfaces';
3
3
  declare const VideoList: React.FC<{
4
4
  list: IVideoResource[];
5
+ onCurrentTraceVideoClick?: (time?: string) => void;
5
6
  }>;
6
7
  export default VideoList;
@@ -3,10 +3,11 @@ import styles from "./index.module.css";
3
3
  import classNames from 'classnames';
4
4
  import { knowledgeConstants } from "../../constants";
5
5
  import { Toast, Tooltip } from '@douyinfe/semi-ui';
6
- import { useAppSelector, useAppDispatch } from "../../store/hooks";
6
+ import { useAppSelector } from "../../store/hooks";
7
7
  var VideoItem = function VideoItem(_ref) {
8
8
  var _konwledgeTraceState$;
9
- var item = _ref.item;
9
+ var item = _ref.item,
10
+ onClick = _ref.onClick;
10
11
  var konwledgeTraceState = useAppSelector(function (state) {
11
12
  return state.gimiMenu.konwledgeTraceState;
12
13
  });
@@ -21,7 +22,6 @@ var VideoItem = function VideoItem(_ref) {
21
22
  }),
22
23
  gradeId = _useAppSelector.gradeId,
23
24
  teachModuleId = _useAppSelector.teachModuleId;
24
- var dispatch = useAppDispatch();
25
25
  var handleClick = function handleClick() {
26
26
  if (item.isDelete === 1) return;
27
27
  if (platform !== 'myun') return Toast.warning('当前平台不支持溯源跳转');
@@ -29,12 +29,7 @@ var VideoItem = function VideoItem(_ref) {
29
29
  if (item.isJoinClass) {
30
30
  // 如果溯源就是当前视频,直接跳转到溯源的进度
31
31
  if (gradeId === item.gradeId && teachModuleId === item.id) {
32
- dispatch({
33
- type: 'smartClassState/setTimeFromSider',
34
- payload: {
35
- timeFromSider: item.startedAtSecond
36
- }
37
- });
32
+ onClick === null || onClick === void 0 || onClick(item.startedAtSecond);
38
33
  } else {
39
34
  // 如果不是当前视频,新开一个学习页面
40
35
  window.open("/learningPage?".concat(searchParams, "&startedAt=").concat(item.startedAtSecond));
@@ -76,7 +71,8 @@ var VideoItem = function VideoItem(_ref) {
76
71
  }, "\u89C6\u9891\u5931\u6548")));
77
72
  };
78
73
  var VideoList = function VideoList(_ref2) {
79
- var list = _ref2.list;
74
+ var list = _ref2.list,
75
+ onCurrentTraceVideoClick = _ref2.onCurrentTraceVideoClick;
80
76
  return /*#__PURE__*/React.createElement("div", {
81
77
  className: styles.knowledgeList
82
78
  }, /*#__PURE__*/React.createElement("span", {
@@ -84,7 +80,8 @@ var VideoList = function VideoList(_ref2) {
84
80
  }, "\u672C\u5BF9\u8BDD\u5171".concat((list === null || list === void 0 ? void 0 : list.length) || 0, "\u4E2A\u89C6\u9891")), list.map(function (item) {
85
81
  return /*#__PURE__*/React.createElement(VideoItem, {
86
82
  item: item,
87
- key: item.id
83
+ key: item.id,
84
+ onClick: onCurrentTraceVideoClick
88
85
  });
89
86
  }));
90
87
  };
@@ -14,7 +14,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
14
14
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
15
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
- import { Input, Toast, Table, Popover, Space } from '@douyinfe/semi-ui';
17
+ import { Input, Toast, Table, Popover, Tooltip } from '@douyinfe/semi-ui';
18
18
  import styles from "./index.module.css";
19
19
  import { useCallback, useRef, useState } from 'react';
20
20
  import IconFontCom from "../iconfont-com";
@@ -74,6 +74,7 @@ var QuotedContent = function QuotedContent() {
74
74
  title: '名称',
75
75
  dataIndex: 'name',
76
76
  key: 'name',
77
+ width: '100%',
77
78
  render: function render(text) {
78
79
  return /*#__PURE__*/React.createElement("span", {
79
80
  className: styles.listItem
@@ -82,7 +83,8 @@ var QuotedContent = function QuotedContent() {
82
83
  className: styles.img,
83
84
  src: activeKey === 'video' ? knowledgeConstants.VIDEO_ICON_ADDRESS : knowledgeConstants.CLASS_ICON_BIG_ADDRESS
84
85
  }), /*#__PURE__*/React.createElement("span", {
85
- className: styles.text
86
+ className: styles.text,
87
+ title: text
86
88
  }, text));
87
89
  }
88
90
  }];
@@ -206,12 +208,8 @@ var QuotedContent = function QuotedContent() {
206
208
  return /*#__PURE__*/React.createElement("div", {
207
209
  style: {
208
210
  padding: 12,
209
- width: 300
210
- }
211
- }, /*#__PURE__*/React.createElement(Space, {
212
- style: {
213
- width: '100%',
214
- height: '100%'
211
+ width: 380,
212
+ position: 'relative'
215
213
  }
216
214
  }, /*#__PURE__*/React.createElement("div", {
217
215
  className: styles.quotedContent
@@ -260,22 +258,28 @@ var QuotedContent = function QuotedContent() {
260
258
  }
261
259
  };
262
260
  }
263
- }))))));
261
+ })))));
264
262
  };
265
263
  return /*#__PURE__*/React.createElement(Popover, {
266
264
  visible: showmodel,
267
265
  content: renderContent,
268
266
  trigger: "custom",
269
267
  stopPropagation: true,
270
- onClickOutSide: handleClose
268
+ onClickOutSide: handleClose,
269
+ position: "bottomLeft",
270
+ spacing: 6
271
271
  }, /*#__PURE__*/React.createElement("div", {
272
272
  className: "".concat(styles.quotationIcon, " ").concat(showmodel && styles.isActive),
273
273
  onClick: function onClick() {
274
274
  return setShowmodel(true);
275
275
  }
276
+ }, /*#__PURE__*/React.createElement(Tooltip, {
277
+ content: "\u5F15\u7528\u8BFE\u7A0B",
278
+ position: "top",
279
+ visible: showmodel ? false : undefined
276
280
  }, /*#__PURE__*/React.createElement("img", {
277
281
  src: showmodel ? isActiveQuotoIcon : quotoIcon,
278
282
  alt: ""
279
- })));
283
+ }))));
280
284
  };
281
285
  export default QuotedContent;
@@ -4,6 +4,8 @@
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
  height: 100%;
7
+ width: 100%;
8
+ overflow: hidden;
7
9
  }
8
10
 
9
11
  .searchInput {
@@ -11,6 +13,7 @@
11
13
  font-size: 12px;
12
14
  padding: 0 10px;
13
15
  border-radius: 8px;
16
+ width: 100%;
14
17
  }
15
18
  .searchInput input::placeholder {
16
19
  color: #7d91b3;
@@ -18,18 +21,25 @@
18
21
 
19
22
  .content {
20
23
  padding-top: 10px;
24
+ width: 100%;
25
+ overflow: hidden;
21
26
  }
22
27
 
23
28
  .newtab {
24
29
  padding-bottom: 10px;
30
+ width: 100%;
31
+ display: flex;
32
+ flex-wrap: nowrap;
33
+ overflow-x: auto;
25
34
  }
26
35
 
27
36
  .tabItem {
28
37
  font-size: 14px;
29
38
  padding: 5px 10px;
30
- margin: 0 8px;
39
+ margin-right: 16px;
31
40
  border-radius: 8px;
32
41
  cursor: pointer;
42
+ flex-shrink: 0;
33
43
  }
34
44
  .tabItem:hover {
35
45
  background-color: #f7f7fc;
@@ -45,29 +55,35 @@
45
55
  .tabContent {
46
56
  overflow: auto;
47
57
  height: 200px;
58
+ width: 100%;
48
59
  }
49
60
  .tabContent .table {
50
61
  table-layout: fixed;
51
- }
52
- .tabContent .table :global(.semi-table-row-cell) span {
53
- width: 270px;
62
+ width: 100%;
54
63
  }
55
64
  .tabContent .table :global(.semi-table-row-cell) {
56
65
  font-size: 12px;
57
66
  border: none !important;
58
- white-space: nowrap;
67
+ padding: 8px 0;
59
68
  overflow: hidden;
60
69
  text-overflow: ellipsis;
70
+ white-space: nowrap;
71
+ max-width: 0;
72
+ }
73
+ .tabContent .table :global(.semi-table-tbody .semi-table-row) {
74
+ width: 100%;
61
75
  }
62
76
  .tabContent .table .listItem {
63
77
  display: flex;
64
78
  align-items: center;
65
79
  cursor: pointer;
66
80
  width: 100%;
81
+ overflow: hidden;
82
+ min-width: 0;
67
83
  }
68
84
  .tabContent .table .listItem .img {
69
85
  width: 16px;
70
- margin-right: 5px;
86
+ margin-right: 8px;
71
87
  flex-shrink: 0;
72
88
  }
73
89
  .tabContent .table .listItem .text {
@@ -75,6 +91,7 @@
75
91
  overflow: hidden;
76
92
  text-overflow: ellipsis;
77
93
  white-space: nowrap;
94
+ min-width: 0;
78
95
  }
79
96
 
80
97
  .tabContent::-webkit-scrollbar {
@@ -4,7 +4,6 @@
4
4
  height: 100%;
5
5
  display: flex;
6
6
  gap: 20px;
7
- overflow: hidden;
8
7
  position: relative;
9
8
  }
10
9
 
@@ -133,6 +133,7 @@ export interface CommonChatProps {
133
133
  model?: 'sidebar' | 'fullscreen';
134
134
  sidebarConfig?: {
135
135
  sidebarTargetElm?: HTMLElement;
136
+ onCurrentTraceVideoClick?: (time?: string) => void;
136
137
  className?: string;
137
138
  style?: React.CSSProperties;
138
139
  }