aotrautils 0.0.676 → 0.0.678

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 (21/10/2023-15:48:47)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (21/10/2023-17:09:22)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -5057,64 +5057,75 @@ class OpenAIAPIClient{
5057
5057
  lognow("------------self.apiURL:",self.apiURL);
5058
5058
 
5059
5059
 
5060
- return await (()=>{
5061
- const p=new Promise((resolve,reject)=>{
5062
- fetch(self.apiURL, {
5063
- method: "POST",
5064
- headers: {
5065
- "Authorization": "Bearer "+AIAPIKey,
5066
- "Content-Type": "application/json",
5067
- },
5068
- body: JSON.stringify({
5069
- model:self.modelName,
5070
- messages,
5071
- }),
5072
- })
5073
- // STRANGE : DOES NOT WORK !!:
5074
- //.then(response => response.json())
5075
- // STRANGE : DOES WORK :
5076
- .then(response => {
5077
-
5078
- // DBG
5079
- console.log("~~~~~~~~~~~response :",response);
5080
-
5081
- return response.json();
5082
- })
5083
- .then(data => {
5084
-
5085
- if(data.error){
5086
- const error=data.error;
5087
- // TRACE
5088
- console.error("Error:", error);
5089
- reject(""+error);
5090
- return;
5091
- }
5092
-
5093
- // DBG
5094
- console.log("~~~~~~~~~~~data :",data);
5095
-
5096
- const assistantReply = data.choices[0].message.content;
5097
- resolve(assistantReply);
5098
- })
5099
- .catch(error => {
5100
- // TRACE
5101
- console.error("Error:", error);
5102
- reject(""+error);
5103
- });
5104
- });
5105
-
5106
- const result=await p;
5060
+ //return await (()=>{
5061
+
5107
5062
 
5108
- // DBG
5109
- console.log("! RESULT text :",result);
5110
-
5111
- return result;
5112
- })();
5063
+ const result=await this.launchRequest();
5064
+
5065
+ // DBG
5066
+ console.log("! RESULT text :",result);
5067
+
5068
+ return result;
5069
+ //})();
5113
5070
 
5114
5071
 
5115
5072
  }
5116
5073
 
5117
5074
 
5075
+ launchRequest(){
5076
+
5077
+ const p=new Promise((resolve,reject)=>{
5078
+
5079
+ fetch(self.apiURL, {
5080
+ method: "POST",
5081
+ headers: {
5082
+ "Authorization": "Bearer "+AIAPIKey,
5083
+ "Content-Type": "application/json",
5084
+ },
5085
+ body: JSON.stringify({
5086
+ mdel:self.modelName,
5087
+ messages,
5088
+ }),
5089
+ })
5090
+ // STRANGE : DOES NOT WORK !!:
5091
+ //.then(response => response.json())
5092
+ // STRANGE : DOES WORK :
5093
+ .then(response => {
5094
+
5095
+ // DBG
5096
+ console.log("~~~~~~~~~~~response :",response);
5097
+
5098
+ return response.json();
5099
+ })
5100
+ .then(data => {
5101
+
5102
+ if(data.error){
5103
+ const error=data.error;
5104
+ // TRACE
5105
+ console.error("Error:", error);
5106
+ reject(""+error);
5107
+ return;
5108
+ }
5109
+
5110
+ // DBG
5111
+ console.log("~~~~~~~~~~~data :",data);
5112
+
5113
+ const assistantReply = data.choices[0].message.content;
5114
+ resolve(assistantReply);
5115
+ })
5116
+ .catch(error => {
5117
+ // TRACE
5118
+ console.error("Error:", error);
5119
+ reject(""+error);
5120
+ });
5121
+
5122
+
5123
+ });
5124
+
5125
+ return p;
5126
+ }
5127
+
5128
+
5118
5129
  }
5119
5130
 
5120
5131
 
@@ -5135,7 +5146,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
5135
5146
 
5136
5147
 
5137
5148
 
5138
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (21/10/2023-15:48:47)»*/
5149
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (21/10/2023-17:09:22)»*/
5139
5150
  /*-----------------------------------------------------------------------------*/
5140
5151
  /* ## Utility global methods in a browser (htmljs) client environment.
5141
5152
  *
@@ -13377,7 +13388,7 @@ createOritaMicroClient=function(url, port, isNode=false, staticMicroClientIdPara
13377
13388
 
13378
13389
 
13379
13390
 
13380
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (21/10/2023-15:48:47)»*/
13391
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (21/10/2023-17:09:22)»*/
13381
13392
  /*-----------------------------------------------------------------------------*/
13382
13393
 
13383
13394
 
@@ -14616,7 +14627,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14616
14627
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14617
14628
 
14618
14629
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14619
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (21/10/2023-15:48:47)»*/
14630
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (21/10/2023-17:09:22)»*/
14620
14631
  /*-----------------------------------------------------------------------------*/
14621
14632
 
14622
14633
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.676",
3
+ "version": "0.0.678",
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)",