diff --git a/components/api-algorithm.html b/components/api-algorithm.html index a72cf0c..e52832c 100644 --- a/components/api-algorithm.html +++ b/components/api-algorithm.html @@ -17,6 +17,26 @@ config.jyputerid = instance.id; var fn; var values = {}; + var refresh = function() { + + var inputs = {}; + + for (let key in instance.main.meta.flow) { + let m = instance.main.meta.flow[key]; + if (m.connections) { + for (let conn in m.connections) { + for (let c of m.connections[conn]) { + if (c.id === instance.id) + inputs[c.index] = true; + } + } + } + } + + instance.status({ inputs: Object.keys(inputs) }); + + }; + instance.message = function($) { // Getting endpoint from the user const endpointData = { @@ -60,7 +80,8 @@ }; instance.configure(); - + instance.refresh = refresh; + refresh(); }; diff --git a/components/chatgpt.html b/components/chatgpt.html new file mode 100644 index 0000000..ae24cd1 --- /dev/null +++ b/components/chatgpt.html @@ -0,0 +1,359 @@ + + + + + + +
+
Title
+ +
API Key
+ + +
Model
+
Model Override
+ +
URL Override
+ +
System message to set context
+
System Message
+ +
+
+ + +This component can talk to ChatGPT. + +To use custom models and API endpoints, you can use the following fields: + +- Custom models can be used by providing the model name in the model override field. +- Custom API endpoints can be used by providing the URL in the URL override field. + +Custome model and URL override fields will use ChatGPT model. + +## Input + +Input will depend on selected model + +- __CPT 3.5 Turbo__ and __CPT 4__ +```js + +// Object +{ +messages : [{ role: 'user', content: 'Text' }] +} + +// or + + +// Array +[{ role: 'assistant', content: 'Text' }] +``` + +- __Whisper__ +```js + +// Object +{ +path : 'path-to-file' +} + +// or + + +// String +'path-to-file' +``` + +- __CPT 3.5 Turbo instruct__ +```js + +// Object +{ +text : 'your question' +} + +// or + + +// String +'your question' +``` + + +## Output + +Output also depends on selected model +- __CPT 3.5 Turbo__ and __CPT 4__ +```js +'Response from assistant' +``` + +- __Whisper__ +```js + +// Object +{ +text : 'transcipted text' +} +``` +- __CPT 3.5 Turbo instruct__ +```js + +// String +'Response from assistant' +``` + + + +
+ +
NAME v -
+
+ + \ No newline at end of file diff --git a/components/file-read.html b/components/file-read.html index 11be3f2..885c2b5 100644 --- a/components/file-read.html +++ b/components/file-read.html @@ -15,22 +15,28 @@ exports.make = function(instance, config) { instance.message = function($) { - $.send('output', instance.getData()); + $.send('output', instance.getData($.data)); $.destroy(); }; - instance.getData = function() { + instance.getData = function(inputData) { var fileData = ""; + console.log(["inputData",inputData]); + var fileToRead = config.path; + if (typeof inputData === 'object' && inputData !== null && 'file' in inputData) { + fileToRead = inputData.file; + console.log("Input data has file attribute name will be using its value: " + fileToRead); + } + if (!fileToRead) { + instance.throw('Not file to read configured or passed in.'); + return; + } try { - if (!config.path) - return; - console.log(["path", config.path]); - var path = config.path[0] === '~' ? PATH.root(config.path.substring(1)) : config.path; - console.log(["path2", path]); + console.log(["path", fileToRead]); + var path = fileToRead[0] === '~' ? PATH.root(fileToRead.substring(1)) : fileToRead; var file = F.Fs.readFileSync(path); - console.log(["file", file]); NOW = new Date(); - instance.status({ used: NOW, size: file.length }); + instance.status({ used: NOW, size: file.length, path: fileToRead }); console.log(["config.parser", config.parser]); switch (config.parser) { case 'json': @@ -65,7 +71,7 @@
-
Path
+
Path
Absolute path to the file. The path starts with the ~ char will watch filename in the project's root directory.
@@ -90,6 +96,6 @@

-
+