Bot not responding to Q&A questions if the flow is in other than the entry node

In my bot configuration noRepeatPolicy is set to false only. I tried multiple times to get answer for the Q&A questions but bot is only responding to them at start of the flow. Intent is getting identified correctly but not responding correctly.

Even I have made noRepeatPolicy to true and included
BP_DECISION_MIN_NO_REPEAT=10ms env variable. Still no luck

Please help on this. How can my bot respond to Q&A at any point in the flow

Can some one please reply to my query. Thanks in advance.

If I remember correctly, the default behavior of the NLU is to answer Q&A only if you are not in Flow.

Before, we were using the NLP logic. The NLP could jump to a Q&A event if it was in a middle of a flow. This approach came with lots of problems and unexpended behavior :sweat_smile:.

Q&A are fallbacks when your bot is idle (Not in a flow).

I might come back to update this thread.

Thanks Daehli, But what I feel is user can enter random question at any point of flow which we have configured in Q&A for example. If we are only serving then with Q&A at start of flow it don’t make sense as starting message as directly be intent but then user may enter question later. Is there any way that We could access Q&A at any point in flow, service Q&A and come back to same node where it found Q&A.

Thanks in Advance.

Hie @Kishore , welcome to Botpress

You can use a before suggestion hook which elects QnA if there is one with a confidence level that is high enough for complicity. For example:

  if (
    suggestions[0].decision.status === 'dropped' && //check if qna was sidelined
    suggestions[0].confidence > 0.85 && //check if confidence is higher than what you perceive as in this case 85%minimal
    suggestions[0].decision.reason.includes('would have been elected, but already in the middle of a flow') // check if drop reason is because we are in a flow
  ) {
    // Now messing with the decision status and changing it to elected then giving a diplomatic reason for the dude who reads the logs (Hit Me)

    bp.logger.info('Hook detected matching QnA')
    suggestions[0].decision.status = 'elected'
    suggestions[0].decision.reason = 'Elect a QnA at high confidence during a flow'
  }

@Michael_BotpressTeam Suppose I created a flow and middle of the flow users ask somthing that is related to QnA , how the bot will response to that QnA during the flow?

What I use is event.nlu.intent.name === ‘none’ in the transition, so the flow keeps idle waiting for a Q&A, if the user’s input has no intent learnt, then if falls into a flow to help, is there’s a Q&A then it goes for it. The bad thing, is that sometimes waits for the input, and sometimes not, not sure why. If I add “wait for user input” then the user has to enter the question 2 times, first to get into idle and second to answer the question

@Michael_BotpressTeam From time to time with this code I get error

An error occurred on “QA-in-flow.js” on “before_suggestions_election”. TypeError: Cannot read property ‘decision’ of undefined [TypeError, Cannot read property ‘decision’ of undefined]

Any suggestion?