aotrautils-srv 0.0.909 → 0.0.911
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,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:03:37)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -5211,54 +5211,97 @@ class OpenAIAPIClient{
|
|
|
5211
5211
|
lognow("! launchRequest messages :",messages);
|
|
5212
5212
|
|
|
5213
5213
|
|
|
5214
|
-
const
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
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
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
const assistantReply = data.choices[0].message.content;
|
|
5252
|
-
resolve(assistantReply);
|
|
5253
|
-
})
|
|
5254
|
-
.catch(error => {
|
|
5255
|
-
// TRACE
|
|
5256
|
-
console.error("Error:", error);
|
|
5257
|
-
reject(""+error);
|
|
5258
|
-
});
|
|
5259
|
-
|
|
5260
|
-
|
|
5214
|
+
const headers={
|
|
5215
|
+
"Authorization": "Bearer "+AIAPIKey,
|
|
5216
|
+
"Content-Type": "application/json",
|
|
5217
|
+
};
|
|
5218
|
+
const parameters={
|
|
5219
|
+
model:this.modelName,
|
|
5220
|
+
messages:messages,
|
|
5221
|
+
};
|
|
5222
|
+
|
|
5223
|
+
return performHTTPRequestNode(self.apiURL,"POST",headers,parameters).then((responseObj)=>{
|
|
5224
|
+
const responseData=responseObj.responseData;
|
|
5225
|
+
//const response=responseObj.response;
|
|
5226
|
+
//const responseDataStr=responseObj.responseDataStr;
|
|
5227
|
+
const dataLocal=responseData;
|
|
5228
|
+
doOnIncomingMessageForResponse(dataLocal);
|
|
5229
|
+
}).then(response=>{
|
|
5230
|
+
|
|
5231
|
+
// DBG
|
|
5232
|
+
console.log("~~~~~~~~~~~response :",response);
|
|
5233
|
+
|
|
5234
|
+
const data=response;
|
|
5235
|
+
if(data.error){
|
|
5236
|
+
const error=data.error;
|
|
5237
|
+
// TRACE
|
|
5238
|
+
console.error("Error:", error);
|
|
5239
|
+
throw new Error(`${error}`);
|
|
5240
|
+
}
|
|
5241
|
+
|
|
5242
|
+
const assistantReply = data.choices[0].message.content;
|
|
5243
|
+
// DBG
|
|
5244
|
+
console.log("~~~~~~~~~~~assistantReply :",assistantReply);
|
|
5245
|
+
return assistantReply;
|
|
5246
|
+
}).catch(error => {
|
|
5247
|
+
// TRACE
|
|
5248
|
+
console.error("Error:", error);
|
|
5249
|
+
reject(""+error);
|
|
5261
5250
|
});
|
|
5251
|
+
|
|
5252
|
+
|
|
5253
|
+
|
|
5254
|
+
|
|
5255
|
+
|
|
5256
|
+
// return new Promise((resolve,reject)=>{
|
|
5257
|
+
//
|
|
5258
|
+
// fetch(self.apiURL, {
|
|
5259
|
+
// method: "POST",
|
|
5260
|
+
// headers: {
|
|
5261
|
+
// "Authorization": "Bearer "+AIAPIKey,
|
|
5262
|
+
// "Content-Type": "application/json",
|
|
5263
|
+
// },
|
|
5264
|
+
// body: JSON.stringify({
|
|
5265
|
+
// model:self.modelName,
|
|
5266
|
+
// messages,
|
|
5267
|
+
// }),
|
|
5268
|
+
// })
|
|
5269
|
+
// // STRANGE : DOES NOT WORK !!:
|
|
5270
|
+
// //.then(response => response.json())
|
|
5271
|
+
// // STRANGE : DOES WORK :
|
|
5272
|
+
// .then(response => {
|
|
5273
|
+
//
|
|
5274
|
+
// // DBG
|
|
5275
|
+
// console.log("~~~~~~~~~~~response :",response);
|
|
5276
|
+
//
|
|
5277
|
+
// return response.json();
|
|
5278
|
+
// })
|
|
5279
|
+
// .then(data => {
|
|
5280
|
+
//
|
|
5281
|
+
// if(data.error){
|
|
5282
|
+
// const error=data.error;
|
|
5283
|
+
// // TRACE
|
|
5284
|
+
// console.error("Error:", error);
|
|
5285
|
+
// reject(""+error);
|
|
5286
|
+
// return;
|
|
5287
|
+
// }
|
|
5288
|
+
//
|
|
5289
|
+
// // DBG
|
|
5290
|
+
// console.log("~~~~~~~~~~~data :",data);
|
|
5291
|
+
//
|
|
5292
|
+
// const assistantReply = data.choices[0].message.content;
|
|
5293
|
+
// resolve(assistantReply);
|
|
5294
|
+
// })
|
|
5295
|
+
// .catch(error => {
|
|
5296
|
+
// // TRACE
|
|
5297
|
+
// console.error("Error:", error);
|
|
5298
|
+
// reject(""+error);
|
|
5299
|
+
// });
|
|
5300
|
+
// });
|
|
5301
|
+
|
|
5302
|
+
|
|
5303
|
+
|
|
5304
|
+
|
|
5262
5305
|
}
|
|
5263
5306
|
|
|
5264
5307
|
|
|
@@ -5284,7 +5327,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
5284
5327
|
|
|
5285
5328
|
|
|
5286
5329
|
|
|
5287
|
-
/*utils SERVER library associated with aotra version : «1_29072022-2359 (07/04/2024-
|
|
5330
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (07/04/2024-16:03:37)»*/
|
|
5288
5331
|
/*-----------------------------------------------------------------------------*/
|
|
5289
5332
|
|
|
5290
5333
|
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.911",
|
|
4
4
|
"main": "aotrautils-srv.build.js",
|
|
5
5
|
"description": "A library for vanilla javascript utils (server-side) used in aotra javascript CMS",
|
|
6
6
|
"author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",
|