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();How to create variable once time ?
-
@J404 said in How to create variable once time ?:
Hello, when i set variable, i want that the variable create only on the first execution of script but when i launch my bot for each repetition the variable will be create. How to solve it ? Thanks !
You can use the global variable as the main variable, or as an indicator for the condition of the first start.
-
@J404 said in How to create variable once time ?:
@Fox No because it's a counter of repetitions per thread i can't use global variable
Local variables will be reset when the stream ends. Either loop the work, or use the object in a global variable.
In any case, this is not a good logic of work. What are you doing this for? What problem are you trying to solve?
-
@J404 said in How to create variable once time ?:
@Fox I want count the number of registering per thread then sleep the thread during 24 hours
And why do you need a condition for each thread that will be executed only 1 time?
-
@Fox I want only "Set Variable" runs once time to keep the increased value.
For exemple :
My bot set variable count=0
Make account
Increment count (count+1)
REPEAT without reset count variableThread 2 same logic but count of thread 1 must be unattached of thread 2