We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
报错信息
chatList.push is not a function TypeError: chatList.push is not a function
在nodejs中使用,如下方式引入ProChat进行demo测试,出现报错
<ProChat style={{ height: '10vh', width: '10vw', }} request={async (messages) => { const response = "aaa" return Response(response); }} />
in useChatList.js:71:104
var _useMergedState3 = useMergedState([], { value: props.chatList, defaultValue: props.initialChatList, onChange: function () { var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (!(props !== null && props !== void 0 && props.onChatsChange)) { _context.next = 3; break; } _context.next = 3; return props === null || props === void 0 ? void 0 : props.onChatsChange(value); case 3: case "end": return _context.stop(); } }, _callee); })); function onChange(_x) { return _onChange.apply(this, arguments); } return onChange; }(), postState: function postState(value) { chatListRef.current = value; return value; } }), _useMergedState4 = _slicedToArray(_useMergedState3, 2), chatList = _useMergedState4[0], setChatList = _useMergedState4[1];
在第二次跳到这个断点时,发现
_useMergedState4:Array(2) 0: Response {type: 'default', url: '', redirected: false, status: 200, ok: true, …} 1: ƒ () _useMergedState4:Array(2) 0: Response {type: 'default', url: '', redirected: false, status: 200, ok: true, …} 1: ƒ ()
然后chatList便取到了_useMergedState4的首位Response而不是原来的Array 最后在useChatList:194 出现报错chatList.push is not a function,因为此时chatList已经不是Array而是Response了
chatList.push(genMessageRecord({ content: message }, 'user'));
这里可能是因为useMergedState将_useMergedState3错误的赋值为了Response
nodejs 18.5.0 demo@0.1.0 ├── @ant-design/pro-chat@2.1.4 ├── @ant-design/pro-components@2.5.1 ├── @antv/g6@4.8.14 ├── @dnd-kit/core@6.1.0 ├── @dnd-kit/sortable@7.0.2 ├── @dnd-kit/utilities@3.2.2 ├── @reactflow/node-resizer@2.2.13 ├── antd-style@3.6.2 ├── antd@5.17.1 ├── babel-plugin-import@1.13.6 ├── buffer@6.0.3 ├── crypto-browserify@3.12.0 ├── crypto@1.0.1 ├── dagre@0.8.5 ├── localforage@1.10.0 ├── md5@2.3.0 ├── pako@2.1.0 ├── react-dom@18.2.0 ├── react-flow-renderer@10.3.17 ├── react-scripts@5.0.1 ├── react@18.2.0 ├── reactflow@11.11.3 ├── stream-browserify@3.0.0 └── stream@0.0.2
The text was updated successfully, but these errors were encountered:
@wxf12345 版本问题,请先不要使用 ProChat 2.0 版本,2.0 还没有实装完成,请使用 1.x。 lateset 的 tag 也是 1.x 的,改动下版本号即可
Sorry, something went wrong.
好的,感谢🙏
No branches or pull requests
🐛 bug 描述
报错信息
📷 复现步骤
在nodejs中使用,如下方式引入ProChat进行demo测试,出现报错
调试信息
in useChatList.js:71:104
在第二次跳到这个断点时,发现
然后chatList便取到了_useMergedState4的首位Response而不是原来的Array
最后在useChatList:194
出现报错chatList.push is not a function,因为此时chatList已经不是Array而是Response了
这里可能是因为useMergedState将_useMergedState3错误的赋值为了Response
环境信息
The text was updated successfully, but these errors were encountered: