@mujian/js-sdk 0.0.6-beta.57 → 0.0.6-beta.59

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.
package/dist/react.js CHANGED
@@ -1215,13 +1215,15 @@ const useChat = ({ body, onError, onFinish, pageSize })=>{
1215
1215
  };
1216
1216
  const messages = data?.list ?? [];
1217
1217
  const latestData = useLatest(data);
1218
+ const latestListRef = useRef(messages);
1219
+ latestListRef.current = messages;
1218
1220
  const setMessages = (messages)=>{
1219
- 'function' == typeof messages ? mutate({
1221
+ let newList;
1222
+ newList = 'function' == typeof messages ? messages(latestListRef.current) : messages;
1223
+ latestListRef.current = newList;
1224
+ mutate({
1220
1225
  ...latestData.current,
1221
- list: messages(latestData.current?.list ?? [])
1222
- }) : mutate({
1223
- ...latestData.current,
1224
- list: messages
1226
+ list: newList
1225
1227
  });
1226
1228
  };
1227
1229
  const { chatStreaming, isStreaming } = useChatStreaming({
package/dist/umd/index.js CHANGED
@@ -2,8 +2,8 @@
2
2
  (function(root, factory) {
3
3
  if ('object' == typeof exports && 'object' == typeof module) module.exports = factory();
4
4
  else if ('function' == typeof define && define.amd) define([], factory);
5
- else if ('object' == typeof exports) exports["MujianSDK"] = factory();
6
- else root["MujianSDK"] = factory();
5
+ else if ('object' == typeof exports) exports["MujianUMD"] = factory();
6
+ else root["MujianUMD"] = factory();
7
7
  })(globalThis, ()=>(()=>{
8
8
  "use strict";
9
9
  var __webpack_require__ = {};
package/dist/umd/react.js CHANGED
@@ -4,8 +4,8 @@
4
4
  else if ('function' == typeof define && define.amd) define([
5
5
  "React"
6
6
  ], factory);
7
- else if ('object' == typeof exports) exports["MujianSDK"] = factory(require("React"));
8
- else root["MujianSDK"] = factory(root["React"]);
7
+ else if ('object' == typeof exports) exports["MujianUMD"] = factory(require("React"));
8
+ else root["MujianUMD"] = factory(root["React"]);
9
9
  })(globalThis, (__WEBPACK_EXTERNAL_MODULE_react__)=>(()=>{
10
10
  var __webpack_modules__ = {
11
11
  "../../common/temp/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js": function(module1, __unused_webpack_exports, __webpack_require__) {
@@ -8681,13 +8681,15 @@ ${content}
8681
8681
  };
8682
8682
  const messages = data?.list ?? [];
8683
8683
  const latestData = useLatest(data);
8684
+ const latestListRef = (0, external_React_.useRef)(messages);
8685
+ latestListRef.current = messages;
8684
8686
  const setMessages = (messages)=>{
8685
- 'function' == typeof messages ? mutate({
8687
+ let newList;
8688
+ newList = 'function' == typeof messages ? messages(latestListRef.current) : messages;
8689
+ latestListRef.current = newList;
8690
+ mutate({
8686
8691
  ...latestData.current,
8687
- list: messages(latestData.current?.list ?? [])
8688
- }) : mutate({
8689
- ...latestData.current,
8690
- list: messages
8692
+ list: newList
8691
8693
  });
8692
8694
  };
8693
8695
  const { chatStreaming, isStreaming } = useChatStreaming({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mujian/js-sdk",
3
- "version": "0.0.6-beta.57",
3
+ "version": "0.0.6-beta.59",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {