@inductiv/node-red-openai-api 1.0.2 → 1.1.0

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.
package/node.js CHANGED
@@ -33,21 +33,22 @@ module.exports = function (RED) {
33
33
  }
34
34
 
35
35
  const serviceName = node.config.method; // Set the service name to call.
36
+
36
37
  let serviceParametersObject = {
37
- _node: node,
38
- msg: msg,
38
+ "_node": node,
39
+ "payload": payload,
40
+ "msg": msg
39
41
  };
40
42
 
41
43
  // Dynamically call the function based on the service name
42
- const functionName = `${serviceName}`;
43
- if (typeof client[functionName] === "function") {
44
+ if (typeof client[serviceName] === "function") {
44
45
  node.status({
45
46
  fill: "blue",
46
47
  shape: "dot",
47
48
  text: "OpenaiApi.status.requesting",
48
49
  });
49
50
 
50
- client[functionName](serviceParametersObject)
51
+ client[serviceName](serviceParametersObject)
51
52
  .then((payload) => {
52
53
  if (payload !== undefined) {
53
54
  // Update `msg.payload` with the payload from the API response, then send resonse to client.
@@ -66,7 +67,7 @@ module.exports = function (RED) {
66
67
  node.error(errorMessage, { payload: {} });
67
68
  });
68
69
  } else {
69
- console.error(`Function ${functionName} does not exist on client.`);
70
+ console.error(`Function ${serviceName} does not exist on client.`);
70
71
  }
71
72
  });
72
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inductiv/node-red-openai-api",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "Enhance your Node-RED flows with advanced AI capabilities.",
5
5
  "main": "node.js",
6
6
  "engines": {