https://discord.gg/botpress logo
How to Let the Bot Speak SLOWLY? One Sentence A Ti...
# 🤝help
i
Hello Bot Builders, I really need to build** a bot that can talk SLOWLY**: * (1)* one sentence at a time, instead of sending walls of messages;** (2)** do NOT answer any question immediately, maybe wait 5 seconds before sending anything. I have included those in** (a) the first autonomous bot ##instruction, and (b)** the bot's ##communication style. But no change occurred, my bot still sends walls of text immediately... Anyone could please help me? Many thanks in advance!
n
Botpress doesn't have a built-in "delay" in the flow editor UI, but you can use Execute Code cards or custom hooks with JavaScript like this await new Promise(resolve => setTimeout(resolve, 5000)); // Wait for 5 seconds Add this before every text card it will add a delay , use execute code card 🛠️
i
Thank you, however I am using Autonomous Node to ensure the conversation flows, and I don't have Text Card for the chunk of messages the Bot send. Do you think I can add this JavaScript Line to the Automomous Node and make it work? Anyway I will try it!
r
What about just giving it the prompt. Have you tried that
i
Yes I have, in both #instruction and #communication style
p
To force the use of code by an Autonomous node, create an action that contains the code aforementioned and then give the AN the instruction to run the action before every response.
i
Thank you so much!
@prehistoric-airplane-85682 @narrow-flag-58313 I have added the code kindly written by SHRI into the automonos node instruction as the screenshoot, but it has no effect 🥲 Does anyone know if anything else I can do? https://cdn.discordapp.com/attachments/1376208728621187073/1376603379106582680/image.png?ex=6835ed4d&is=68349bcd&hm=0b75966c2a35224699f741c8fc1ebf68caa93c07d00ecfed331099fc78b4c492&
n
In botpress code is executed only if it's run in a executed code card
U can watch the autonomous node video on botpress channel for better understanding of nodes in botpress
@icy-salesclerk-58319 do exactly this to run my code in ur autonomous node
p
You need to use an action to force the autonomous node to use your code.
i
@prehistoric-airplane-85682 @narrow-flag-58313 but when it is an Autonomous Node, there is no "execute code" card available? Only if I make a Standard Node... 😮 How to add this card or what is "use an action" here?
n
Action is a function
In the left side bar
i
@narrow-flag-58313 🥹
n
✨️
Schema are a kind of variables
i
I understand "Schema is a structured variable" - but I don't know what applies here? I want all the meessages to be send slowly, not just some message contain certian variable?
I put the code into an Action and added the Action to my AN, nothing worked...
n
I'm not sure how will it be done for autonomous node
The code will work if u manage to execute it for the autonomous node
i
@narrow-flag-58313 Thank you the same 🥲 @prehistoric-airplane-85682 Sorry I really don't know how to do it here.
n
No worries 👍🏻
i
Can I ask if it works for you EVERY TIME or just the very first message? I only get the Bot to wait for the very first message
Thank you! @prehistoric-airplane-85682 It finally worked in a new AN with barely any other instructions. This time, I do not even need the code, but only instructions in AN. Then my question is: should I set up multiple ANs to prevent the instructions are getting confusing? If I have** multiple ANs in one Workflow**, then:** In one Workflow, is the Context (chat history) of one AN automatically available to another AN's conversation? ** Or I have to set it up?
p
Yes the chat history is shared. It is one variable that contains all the previous messages no matter what node they were sent by. However a difficulty you might encounter from having many ANs is transitioning between them so I would use as little as necessary and with very clear transition conditions. The rest should probably be standard nodes or ANs placed in different workflows based on your use cases.
i
Thank you!
7 Views