aotrautils 0.0.916 → 0.0.918
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.
- aotrautils/aotrautils.build.js +95 -53
- aotrautils/package.json +1 -1
aotrautils/aotrautils.build.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (07/04/2024-
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (07/04/2024-16:01:36)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -5195,10 +5195,8 @@ class OpenAIAPIClient{
|
|
|
5195
5195
|
|
|
5196
5196
|
//DBG
|
|
5197
5197
|
lognow("------------self.apiURL:",self.apiURL);
|
|
5198
|
-
lognow("------------! messages :",messages);
|
|
5199
5198
|
|
|
5200
|
-
|
|
5201
|
-
const result=this.launchRequest(AIAPIKey, messages);
|
|
5199
|
+
const result=await this.launchRequest(AIAPIKey, messages);
|
|
5202
5200
|
|
|
5203
5201
|
// DBG
|
|
5204
5202
|
console.log("! RESULT text :",result);
|
|
@@ -5213,54 +5211,98 @@ class OpenAIAPIClient{
|
|
|
5213
5211
|
lognow("! launchRequest messages :",messages);
|
|
5214
5212
|
|
|
5215
5213
|
|
|
5214
|
+
const headers={
|
|
5215
|
+
"Authorization": "Bearer "+AIAPIKey,
|
|
5216
|
+
"Content-Type": "application/json",
|
|
5217
|
+
};
|
|
5218
|
+
const parameters={
|
|
5219
|
+
model:self.modelName,
|
|
5220
|
+
messages,
|
|
5221
|
+
};
|
|
5222
|
+
|
|
5216
5223
|
const self=this;
|
|
5217
|
-
return
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
// TRACE
|
|
5245
|
-
console.error("Error:", error);
|
|
5246
|
-
reject(""+error);
|
|
5247
|
-
return;
|
|
5248
|
-
}
|
|
5249
|
-
|
|
5250
|
-
// DBG
|
|
5251
|
-
console.log("~~~~~~~~~~~data :",data);
|
|
5252
|
-
|
|
5253
|
-
const assistantReply = data.choices[0].message.content;
|
|
5254
|
-
resolve(assistantReply);
|
|
5255
|
-
})
|
|
5256
|
-
.catch(error => {
|
|
5257
|
-
// TRACE
|
|
5258
|
-
console.error("Error:", error);
|
|
5259
|
-
reject(""+error);
|
|
5260
|
-
});
|
|
5261
|
-
|
|
5262
|
-
|
|
5224
|
+
return performHTTPRequestNode(self.apiURL,"POST",headers,parameters).then((responseObj)=>{
|
|
5225
|
+
const responseData=responseObj.responseData;
|
|
5226
|
+
//const response=responseObj.response;
|
|
5227
|
+
//const responseDataStr=responseObj.responseDataStr;
|
|
5228
|
+
const dataLocal=responseData;
|
|
5229
|
+
doOnIncomingMessageForResponse(dataLocal);
|
|
5230
|
+
}).then(response=>{
|
|
5231
|
+
|
|
5232
|
+
// DBG
|
|
5233
|
+
console.log("~~~~~~~~~~~response :",response);
|
|
5234
|
+
|
|
5235
|
+
const data=response;
|
|
5236
|
+
if(data.error){
|
|
5237
|
+
const error=data.error;
|
|
5238
|
+
// TRACE
|
|
5239
|
+
console.error("Error:", error);
|
|
5240
|
+
throw new Error(`${error}`);
|
|
5241
|
+
}
|
|
5242
|
+
|
|
5243
|
+
const assistantReply = data.choices[0].message.content;
|
|
5244
|
+
// DBG
|
|
5245
|
+
console.log("~~~~~~~~~~~assistantReply :",assistantReply);
|
|
5246
|
+
return assistantReply;
|
|
5247
|
+
}).catch(error => {
|
|
5248
|
+
// TRACE
|
|
5249
|
+
console.error("Error:", error);
|
|
5250
|
+
reject(""+error);
|
|
5263
5251
|
});
|
|
5252
|
+
|
|
5253
|
+
|
|
5254
|
+
|
|
5255
|
+
|
|
5256
|
+
|
|
5257
|
+
// return new Promise((resolve,reject)=>{
|
|
5258
|
+
//
|
|
5259
|
+
// fetch(self.apiURL, {
|
|
5260
|
+
// method: "POST",
|
|
5261
|
+
// headers: {
|
|
5262
|
+
// "Authorization": "Bearer "+AIAPIKey,
|
|
5263
|
+
// "Content-Type": "application/json",
|
|
5264
|
+
// },
|
|
5265
|
+
// body: JSON.stringify({
|
|
5266
|
+
// model:self.modelName,
|
|
5267
|
+
// messages,
|
|
5268
|
+
// }),
|
|
5269
|
+
// })
|
|
5270
|
+
// // STRANGE : DOES NOT WORK !!:
|
|
5271
|
+
// //.then(response => response.json())
|
|
5272
|
+
// // STRANGE : DOES WORK :
|
|
5273
|
+
// .then(response => {
|
|
5274
|
+
//
|
|
5275
|
+
// // DBG
|
|
5276
|
+
// console.log("~~~~~~~~~~~response :",response);
|
|
5277
|
+
//
|
|
5278
|
+
// return response.json();
|
|
5279
|
+
// })
|
|
5280
|
+
// .then(data => {
|
|
5281
|
+
//
|
|
5282
|
+
// if(data.error){
|
|
5283
|
+
// const error=data.error;
|
|
5284
|
+
// // TRACE
|
|
5285
|
+
// console.error("Error:", error);
|
|
5286
|
+
// reject(""+error);
|
|
5287
|
+
// return;
|
|
5288
|
+
// }
|
|
5289
|
+
//
|
|
5290
|
+
// // DBG
|
|
5291
|
+
// console.log("~~~~~~~~~~~data :",data);
|
|
5292
|
+
//
|
|
5293
|
+
// const assistantReply = data.choices[0].message.content;
|
|
5294
|
+
// resolve(assistantReply);
|
|
5295
|
+
// })
|
|
5296
|
+
// .catch(error => {
|
|
5297
|
+
// // TRACE
|
|
5298
|
+
// console.error("Error:", error);
|
|
5299
|
+
// reject(""+error);
|
|
5300
|
+
// });
|
|
5301
|
+
// });
|
|
5302
|
+
|
|
5303
|
+
|
|
5304
|
+
|
|
5305
|
+
|
|
5264
5306
|
}
|
|
5265
5307
|
|
|
5266
5308
|
|
|
@@ -5286,7 +5328,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
5286
5328
|
|
|
5287
5329
|
|
|
5288
5330
|
|
|
5289
|
-
/*utils CLIENT library associated with aotra version : «1_29072022-2359 (07/04/2024-
|
|
5331
|
+
/*utils CLIENT library associated with aotra version : «1_29072022-2359 (07/04/2024-16:01:36)»*/
|
|
5290
5332
|
/*-----------------------------------------------------------------------------*/
|
|
5291
5333
|
/* ## Utility global methods in a browser (htmljs) client environment.
|
|
5292
5334
|
*
|
|
@@ -13499,7 +13541,7 @@ createOritaMicroClient=function(url, port, isNode=false, staticMicroClientIdPara
|
|
|
13499
13541
|
|
|
13500
13542
|
|
|
13501
13543
|
|
|
13502
|
-
/*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (07/04/2024-
|
|
13544
|
+
/*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (07/04/2024-16:01:36)»*/
|
|
13503
13545
|
/*-----------------------------------------------------------------------------*/
|
|
13504
13546
|
|
|
13505
13547
|
|
|
@@ -14738,7 +14780,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
|
|
|
14738
14780
|
// MUST REMAIN AT THE END OF THIS LIBRARY FILE !
|
|
14739
14781
|
|
|
14740
14782
|
AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
|
|
14741
|
-
/*utils SERVER library associated with aotra version : «1_29072022-2359 (07/04/2024-
|
|
14783
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (07/04/2024-16:01:36)»*/
|
|
14742
14784
|
/*-----------------------------------------------------------------------------*/
|
|
14743
14785
|
|
|
14744
14786
|
|
aotrautils/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.918",
|
|
4
4
|
"main": "aotrautils.build.js",
|
|
5
5
|
"description": "A library for vanilla javascript utils (client-side) used in aotra javascript CMS",
|
|
6
6
|
"author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",
|