aotrautils 0.0.921 → 0.0.923

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-16:08:39)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (07/04/2024-16:29:56)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -5220,51 +5220,41 @@ class OpenAIAPIClient{
5220
5220
  messages:messages,
5221
5221
  };
5222
5222
 
5223
- return performHTTPRequestNode(this.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;
5223
+ return new Promise((resolve,reject)=>{
5224
+ performHTTPRequestNode(this.apiURL,"POST",headers,parameters).then((responseObj)=>{
5225
+ const responseData=responseObj.responseData;
5226
+ const data=responseData;
5227
+
5228
+ // DBG
5229
+ console.log("~~~~~~~~~~~data :",data);
5230
+
5231
+ if(data.error){
5232
+ const error=data.error;
5233
+ // TRACE
5234
+ console.error("Error:", error);
5235
+ reject(`${error}`);
5236
+ }
5237
+
5238
+ const assistantReply = data.choices[0].message.content;
5239
+ // DBG
5240
+ console.log("~~~~~~~~~~~assistantReply :",assistantReply);
5241
+
5242
+ resolve(assistantReply);
5243
+ }).catch(error => {
5237
5244
  // TRACE
5238
5245
  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
- throw error;
5246
+ reject(error);
5247
+ });
5250
5248
  });
5251
5249
 
5252
5250
 
5253
-
5254
-
5255
-
5251
+ // DOES NOT WORK :
5256
5252
  // return new Promise((resolve,reject)=>{
5257
5253
  //
5258
5254
  // fetch(self.apiURL, {
5259
5255
  // 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
- // }),
5256
+ // headers: headers,
5257
+ // body: JSON.stringify(parameters),
5268
5258
  // })
5269
5259
  // // STRANGE : DOES NOT WORK !!:
5270
5260
  // //.then(response => response.json())
@@ -5327,7 +5317,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
5327
5317
 
5328
5318
 
5329
5319
 
5330
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (07/04/2024-16:08:39)»*/
5320
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (07/04/2024-16:29:56)»*/
5331
5321
  /*-----------------------------------------------------------------------------*/
5332
5322
  /* ## Utility global methods in a browser (htmljs) client environment.
5333
5323
  *
@@ -11426,7 +11416,7 @@ function promptWindow(label,type=null,defaultValue=null,
11426
11416
 
11427
11417
  let style="";
11428
11418
  style+="position:absolute;";
11429
- style+="left:50%;top:50%;";
11419
+ style+="left:50%;top:20%;";
11430
11420
  style+="z-index:" + (MAX_Z_INDEX_OVERLAY_LOCAL) + ";";
11431
11421
  style+="z-index:" + (MAX_Z_INDEX_OVERLAY_LOCAL) + ";";
11432
11422
  style+="width:"+promptWindowWidth+";height:"+promptWindowHeight+"; ";
@@ -13540,7 +13530,7 @@ createOritaMicroClient=function(url, port, isNode=false, staticMicroClientIdPara
13540
13530
 
13541
13531
 
13542
13532
 
13543
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (07/04/2024-16:08:39)»*/
13533
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (07/04/2024-16:29:56)»*/
13544
13534
  /*-----------------------------------------------------------------------------*/
13545
13535
 
13546
13536
 
@@ -14779,7 +14769,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14779
14769
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14780
14770
 
14781
14771
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14782
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (07/04/2024-16:08:39)»*/
14772
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (07/04/2024-16:29:56)»*/
14783
14773
  /*-----------------------------------------------------------------------------*/
14784
14774
 
14785
14775
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.921",
3
+ "version": "0.0.923",
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)",