@aochuang/client-sdk 1.0.342 → 1.0.343

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aochuang/client-sdk",
3
- "version": "1.0.342",
3
+ "version": "1.0.343",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -229,14 +229,14 @@ export default class ClientChatSession {
229
229
  }
230
230
 
231
231
  getSession (sessionId, serializeMethod) {
232
- if (this.sessionMap[sessionId]) {
232
+ if (this.sessionMap[sessionId]) {
233
233
  return Promise.resolve({
234
234
  data: this.sessionMap[sessionId]
235
235
  })
236
236
  }
237
237
  // 这里需要轮询从后端获取会话,后端会话更新和创建是异步的,所以要多轮训请求几次
238
238
  if (this.pollRequestMap[sessionId]) {
239
- this.pollRequestMap[sessionId].stop()
239
+ return this.pollRequestMap[sessionId].ps
240
240
  }
241
241
  const pollRequest = createPollRequest(({ done, fail }) => {
242
242
  return this.getSessionMethod({
@@ -248,7 +248,7 @@ export default class ClientChatSession {
248
248
  })
249
249
  })
250
250
  this.pollRequestMap[sessionId] = pollRequest
251
- return pollRequest.start().then(rs => {
251
+ this.pollRequestMap[sessionId].ps = pollRequest.start().then(rs => {
252
252
  if (serializeMethod) {
253
253
  rs = serializeMethod(rs)
254
254
  }
@@ -263,6 +263,7 @@ export default class ClientChatSession {
263
263
  delete this.pollRequestMap[sessionId]
264
264
  }
265
265
  })
266
+ return this.pollRequestMap[sessionId].ps
266
267
  }
267
268
 
268
269
  findSession (findFn) {