isdata-customer-sdk 0.1.61 → 0.1.62
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/index.common.js +27 -20
- package/dist/index.common.js.map +1 -1
- package/dist/index.umd.js +27 -20
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +3 -3
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -30836,7 +30836,7 @@ class ChatClientMgr {
|
|
|
30836
30836
|
this.chatType = params.chatType || 0;
|
|
30837
30837
|
this.singleChatID = params.singleChatID || "";
|
|
30838
30838
|
this.chartOrigin = params.chartOrigin;
|
|
30839
|
-
this.charAIs = {};
|
|
30839
|
+
// this.charAIs = {};
|
|
30840
30840
|
}
|
|
30841
30841
|
makeKey(key) {
|
|
30842
30842
|
return `${key}-${this.actionKey}`;
|
|
@@ -30923,25 +30923,30 @@ class ChatClientMgr {
|
|
|
30923
30923
|
appSKID: this.appSKID,
|
|
30924
30924
|
onReady: this.onChatAIReady.bind(this)
|
|
30925
30925
|
});
|
|
30926
|
+
if (!this.chatAIClient.charAIs) {
|
|
30927
|
+
this.chatAIClient.charAIs = {};
|
|
30928
|
+
}
|
|
30926
30929
|
let robotInfos = await this.handler.getAIRobotInfos(this.userID, this.groupID);
|
|
30927
30930
|
if (robotInfos && robotInfos.length > 0) {
|
|
30928
30931
|
robotInfos.forEach(async robot => {
|
|
30929
30932
|
let robotKey = robot.id;
|
|
30930
|
-
|
|
30931
|
-
|
|
30932
|
-
|
|
30933
|
-
|
|
30934
|
-
|
|
30935
|
-
|
|
30936
|
-
|
|
30937
|
-
|
|
30938
|
-
|
|
30933
|
+
if (!this.chatAIClient.charAIs[robotKey]) {
|
|
30934
|
+
robot.chatID = robotKey;
|
|
30935
|
+
let userSig = await this.handler.getPortalUserSig(robotKey, this.imType, this.groupID);
|
|
30936
|
+
if (!userSig) {
|
|
30937
|
+
let sigIDObject = this.handler.genTestUserSig({
|
|
30938
|
+
SDKAppID: this.appSKID,
|
|
30939
|
+
userID: robotKey
|
|
30940
|
+
});
|
|
30941
|
+
userSig = sigIDObject.userSig;
|
|
30942
|
+
await this.handler.addIMMapping(robotKey, this.imType, userSig, this.groupID);
|
|
30943
|
+
}
|
|
30944
|
+
robot.userSig = userSig;
|
|
30945
|
+
this.chatAIClient.charAIs[robotKey] = {
|
|
30946
|
+
robot: robot,
|
|
30947
|
+
messageCache: []
|
|
30948
|
+
};
|
|
30939
30949
|
}
|
|
30940
|
-
robot.userSig = userSig;
|
|
30941
|
-
this.charAIs[robotKey] = {
|
|
30942
|
-
robot: robot,
|
|
30943
|
-
messageCache: []
|
|
30944
|
-
};
|
|
30945
30950
|
});
|
|
30946
30951
|
}
|
|
30947
30952
|
}
|
|
@@ -30951,6 +30956,8 @@ class ChatClientMgr {
|
|
|
30951
30956
|
console.log(`[AI chat] ${robotInfo.name}已经就绪:`, event);
|
|
30952
30957
|
if (this.chatAIClient) {
|
|
30953
30958
|
let messages = this.getAIRobotCacheMessagesByID(robotID);
|
|
30959
|
+
console.log(`[AI chat] ${robotInfo.name}就绪后查到的缓存信息:`, messages);
|
|
30960
|
+
console.log(`[AI chat] ${robotInfo.name}所有信息仓:`, this.chatAIClient.charAIs);
|
|
30954
30961
|
if (messages && messages.length > 0) {
|
|
30955
30962
|
const newMessages = [...messages];
|
|
30956
30963
|
messages.splice(0, messages.length);
|
|
@@ -30963,16 +30970,16 @@ class ChatClientMgr {
|
|
|
30963
30970
|
}
|
|
30964
30971
|
getAIRobotInfos() {
|
|
30965
30972
|
let resultRobots = [];
|
|
30966
|
-
for (let key in this.charAIs) {
|
|
30967
|
-
resultRobots.push(this.charAIs[key].robot);
|
|
30973
|
+
for (let key in this.chatAIClient.charAIs) {
|
|
30974
|
+
resultRobots.push(this.chatAIClient.charAIs[key].robot);
|
|
30968
30975
|
}
|
|
30969
30976
|
return resultRobots;
|
|
30970
30977
|
}
|
|
30971
30978
|
getAIRobotInfoByID(robotID) {
|
|
30972
|
-
return this.charAIs[robotID] ? this.charAIs[robotID].robot : null;
|
|
30979
|
+
return this.chatAIClient.charAIs[robotID] ? this.chatAIClient.charAIs[robotID].robot : null;
|
|
30973
30980
|
}
|
|
30974
30981
|
getAIRobotCacheMessagesByID(robotID) {
|
|
30975
|
-
return this.charAIs[robotID] ? this.charAIs[robotID].messageCache : [];
|
|
30982
|
+
return this.chatAIClient.charAIs[robotID] ? this.chatAIClient.charAIs[robotID].messageCache : [];
|
|
30976
30983
|
}
|
|
30977
30984
|
async sendMessageToChatServer(robotID, messageOption) {
|
|
30978
30985
|
let robotInfo = this.getAIRobotInfoByID(robotID);
|
|
@@ -30995,9 +31002,9 @@ class ChatClientMgr {
|
|
|
30995
31002
|
console.log(`[AI chat]${robotInfo.name}发送失败`, err);
|
|
30996
31003
|
});
|
|
30997
31004
|
} else {
|
|
30998
|
-
console.log(`[AI chat]${robotInfo.name}未就绪,缓存消息:`, messageOption);
|
|
30999
31005
|
let messageCache = this.getAIRobotCacheMessagesByID(robotID);
|
|
31000
31006
|
messageCache.push(messageOption);
|
|
31007
|
+
console.log(`[AI chat]${robotInfo.name}未就绪,缓存后消息:`, messageCache);
|
|
31001
31008
|
}
|
|
31002
31009
|
}
|
|
31003
31010
|
converToAIServerParams(message, robotInfo, param) {
|