diff --git a/CHANGELOG.md b/CHANGELOG.md index 3289443..20c8662 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log +## [1.2.15] - 2024-01-12 + +### Changed + +- Properly store credentials so they don't accidentally get exported in a flow + ## [1.2.14] - 2024-01-12 ### Changed diff --git a/chatgpt.html b/chatgpt.html index 523f59c..7cd1534 100644 --- a/chatgpt.html +++ b/chatgpt.html @@ -4,11 +4,13 @@ color: '#10A37F', defaults: { name: { value: "" }, - API_KEY: { value: "", required: true }, - Organization: { value: "", required: true }, topic: { value: ""}, BaseUrl: { value: "https://api.openai.com" } }, + credentials: { + API_KEY: {type:"text", required: true }, + Organization: { type:"text", required: false }, + }, inputs:1, outputs:1, icon: "arrow-in.png", diff --git a/chatgpt.js b/chatgpt.js index 2cd31d5..2ac8f32 100644 --- a/chatgpt.js +++ b/chatgpt.js @@ -19,9 +19,9 @@ module.exports = (RED) => { const node = this; RED.nodes.createNode(node, config); - // Extract API key and organization information from node configuration - const API_KEY = config.API_KEY; - const ORGANIZATION = config.Organization; + // Extract API key and organization information from credentials + const API_KEY = this.credentials.API_KEY; + const ORGANIZATION = this.credentials.Organization; // Create OpenAI configuration with the provided API key and organization const configuration = new Configuration({ @@ -353,5 +353,10 @@ module.exports = (RED) => { }; // Register the node type with Node-RED - RED.nodes.registerType("chatgpt", main); + RED.nodes.registerType("chatgpt", main, { + credentials: { + API_KEY: {type:"text"}, + Organization: { type:"text"}, + }, + }); };