Skip to content

Commit

Permalink
feat(server): verify if all slots are filled
Browse files Browse the repository at this point in the history
  • Loading branch information
louistiti committed Mar 27, 2022
1 parent b6f79e0 commit e27c1b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions server/src/core/conversation.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ class Conversation {
return this._activeContext.slots[notFilledSlotKey]
}

/**
* Check whether slots are all filled
*/
areSlotsAllFilled () {
return !this.getNotFilledSlot()
}

/**
* Clean up active context
*/
Expand Down
5 changes: 4 additions & 1 deletion server/src/core/nlu.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,11 @@ class Nlu {

return resolve()
}

if (!this.conv.areSlotsAllFilled()) {
this.brain.talk(`${this.brain.wernicke('random_context_out_of_topic')}.`)
}

this.brain.talk(`${this.brain.wernicke('random_context_out_of_topic')}.`)
this.conv.cleanActiveContext()

/**
Expand Down

0 comments on commit e27c1b9

Please sign in to comment.