@myun/gimi-chat 0.3.8 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,12 @@ interface IAIInputProps {
32
32
  showDefaultPrompt?: boolean;
33
33
  onConversationCreated?: (conversationId: number) => void;
34
34
  onMicHangUp?: () => void;
35
+ initQuoteSource?: {
36
+ teachModelId: number;
37
+ teachModelName: string;
38
+ type?: string;
39
+ duration: number;
40
+ };
35
41
  }
36
42
  declare const ChatInput: React.ForwardRefExoticComponent<IAIInputProps & React.RefAttributes<ChatInputRef>>;
37
43
  export default ChatInput;
@@ -300,8 +300,10 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
300
300
  if (!props.enableSourceQuote) {
301
301
  return null;
302
302
  }
303
- return /*#__PURE__*/React.createElement(QuotedContent, null);
304
- }, [props.enableSourceQuote]);
303
+ return /*#__PURE__*/React.createElement(QuotedContent, {
304
+ initQuoteSource: props.initQuoteSource
305
+ });
306
+ }, [props.enableSourceQuote, props.initQuoteSource]);
305
307
  var renderActionArea = React.useCallback(function (renderProps) {
306
308
  return /*#__PURE__*/React.createElement("div", {
307
309
  className: renderProps.className,
@@ -2,7 +2,11 @@
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
5
- width: 100%;
5
+ width: calc(100% - 32px);
6
+ max-width: 800px;
7
+ margin: 0px 16px 10px 16px;
8
+ box-shadow: inset 0 2px #fff, 0 2px 10px rgba(84, 105, 140, 0.15);
9
+ border-radius: 10px;
6
10
  }
7
11
 
8
12
  .deepthink {
@@ -44,8 +48,6 @@
44
48
 
45
49
  .chatInput {
46
50
  width: 100%;
47
- box-shadow: inset 0 2px #fff, 0 2px 10px rgba(84, 105, 140, 0.15);
48
- margin: 0px 10px 10px 10px;
49
51
  padding: 16px;
50
52
  max-width: 800px;
51
53
  max-height: 400px;
@@ -14,5 +14,6 @@ declare const KonwledgeTrace: React.FC<{
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;
@@ -22,7 +22,8 @@ var KonwledgeTrace = function KonwledgeTrace(_ref) {
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, {
@@ -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
  };
@@ -16,7 +16,7 @@
16
16
  max-width: var(--container-max);
17
17
  margin: 0 auto;
18
18
  box-sizing: border-box;
19
- padding: 0 10px;
19
+ padding: 0 16px;
20
20
  }
21
21
  .main .small_container {
22
22
  width: min(100%, var(--container-max));
@@ -3,7 +3,7 @@
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  align-items: start;
6
- padding: 14px 0px 20px 10px;
6
+ padding: 4px 16px 20px 16px;
7
7
  width: 100%;
8
8
  max-width: 800px;
9
9
  margin: 0 auto;
@@ -1,3 +1,10 @@
1
1
  import React from 'react';
2
- declare const QuotedContent: React.FC;
2
+ declare const QuotedContent: React.FC<{
3
+ initQuoteSource?: {
4
+ teachModelId: number;
5
+ teachModelName: string;
6
+ type?: string;
7
+ duration: number;
8
+ };
9
+ }>;
3
10
  export default QuotedContent;
@@ -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, Tooltip } from '@douyinfe/semi-ui';
17
+ import { Input, Toast, Table, Popover, Tooltip, Divider } 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";
@@ -24,6 +24,7 @@ import { useAppSelector, useAppDispatch } from "../../store/hooks";
24
24
  import { setQuoteProductList, setQuoteTeachModelList } from "../../store/slices/gimiMenuSlice";
25
25
  import { throttle } from 'lodash';
26
26
  import React from 'react';
27
+ import classNames from 'classnames';
27
28
  var DEBOUNCE_MS = 600; // 拉长到 600 ms
28
29
 
29
30
  var tabList = [{
@@ -34,7 +35,8 @@ var tabList = [{
34
35
  ];
35
36
  var quotoIcon = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202601/30/be6d9_20260130135139.png';
36
37
  var isActiveQuotoIcon = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202601/30/8e64c_20260130135037.png';
37
- var QuotedContent = function QuotedContent() {
38
+ var QuotedContent = function QuotedContent(_ref) {
39
+ var initQuoteSource = _ref.initQuoteSource;
38
40
  var _useState = useState('video'),
39
41
  _useState2 = _slicedToArray(_useState, 2),
40
42
  activeKey = _useState2[0],
@@ -184,6 +186,14 @@ var QuotedContent = function QuotedContent() {
184
186
  }
185
187
  handleClose();
186
188
  };
189
+ var handleCurrentVideoClick = function handleCurrentVideoClick() {
190
+ var record = {
191
+ id: initQuoteSource === null || initQuoteSource === void 0 ? void 0 : initQuoteSource.teachModelId,
192
+ name: initQuoteSource === null || initQuoteSource === void 0 ? void 0 : initQuoteSource.teachModelName,
193
+ duration: initQuoteSource === null || initQuoteSource === void 0 ? void 0 : initQuoteSource.duration
194
+ };
195
+ handleSelect(record);
196
+ };
187
197
 
188
198
  // 滚动加载更多
189
199
  var throttledScroll = useCallback(throttle(function (scrollTop, scrollHeight, clientHeight) {
@@ -232,12 +242,30 @@ var QuotedContent = function QuotedContent() {
232
242
  className: styles.newtab
233
243
  }, tabList.map(function (tab) {
234
244
  return /*#__PURE__*/React.createElement("span", {
235
- className: "".concat(styles.tabItem, " ").concat(tab.key === activeKey ? styles.active : ''),
245
+ className: classNames(styles.tabItem, tab.key === activeKey ? styles.active : ''),
236
246
  key: tab.key,
237
247
  onClick: function onClick() {
238
248
  return handleTabChange(tab.key);
239
249
  }
240
250
  }, tab.displayName);
251
+ })), initQuoteSource && /*#__PURE__*/React.createElement("div", {
252
+ className: styles.current_video
253
+ }, /*#__PURE__*/React.createElement("span", {
254
+ className: styles.text
255
+ }, "\u5F53\u524D\u89C6\u9891"), /*#__PURE__*/React.createElement("span", {
256
+ className: styles.currentItem,
257
+ onClick: handleCurrentVideoClick
258
+ }, /*#__PURE__*/React.createElement("img", {
259
+ alt: "\u8D44\u6599\u5F15\u7528\u56FE\u7247",
260
+ className: styles.img,
261
+ src: knowledgeConstants.VIDEO_ICON_ADDRESS
262
+ }), /*#__PURE__*/React.createElement("span", {
263
+ className: styles.name,
264
+ title: initQuoteSource === null || initQuoteSource === void 0 ? void 0 : initQuoteSource.teachModelName
265
+ }, initQuoteSource === null || initQuoteSource === void 0 ? void 0 : initQuoteSource.teachModelName)), /*#__PURE__*/React.createElement(Divider, {
266
+ style: {
267
+ margin: '0px 5px'
268
+ }
241
269
  })), /*#__PURE__*/React.createElement("div", {
242
270
  className: styles.tabContent,
243
271
  ref: tabContentRef,
@@ -13,7 +13,8 @@
13
13
  font-size: 12px;
14
14
  padding: 0 10px;
15
15
  border-radius: 8px;
16
- width: 100%;
16
+ margin-left: 5px;
17
+ width: calc(100% - 10px);
17
18
  }
18
19
  .searchInput input::placeholder {
19
20
  color: #7d91b3;
@@ -26,14 +27,14 @@
26
27
  }
27
28
 
28
29
  .newtab {
30
+ padding-left: 5px;
29
31
  padding-bottom: 10px;
30
32
  width: 100%;
31
33
  display: flex;
32
34
  flex-wrap: nowrap;
33
35
  overflow-x: auto;
34
36
  }
35
-
36
- .tabItem {
37
+ .newtab .tabItem {
37
38
  font-size: 14px;
38
39
  padding: 5px 10px;
39
40
  margin-right: 16px;
@@ -41,12 +42,11 @@
41
42
  cursor: pointer;
42
43
  flex-shrink: 0;
43
44
  }
44
- .tabItem:hover {
45
+ .newtab .tabItem:hover {
45
46
  background-color: #f7f7fc;
46
47
  color: #4086ff;
47
48
  }
48
-
49
- .active {
49
+ .newtab .active {
50
50
  background-color: #f7f7fc;
51
51
  color: #4086ff;
52
52
  font-weight: 600;
@@ -64,7 +64,7 @@
64
64
  .tabContent .table :global(.semi-table-row-cell) {
65
65
  font-size: 12px;
66
66
  border: none !important;
67
- padding: 8px 0;
67
+ padding: 0 !important;
68
68
  overflow: hidden;
69
69
  text-overflow: ellipsis;
70
70
  white-space: nowrap;
@@ -73,20 +73,27 @@
73
73
  .tabContent .table :global(.semi-table-tbody .semi-table-row) {
74
74
  width: 100%;
75
75
  }
76
- .tabContent .table .listItem {
76
+
77
+ .listItem {
77
78
  display: flex;
78
79
  align-items: center;
79
80
  cursor: pointer;
80
81
  width: 100%;
81
82
  overflow: hidden;
82
83
  min-width: 0;
84
+ font-size: 12px;
85
+ padding: 8px;
83
86
  }
84
- .tabContent .table .listItem .img {
87
+ .listItem:hover {
88
+ background-color: #f7f7fc;
89
+ color: #4086ff;
90
+ }
91
+ .listItem .img {
85
92
  width: 16px;
86
93
  margin-right: 8px;
87
94
  flex-shrink: 0;
88
95
  }
89
- .tabContent .table .listItem .text {
96
+ .listItem .text {
90
97
  flex: 1;
91
98
  overflow: hidden;
92
99
  text-overflow: ellipsis;
@@ -129,4 +136,46 @@
129
136
  .isActive {
130
137
  background-color: #f2f3f7;
131
138
  border-radius: 8px;
139
+ }
140
+
141
+ .current_video {
142
+ display: flex;
143
+ flex-direction: column;
144
+ padding-top: 5px;
145
+ }
146
+ .current_video .text {
147
+ font-family: PingFang SC;
148
+ font-weight: 400;
149
+ font-style: Regular;
150
+ font-size: 12px;
151
+ line-height: 150%;
152
+ letter-spacing: 0px;
153
+ color: rgb(154, 167, 183);
154
+ padding-left: 5px;
155
+ }
156
+ .current_video .currentItem {
157
+ display: flex;
158
+ align-items: center;
159
+ cursor: pointer;
160
+ width: 100%;
161
+ overflow: hidden;
162
+ min-width: 0;
163
+ font-size: 12px;
164
+ padding: 8px;
165
+ }
166
+ .current_video .currentItem:hover {
167
+ background-color: #f7f7fc;
168
+ color: #4086ff;
169
+ }
170
+ .current_video .currentItem .img {
171
+ width: 16px;
172
+ margin-right: 8px;
173
+ flex-shrink: 0;
174
+ }
175
+ .current_video .currentItem .name {
176
+ flex: 1;
177
+ overflow: hidden;
178
+ text-overflow: ellipsis;
179
+ white-space: nowrap;
180
+ min-width: 0;
132
181
  }
@@ -224,7 +224,8 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
224
224
  shortAsrClick: shortAsrClick,
225
225
  disableVoiceCommunication: disableVoiceCommunication,
226
226
  onHistoryReload: onHistoryReload,
227
- platform: platform
227
+ platform: platform,
228
+ initQuoteSource: props.initQuoteSource
228
229
  }, chatInputConfig)), showPrologue && messageList.length === 0 && !isMoreLoading && quickQuestionListPosition === 'bottom' && /*#__PURE__*/React.createElement(PresetAgentContent, {
229
230
  prologue: '',
230
231
  questionList: (agentObj === null || agentObj === void 0 ? void 0 : agentObj.questionList) || [],
@@ -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
  }