@bytexbyte/nxtlinq-ai-agent-sdk 1.3.4 → 1.3.5
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EACL,kBAAkB,EAClB,YAAY,EAGb,MAAM,uBAAuB,CAAC;AAI/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EACL,kBAAkB,EAClB,YAAY,EAGb,MAAM,uBAAuB,CAAC;AAI/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA0+ClD,CAAC"}
|
|
@@ -155,6 +155,11 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
|
|
|
155
155
|
}
|
|
156
156
|
else {
|
|
157
157
|
console.log('Failed to get wallet info:', walletResponse.error);
|
|
158
|
+
// Check if the error is due to invalid/expired token
|
|
159
|
+
if (walletResponse.error.includes('Invalid or expired token')) {
|
|
160
|
+
console.log('Token appears to be invalid during wallet info fetch, clearing it');
|
|
161
|
+
setNxtlinqAITServiceAccessToken('');
|
|
162
|
+
}
|
|
158
163
|
}
|
|
159
164
|
}
|
|
160
165
|
catch (error) {
|
|
@@ -229,9 +234,28 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
|
|
|
229
234
|
localStorage.setItem('walletAddress', userAddress);
|
|
230
235
|
setHitAddress(userAddress);
|
|
231
236
|
setSigner(userSigner);
|
|
232
|
-
//
|
|
237
|
+
// Check if we have a valid token before trying to load AIT
|
|
233
238
|
if (nxtlinqAITServiceAccessToken) {
|
|
234
|
-
|
|
239
|
+
try {
|
|
240
|
+
const payload = JSON.parse(atob(nxtlinqAITServiceAccessToken.split('.')[1]));
|
|
241
|
+
const exp = payload.exp * 1000;
|
|
242
|
+
const now = Date.now();
|
|
243
|
+
const address = payload.address;
|
|
244
|
+
// Check if token is expired or address mismatch
|
|
245
|
+
if (exp < now || address !== userAddress) {
|
|
246
|
+
console.log('Token is expired or address mismatch, clearing token');
|
|
247
|
+
setNxtlinqAITServiceAccessToken('');
|
|
248
|
+
// Don't call refreshAIT with invalid token
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
// Token is valid, try to load AIT
|
|
252
|
+
await refreshAIT();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
console.error('Error parsing token during wallet connection:', error);
|
|
257
|
+
setNxtlinqAITServiceAccessToken('');
|
|
258
|
+
}
|
|
235
259
|
}
|
|
236
260
|
if (autoShowSignInMessage) {
|
|
237
261
|
if (isNeedSignInWithWallet) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytexbyte/nxtlinq-ai-agent-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "Nxtlinq AI Agent SDK - Proprietary Software with enhanced async operation handling",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
"microsoft-cognitiveservices-speech-sdk": "^1.45.0",
|
|
45
45
|
"universal-cookie": "^8.0.1"
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|