@myun/gimi-chat 0.9.36 → 0.9.38

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.
@@ -223,7 +223,9 @@ var useApi = function useApi(baseUrl, authToken) {
223
223
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
224
224
  while (1) switch (_context11.prev = _context11.next) {
225
225
  case 0:
226
- return _context11.abrupt("return", fetchService.post('/mcourse/web/trace/resource', params));
226
+ return _context11.abrupt("return", fetchService.post('/mcourse/web/trace/resource', params, {
227
+ timeout: 60000
228
+ }));
227
229
  case 1:
228
230
  case "end":
229
231
  return _context11.stop();
@@ -86,7 +86,7 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
86
86
  informationList = _useKnowledgeService.informationList,
87
87
  isLoading = _useKnowledgeService.isLoading;
88
88
  var handleCurrentTrace = React.useCallback(function (trace) {
89
- if (trace.isDelete === 1) return;
89
+ if (trace.isDelete === 1 || trace.isDeleted === 1) return;
90
90
  setShowPanel(false);
91
91
  setCurTrace(trace);
92
92
  setTryWatchVisible(true);
@@ -474,6 +474,7 @@
474
474
  justify-content: center;
475
475
  border-radius: 4px;
476
476
  gap: 5px;
477
+ margin-right: 4px;
477
478
  border: 1px solid var(--theme-softNeutral, #D9DCE5);
478
479
  background-color: var(--theme-subtleNeutral, #F5F7FA);
479
480
  cursor: pointer;
@@ -1,25 +1,33 @@
1
1
  import React from 'react';
2
2
  import styles from "./index.module.css";
3
3
  import { knowledgeConstants } from "../../constants";
4
+ // import { Tooltip } from '@douyinfe/semi-ui';
5
+
6
+ import { useTranslation } from 'react-i18next';
7
+ import classNames from 'classnames';
4
8
  var InformationList = function InformationList(_ref) {
5
9
  var list = _ref.list,
6
10
  handleCurrentTrace = _ref.handleCurrentTrace;
11
+ var _useTranslation = useTranslation(),
12
+ t = _useTranslation.t;
7
13
  return /*#__PURE__*/React.createElement("div", {
8
14
  className: styles.knowledgeList
9
15
  }, list.map(function (item) {
10
16
  return /*#__PURE__*/React.createElement("div", {
11
- className: styles.knowledge,
17
+ className: classNames(styles.knowledge, item.isDelete === 1 ? styles.resource_deactive : ''),
12
18
  onClick: function onClick() {
13
19
  return handleCurrentTrace === null || handleCurrentTrace === void 0 ? void 0 : handleCurrentTrace(item);
14
20
  }
15
21
  }, /*#__PURE__*/React.createElement("img", {
16
22
  className: styles.img,
17
- src: knowledgeConstants.INFORMATION_ICON_ADRESS
23
+ src: knowledgeConstants.INFORMATION_ICON_COVER_ADDRESS
18
24
  }), /*#__PURE__*/React.createElement("div", {
19
25
  className: styles.description
20
26
  }, /*#__PURE__*/React.createElement("div", {
21
27
  className: styles.text
22
- }, item.title)));
28
+ }, item.title), item.isDelete === 1 && /*#__PURE__*/React.createElement("div", {
29
+ className: styles.knowledge_trace_deactive
30
+ }, t('trace.information.invalid'))));
23
31
  }));
24
32
  };
25
33
  export default InformationList;
@@ -16,7 +16,6 @@ import styles from "./index.module.css";
16
16
  import { Spin } from '@douyinfe/semi-ui';
17
17
  import GdPlayer from '@gaodun.com/gplayer';
18
18
  import ChatContext from "../templates/chatContext";
19
- import AiLoading from "../ai-loading";
20
19
  import { getFieldConfigsByType } from "./config";
21
20
  var SUPPORT_PREVIEW_FILE_TYPE = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
22
21
  var SUPPORT_WEB_PREVIEW = ['pdf', 'svg', 'png', 'jpg', 'jpeg', 'gif'];
@@ -89,7 +88,7 @@ var VideoPlayer = function VideoPlayer(_ref2) {
89
88
  // @ts-ignore
90
89
  window.Hls = null; // 重置hls,g1和g2会冲突
91
90
  playerRef.current = new GdPlayer({
92
- container: document.getElementById('player-box'),
91
+ container: document.getElementById('player-box1'),
93
92
  protype: 'b',
94
93
  video: {},
95
94
  env: 't-',
@@ -137,14 +136,14 @@ var VideoPlayer = function VideoPlayer(_ref2) {
137
136
  });
138
137
  }
139
138
  return /*#__PURE__*/React.createElement("div", {
140
- id: "player-box-wrap",
139
+ id: "player-box-wrap1",
141
140
  className: styles.playerWrap
142
141
  }, /*#__PURE__*/React.createElement(Spin, {
143
142
  spinning: loading,
144
143
  size: "large",
145
144
  wrapperClassName: styles.spinWrap
146
145
  }), /*#__PURE__*/React.createElement("div", {
147
- id: "player-box",
146
+ id: "player-box1",
148
147
  className: styles.playerBox
149
148
  }));
150
149
  };
@@ -153,98 +152,10 @@ var DocumentPlayer = function DocumentPlayer(_ref5) {
153
152
  onViewFull = _ref5.onViewFull;
154
153
  var _useTranslation2 = useTranslation(),
155
154
  t = _useTranslation2.t;
156
- var _useContext2 = useContext(ChatContext),
157
- apiService = _useContext2.apiService;
158
- var _ref6 = apiService,
159
- getDocumentTrialUrl = _ref6.getDocumentTrialUrl;
160
155
 
161
- // trialUrl: 试看地址;error: 失败文案 key(null 表示无错误);loading: 加载中
162
- var _useState3 = useState(''),
163
- _useState4 = _slicedToArray(_useState3, 2),
164
- trialUrl = _useState4[0],
165
- setTrialUrl = _useState4[1];
166
- var _useState5 = useState(null),
167
- _useState6 = _slicedToArray(_useState5, 2),
168
- errorKey = _useState6[0],
169
- setErrorKey = _useState6[1];
170
- var _useState7 = useState(false),
171
- _useState8 = _slicedToArray(_useState7, 2),
172
- loading = _useState8[0],
173
- setLoading = _useState8[1];
174
-
175
- // Office 文档与 Web 可预览类型(pdf/svg/图片)均通过试看接口获取试看地址
176
- var canPreview = SUPPORT_PREVIEW_FILE_TYPE.includes(item.suffix) || SUPPORT_WEB_PREVIEW.includes(item.suffix);
177
-
178
- // 业务码 -> i18n key
179
- var mapTrialError = function mapTrialError(status) {
180
- switch (status) {
181
- case 4001:
182
- return 'trace.document.trialUnsupportedType';
183
- case 4002:
184
- return 'trace.document.trialFileTooLarge';
185
- case 4003:
186
- return 'trace.document.trialInvalidDoc';
187
- default:
188
- return 'trace.document.trialFailed';
189
- }
190
- };
191
- useEffect(function () {
192
- if (!canPreview) return;
193
- var cancelled = false;
194
- var fetchTrial = /*#__PURE__*/function () {
195
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
196
- var _res$result, res, isOfficeType;
197
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
198
- while (1) switch (_context2.prev = _context2.next) {
199
- case 0:
200
- setLoading(true);
201
- setErrorKey(null);
202
- setTrialUrl('');
203
- _context2.prev = 3;
204
- _context2.next = 6;
205
- return getDocumentTrialUrl({
206
- resourceUrl: item.url
207
- });
208
- case 6:
209
- res = _context2.sent;
210
- if (!cancelled) {
211
- _context2.next = 9;
212
- break;
213
- }
214
- return _context2.abrupt("return");
215
- case 9:
216
- if (res.status === 0 && (_res$result = res.result) !== null && _res$result !== void 0 && _res$result.trialUrl) {
217
- // Office 文档:用 Office 在线预览嵌入地址;Web 类型(pdf/图片)直接用 trialUrl
218
- isOfficeType = SUPPORT_PREVIEW_FILE_TYPE.includes(item.suffix);
219
- setTrialUrl(isOfficeType ? "https://view.officeapps.live.com/op/embed.aspx?src=".concat(encodeURIComponent(res.result.trialUrl)) : res.result.trialUrl);
220
- } else {
221
- setErrorKey(mapTrialError(res.status));
222
- }
223
- _context2.next = 15;
224
- break;
225
- case 12:
226
- _context2.prev = 12;
227
- _context2.t0 = _context2["catch"](3);
228
- if (!cancelled) setErrorKey('trace.document.trialFailed');
229
- case 15:
230
- _context2.prev = 15;
231
- if (!cancelled) setLoading(false);
232
- return _context2.finish(15);
233
- case 18:
234
- case "end":
235
- return _context2.stop();
236
- }
237
- }, _callee2, null, [[3, 12, 15, 18]]);
238
- }));
239
- return function fetchTrial() {
240
- return _ref7.apply(this, arguments);
241
- };
242
- }();
243
- fetchTrial();
244
- return function () {
245
- cancelled = true;
246
- };
247
- }, [item.url, canPreview]);
156
+ // Office 文档与 Web 可预览类型(pdf/svg/图片)支持试看
157
+ // const canPreview = SUPPORT_PREVIEW_FILE_TYPE.includes(item.suffix) || SUPPORT_WEB_PREVIEW.includes(item.suffix);
158
+ var canPreview = SUPPORT_WEB_PREVIEW.includes(item.suffix);
248
159
 
