It does not work if I do this:
const OpenAI = require('openai'); const openai = new OpenAI({ apiKey: [[CHATGPTAPIKEY]] }); async function main() { const completion = await openai.chat.completions.create({ model: [[MODEL]], messages: [ {"role": "system", "content": "You are a "+[[COMMENTSTYLE]]+" assistant."}, {"role": "user", "content": [[SAVED_TEXT]]} ], temperature: [[TEMPERATURE2]], max_tokens: 150, stop: ["\n", "User:"], n: 1 }); [[OUTPUT]] = completion.choices[0]; } main();Execute Code - Functions Misplaced
-
Long time everyone, been really busy.
I've noticed the Execute Code action does not format the Functions above _on_start anymore._call(_on_start, null)!This causes the following errors/issues;
When calling a function from _call_section(BucketOne,1,2,5)! the function is not found because the functions are never defined in the new thread. Any code from the bottom of _call(_on_start, null)! will not be defined/run in any new threads.I had to convert my code from inside the script to a module for the time being. Before all the functions would get placed above the _on_start, but doesn't seem to be doing that anymore.
I added a test script below and an Image explaining where it should be.

Download:
Execute-Code_Function ScriptIf you need/want I have a project that responds with an error that works based on custom Modules I've been working on.
Before this error would beIS Now: TypeError: Result of expression '_ARG[0]' [undefined] is not an object. during execution of action WAS: TypeError: Result of expression 'func' [undefined] is not an object. during execution of actionThanks -
Allister -
@allister Ok, finally I got your point. You define function as actions in Main function.
_call(_on_start, null)!is placed only after functions defined through main interface.So in order to make it work, you need to create BucketOne and BucketTwo function through main interface and place code inside it with "Execute code" action, like this https://drive.google.com/uc?id=1pIAaHwmEDpz5D3Iiw8MWyRvmPGlYm5-R&export=download