@myun/gimi-chat 0.3.1 → 0.3.2

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.
@@ -314,10 +314,9 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
314
314
  })), renderProps.menuItem);
315
315
  }, [VoiceTools, UploadFileTool, props.enableSourceQuote]);
316
316
  var onMessageSend = React.useCallback(function (content) {
317
- var _props$onBeforeSend, _props$onSend;
317
+ var _props$onSend;
318
318
  var inputContents = content.inputContents || [];
319
319
  var text = extractText(inputContents);
320
- (_props$onBeforeSend = props.onBeforeSend) === null || _props$onBeforeSend === void 0 || _props$onBeforeSend.call(props, text);
321
320
  (_props$onSend = props.onSend) === null || _props$onSend === void 0 || _props$onSend.call(props, text);
322
321
  }, []);
323
322
  var renderConfigureArea = React.useCallback(function () {
@@ -1132,6 +1132,7 @@ var useCommonChatAPI = function useCommonChatAPI(containerRef, platform, stopTTS
1132
1132
  }, []);
1133
1133
  var handleSend = React.useCallback( /*#__PURE__*/function () {
1134
1134
  var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(val) {
1135
+ var _chatInputConfig$onBe;
1135
1136
  var agent,
1136
1137
  isSystemAuto,
1137
1138
  conversationId,
@@ -1171,16 +1172,18 @@ var useCommonChatAPI = function useCommonChatAPI(containerRef, platform, stopTTS
1171
1172
  Toast.error('AI正在输出中,请稍后');
1172
1173
  return _context16.abrupt("return");
1173
1174
  case 12:
1175
+ chatInputConfig === null || chatInputConfig === void 0 || (_chatInputConfig$onBe = chatInputConfig.onBeforeSend) === null || _chatInputConfig$onBe === void 0 || _chatInputConfig$onBe.call(chatInputConfig, value);
1176
+
1174
1177
  // 设置inputModel
1175
1178
  fillInputModel(value, messageListRef.current);
1176
1179
  fileValidationMsg = fileValidation(fileListRef.current);
1177
1180
  if (!fileValidationMsg) {
1178
- _context16.next = 17;
1181
+ _context16.next = 18;
1179
1182
  break;
1180
1183
  }
1181
1184
  Toast.error(fileValidationMsg);
1182
1185
  return _context16.abrupt("return");
1183
- case 17:
1186
+ case 18:
1184
1187
  if (isPlaying) {
1185
1188
  // 点击发送按钮时,先停止播放
1186
1189
  stopTTSByText === null || stopTTSByText === void 0 || stopTTSByText();
@@ -1212,7 +1215,7 @@ var useCommonChatAPI = function useCommonChatAPI(containerRef, platform, stopTTS
1212
1215
  // 系统自动上传,直接开始会话,不更新列表
1213
1216
  startChat([].concat(_toConsumableArray(prevChatList), [userChat]), isSystemAuto, conversationId);
1214
1217
  }
1215
- case 24:
1218
+ case 25:
1216
1219
  case "end":
1217
1220
  return _context16.stop();
1218
1221
  }
@@ -1221,7 +1224,7 @@ var useCommonChatAPI = function useCommonChatAPI(containerRef, platform, stopTTS
1221
1224
  return function (_x26) {
1222
1225
  return _ref17.apply(this, arguments);
1223
1226
  };
1224
- }(), [dispatch, startChat]);
1227
+ }(), [dispatch, startChat, chatInputConfig === null || chatInputConfig === void 0 ? void 0 : chatInputConfig.onBeforeSend]);
1225
1228
  var handleSendFile = React.useCallback(function (messageList) {
1226
1229
  if (!navigator.onLine) {
1227
1230
  Toast.error('无法连接到网络');