249
160
  // 不支持预览的类型:直接提示并下载
250
161
  if (!canPreview) {
@@ -255,33 +166,21 @@ var DocumentPlayer = function DocumentPlayer(_ref5) {
255
166
  });
256
167
  }
257
168
 
258
- // 加载中
259
- if (loading) {
260
- return /*#__PURE__*/React.createElement("div", {
261
- className: styles.docLoading
262
- }, /*#__PURE__*/React.createElement(AiLoading, null));
263
- }
264
- // 试看接口失败
265
- if (errorKey) {
266
- return /*#__PURE__*/React.createElement(UnsupportedView, {
267
- tipKey: errorKey,
268
- downloadUrl: item.url,
269
- onViewFull: onViewFull
270
- });
271
- }
272
- // 试看地址
273
- return trialUrl ? /*#__PURE__*/React.createElement("iframe", {
169
+ // item.url 即试看地址:Office 文档用 Office 在线预览嵌入地址;Web 类型(pdf/图片)直接用 url
170
+ var isOfficeType = SUPPORT_PREVIEW_FILE_TYPE.includes(item.suffix);
171
+ var previewUrl = isOfficeType ? "https://view.officeapps.live.com/op/embed.aspx?src=".concat(encodeURIComponent(item.url)) : item.url;
172
+ return /*#__PURE__*/React.createElement("iframe", {
274
173
  className: styles.docFrame,
275
- src: trialUrl,
174
+ src: previewUrl,
276
175
  style: {
277
176
  border: 0
278
177
  },
279
178
  title: item.name || t('file.previewTitle')
280
- }) : null;
179
+ });
281
180
  };
