@myun/gimi-chat 0.9.47 → 0.9.48

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.
@@ -204,13 +204,13 @@ var AnswerItem = function AnswerItem(_ref) {
204
204
  var handleExpendThinking = /*#__PURE__*/function () {
205
205
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
206
206
  var _item$thinkingInfo;
207
- var _res$result, res, list, toolList, lastMessage, newMessageList;
207
+ var _res$result, res, list, toolList, newMessageList;
208
208
  return _regeneratorRuntime().wrap(function _callee$(_context) {
209
209
  while (1) switch (_context.prev = _context.next) {
210
210
  case 0:
211
211
  setExpendThinking(!expendThinking);
212
212
  if (!(!((_item$thinkingInfo = item.thinkingInfo) !== null && _item$thinkingInfo !== void 0 && _item$thinkingInfo.loaded) && apiService)) {
213
- _context.next = 15;
213
+ _context.next = 14;
214
214
  break;
215
215
  }
216
216
  setToolLoading(true);
@@ -260,19 +260,23 @@ var AnswerItem = function AnswerItem(_ref) {
260
260
  }
261
261
  }
262
262
  });
263
- lastMessage = messageList[messageList.length - 1];
264
- newMessageList = [].concat(_toConsumableArray(messageList.slice(0, -1)), [_objectSpread(_objectSpread({}, lastMessage), {}, {
265
- moduleType: item.moduleType,
266
- toolList: toolList,
267
- thinkingInfo: _objectSpread(_objectSpread({}, item.thinkingInfo), {}, {
268
- loaded: true
269
- })
270
- })]);
263
+
264
+ // 注意:chatId 在 role=0(用户消息) 和 role=1(AI回复) 之间可能共享,
265
+ // 加 type === 1 确保只更新 AI 消息这一条
266
+ newMessageList = messageList.map(function (msg) {
267
+ return msg.chatId === item.chatId && msg.type === 1 ? _objectSpread(_objectSpread({}, msg), {}, {
268
+ moduleType: item.moduleType,
269
+ toolList: toolList,
270
+ thinkingInfo: _objectSpread(_objectSpread({}, item.thinkingInfo), {}, {
271
+ loaded: true
272
+ })
273
+ }) : msg;
274
+ });
271
275
  dispatch(setMessageList({
272
276
  messageList: newMessageList
273
277
  }));
274
278
  setToolLoading(false);
275
- case 15:
279
+ case 14:
276
280
  case "end":
277
281
  return _context.stop();
278
282
  }
@@ -282,7 +282,6 @@ var TryWatch = function TryWatch(_ref7) {
282
282
  var handleDocument = function handleDocument() {
283
283
  var searchParams = "gradeId=".concat(item.gradeId, "&teachModuleId=").concat(item.id, "&outlineId=").concat(item.courseId, "&phaseId=").concat(item.phaseId);
284
284
  if (item.isJoinClass) {
285
- window.open(item.resourceMountType === 'teachingModule' ? "/learningPage?".concat(searchParams) : item.productType === 'single' ? "/courseDetail/".concat(item.gradeId, "?trigger=resource") : "/class-project/".concat(item.gradeId, "/").concat(item.productId, "?trigger=resource"));
286
285
  window.open(item.resourceMountType === 'teachingModule' ? "/learningPage?".concat(searchParams) : item.productType === 'single' ? "/courseDetail/".concat(item.gradeId, "?trigger=resource&resourcesId=").concat(item.hostId) : "/class-project/".concat(item.gradeId, "/").concat(item.productId, "?trigger=resource&resourcesId=").concat(item.hostId));
287
286
  } else {
288
287
  if (item.productType === 'single') {