https://discord.gg/botpress logo
#🤝help
Bot repeats "question" input if conversation doesn't start with a greeting
# 🤝help
p

powerful-helicopter-39371

06/27/2023, 12:13 PM
Would love help on this - I'm using a knowledge base chatbot (image supplied). If I ask a question instead of a "hey" as the initial message to the chatbot, it answers with the knowledge base, but then repeats the question capture information text. However, If I start the conversation with "hey" and then proceed to ask a question, it does not do this. How do I make the bot flexible so that if someone asks a question as the first message, it just answers the question and does not repeat the "question" capture info"
a

acceptable-kangaroo-64719

06/27/2023, 12:17 PM
Hey @powerful-helicopter-39371, you can try making a transition at the top of your "Check knowledge" node with this code:
!event.state.agentVariables.KnowledgeAgent.turn.responded
. event.....responsed will be
true
if there was an answer from the Knowledge base, and the
!
reverses that so this transition will only kick off if there was not an answer. This transition can then lead to your capture info card.
p

powerful-helicopter-39371

06/27/2023, 12:21 PM
hey Gordy thanks for this! Is where my red arrow the correct place for the transiton?
Do I need to have another card then? For example a greeting card that says "hey blah blah" and another one that says "what can I help you with" and is the question input? or is it fine having it all in one node like I have
a

acceptable-kangaroo-64719

06/27/2023, 12:22 PM
No, you need to add a new "Expression" transition card
p

powerful-helicopter-39371

06/27/2023, 12:23 PM
Okay thanks, and that connects to the "END" node?
a

acceptable-kangaroo-64719

06/27/2023, 12:25 PM
sure. It connects wherever you want to go after the bot doesn't answer a question from the KB
p

powerful-helicopter-39371

06/27/2023, 12:27 PM
@acceptable-kangaroo-64719 , didn't seem to work unfortunetly. When I typed "hey" it immedietly ended the conversation and when I asked a question related to the KB, it stated the correct answer then repeated the question like before
a

acceptable-kangaroo-64719

06/27/2023, 12:29 PM
It's working as designed, our expectations are just misaligned. Right now the transtion will fire if the bot doesn't have an answer (such as when you say hey). If the bot does have an answer, it'll ask the question
You can change this behavior by removing the
!
at the start of the expression
p

powerful-helicopter-39371

06/27/2023, 12:33 PM
Thanks for that Gordy, makes sense. Just another quick one, how would I make the bot say a different text if the bot answers from the KB? For example if it answers the question from the KB, it can then say, do you have any more questions?
a

acceptable-kangaroo-64719

06/27/2023, 12:35 PM
You can make a new node and put that question in the new node. Then link your transition (without the
!
) to that new node.
4 Views