aotrautils 0.0.677 → 0.0.679

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