282
- var NewsPlayer = function NewsPlayer(_ref8) {
181
+ var NewsPlayer = function NewsPlayer(_ref6) {
283
182
  var _item$regulationType;
284
- var item = _ref8.item;
183
+ var item = _ref6.item;
285
184
  var _useTranslation3 = useTranslation(),
286
185
  t = _useTranslation3.t;
287
186
  var html = item.htmlContent || item.content || '';
@@ -330,12 +229,12 @@ var NewsPlayer = function NewsPlayer(_ref8) {
330
229
  className: styles.newsMaskText
331
230
  }, t('trace.information.unsupportedTips')))));
332
231
  };
333
- var TryWatch = function TryWatch(_ref9) {
334
- var item = _ref9.item,
335
- type = _ref9.type,
336
- visible = _ref9.visible,
337
- onCancel = _ref9.onCancel,
338
- onCurrentTraceVideoClick = _ref9.onCurrentTraceVideoClick;
232
+ var TryWatch = function TryWatch(_ref7) {
233
+ var item = _ref7.item,
234
+ type = _ref7.type,
235
+ visible = _ref7.visible,
236
+ onCancel = _ref7.onCancel,
237
+ onCurrentTraceVideoClick = _ref7.onCurrentTraceVideoClick;
339
238
  var platform = useAppSelector(function (state) {
340
239
  return state.gimiMenu.platform;
341
240
  });
@@ -347,7 +246,7 @@ var TryWatch = function TryWatch(_ref9) {
347
246
  var _useTranslation4 = useTranslation(),
348
247
  t = _useTranslation4.t;
349
248
  var handleFull = function handleFull() {
350
- if (item.isDelete === 1) return;
249
+ if (item.isDelete === 1 || item.isDeleted === 1) return;
351
250
  if (platform !== 'myun') return Toast.warning(t('trace.jumpUnsupported'));
352
251
  if (type === 'information') {
353
252
  handleInformation();
@@ -10,6 +10,7 @@ export declare const knowledgeConstants: {
10
10
  VIDEO_PLAY_ICON_ADDRESS: string;
11
11
  VIDEO_DEFAULT_COVER_ADDRESS: string;
12
12
  INFORMATION_ICON_ADRESS: string;
13
+ INFORMATION_ICON_COVER_ADDRESS: string;
13
14
  };
14
15
  export declare const documentConstants: {
15
16
  txt: string;
package/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export var knowledgeConstants = {
2
2
  VIDEO_ICON_ADDRESS: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202511/28/19116_20251128152844.png',
3
3
  VIDEO_ICON_KNOWLADGE_TRACE_ADDRESS: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202512/05/5dda1_20251205145434.png',
4
- DOCUMENT_ICON_ADDRESS: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202511/10/1c1a5_20251110100244.png',
4
+ DOCUMENT_ICON_ADDRESS: 'https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202607/24/86526_20260724172428.png',
5
5
  CLASS_ICON_ADDRESS: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202511/10/3c093_20251110102706.png',
6
6
  CLASS_ICON_BIG_ADDRESS: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202511/28/7c759_20251128153111.png',
7
7
  VIDEO_ICON_WHITE_ADDRESS: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202511/10/77cdc_20251110132223.png',
@@ -9,7 +9,8 @@ export var knowledgeConstants = {
9
9
  CLASS_ICON_WHITE_ADDRESS: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202511/10/61fdf_20251110132334.png',
10
10
  VIDEO_PLAY_ICON_ADDRESS: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202511/19/1f688_20251119160747.png',
11
11
  VIDEO_DEFAULT_COVER_ADDRESS: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202511/19/7a643_20251119160927.png',
12
- INFORMATION_ICON_ADRESS: "https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202607/22/b834d_20260722090057.png"
12
+ INFORMATION_ICON_ADRESS: "https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202607/22/b834d_20260722090057.png",
13
+ INFORMATION_ICON_COVER_ADDRESS: "https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202607/24/ecafd_20260724172758.png"
13
14
  };
14
15
  export var documentConstants = {
15
16
  txt: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/17/b46c7_20250917144926.png',
@@ -40,6 +40,7 @@ declare const enUS: {
40
40
  'trace.course.total': string;
41
41
  'trace.document.coverAlt': string;
42
42
  'trace.document.invalid': string;
43
+ 'trace.information.invalid': string;
43
44
  'trace.document.total': string;
44
45
  'trace.document.unsupported': string;
45
46
  'trace.document.unsupportedTips': string;
@@ -40,6 +40,7 @@ var enUS = {
40
40
  'trace.course.total': '{{count}} courses in this conversation',
41
41
  'trace.document.coverAlt': 'Document image',
42
42
  'trace.document.invalid': 'Document invalid',
43
+ 'trace.information.invalid': 'Information invalid',
43
44
  'trace.document.total': '{{count}} documents in this conversation',
44
45
  'trace.document.unsupported': 'This file type cannot be previewed',
45
46
  'trace.document.unsupportedTips': 'This file format does not support trial preview. You can download it and view it with other software.\nTo view the full document, click the "View" button.',
@@ -40,6 +40,7 @@ declare const zhCN: {
40
40
  'trace.course.total': string;
41
41
  'trace.document.coverAlt': string;
42
42
  'trace.document.invalid': string;
43
+ 'trace.information.invalid': string;
43
44
  'trace.document.total': string;
44
45
  'trace.document.unsupported': string;
45
46
  'trace.document.unsupportedTips': string;
@@ -40,9 +40,10 @@ var zhCN = {
40
40
  'trace.course.total': '本对话共{{count}}个课程',
41
41
  'trace.document.coverAlt': '文档图片',
42
42
  'trace.document.invalid': '文档失效',
43
+ 'trace.information.invalid': '资讯失效',
43
44
  'trace.document.total': '本对话共{{count}}个文档',
44
45
  'trace.document.unsupported': '当前文件不支持预览',
45
- 'trace.document.unsupportedTips': '文件格式不支持试看,您可以下载后用其他软件查看。\n如需查看完整文档,请点击“去查看”按钮。',
46
+ 'trace.document.unsupportedTips': '文件格式不支持在线试看,您可以下载后用其他软件查看。\n如需查看完整文档,请点击“去查看”按钮。',
46
47
  'trace.video.unsupportedTips': '该视频暂不支持试看,\n如需查看完整视频,请点击“去查看”按钮。',
47
48
  'trace.information.unsupportedTips': '以下内容暂不可试看',
48
49
  'trace.notPermission': '暂无权益',
@@ -243,5 +243,6 @@ export interface IInformation {
243
243
 
244
244
  isActive?: boolean; // 是否高亮
245
245
  packageId?: number; // 资源包ID
246
+ isDelete?: number; // 资源是否已删除 (1:删除 0 :未删除)
246
247
 
247
248
  }