+
+
+
+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.