Closed developedsoftware closed 1 year ago
You need to create 20 messages.
for (var ....)
instance.newmessage(data).send('output_name');
And I recommend destroying the previous message.
Thanks @petersirka
How would I obtain the "output_name", is it the component id?
How comes they can only be sent once? Just to try and provoke it I am calling $.send('output', data)
20 times and it seems to handle it? Whats the logic behind enforcing methods $.send(), $.destroy() and $.throw() can be executed only once
Sorry for the delay. I forgot to answer.
How would I obtain the "output_name", is it the component id?
Output name means output id
defined in the component declaration: https://github.com/totaljs/flowstreamcomponents/blob/main/components/chatgpt.html#L11
Whats the logic behind enforcing methods $.send(), $.destroy() and $.throw() can be executed only once
Every message has its own life cycle, but there is no complicated logic. It is recommended to send the message only once or to destroy it. If you need to resend the same message several times, create a new message (or clone an existing one). Sending the same message multiple times is not dangerous, but it can cause problems in some cases.
For example, I want one code element to send 20 $.send('output', dataInALoop)
// IMPORTANT: methods $.send(), $.destroy() and $.throw() can be executed only once
So I dont see how this is a possible but would be a very real requirement of a code block?