aotrautils-srv 0.0.652 → 0.0.654

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 (20/10/2023-00:09:48)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (20/10/2023-00:13:48)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -5057,40 +5057,42 @@ class OpenAIAPIClient{
5057
5057
  lognow("------------self.apiURL:",self.apiURL);
5058
5058
 
5059
5059
 
5060
- const result=()=>{
5060
+ return async ()=>{
5061
5061
  const p=new Promise((resolve,reject)=>{
5062
- fetch(self.apiURL, {
5063
- method: "POST",
5064
- headers: {
5065
- "Authorization": "Bearer "+self.apiKey,
5066
- "Content-Type": "application/json",
5067
- },
5068
- body: JSON.stringify({
5069
- model:self.modelName,
5070
- messages,
5071
- }),
5072
- })
5073
- .then(response => response.json())
5074
- .then(data => {
5075
- // DBG
5076
- // console.log("data :",data);
5077
- const assistantReply = data.choices[0].message.content;
5078
- resolve(assistantReply);
5079
- })
5080
- .catch(error => {
5081
- // TRACE
5082
- console.error("Error:", error);
5083
- reject(""+error);
5084
- });
5085
- };
5062
+ fetch(self.apiURL, {
5063
+ method: "POST",
5064
+ headers: {
5065
+ "Authorization": "Bearer "+self.apiKey,
5066
+ "Content-Type": "application/json",
5067
+ },
5068
+ body: JSON.stringify({
5069
+ model:self.modelName,
5070
+ messages,
5071
+ }),
5072
+ })
5073
+ .then(response => response.json())
5074
+ .then(data => {
5075
+ // DBG
5076
+ // console.log("data :",data);
5077
+ const assistantReply = data.choices[0].message.content;
5078
+ resolve(assistantReply);
5079
+ })
5080
+ .catch(error => {
5081
+ // TRACE
5082
+ console.error("Error:", error);
5083
+ reject(""+error);
5084
+ });
5085
+ });
5086
5086
 
5087
- return await p;
5087
+ const result= await p;
5088
+
5089
+ // DBG
5090
+ console.log("! RESULT text :",result);
5091
+
5092
+ return result;
5088
5093
  }();
5089
-
5090
- // DBG
5091
- console.log("! RESULT text :",result);
5092
5094
 
5093
- return result;
5095
+
5094
5096
  }
5095
5097
 
5096
5098
 
@@ -5118,7 +5120,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
5118
5120
 
5119
5121
 
5120
5122
 
5121
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (20/10/2023-00:09:48)»*/
5123
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (20/10/2023-00:13:48)»*/
5122
5124
  /*-----------------------------------------------------------------------------*/
5123
5125
 
5124
5126
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.652",
3
+ "version": "0.0.654",
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)",