Skip to content

Commit

Permalink
fix(core): don't send suggested replies when in middle of flow
Browse files Browse the repository at this point in the history
  • Loading branch information
slvnperron committed Dec 4, 2018
1 parent b67aa8b commit 5248bc2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bp/core/services/dialog/decision-engine.ts
Expand Up @@ -21,7 +21,9 @@ export class DecisionEngine {
private readonly MIN_CONFIDENCE = process.env.BP_DECISION_MIN_CONFIENCE || 0.3

public async processEvent(sessionId: string, event: IO.IncomingEvent) {
if (event.suggestedReplies) {
const isInMiddleOfFlow = _.get(event, 'state.context.currentFlow', false)

if (event.suggestedReplies && !isInMiddleOfFlow) {
const bestReply = this._findBestReply(event)
if (bestReply) {
await this._sendSuggestedReply(bestReply, sessionId, event)
Expand Down

0 comments on commit 5248bc2

Please sign in to comment.