superscriptjs / superscript

A dialogue engine for creating chat bots
http://superscriptjs.com
MIT License
1.65k stars 209 forks source link

Resolving issue #375. During conversation the match should retain topic #386

Open alexraj opened 6 years ago

alexraj commented 6 years ago

During conversation the match should retain topic

Description

When the topic is switched, and the first gambit is a conversation, it always matches the first topic, rather than switched topic. For more detail refer https://github.com/superscriptjs/superscript/issues/375

Motivation and Context

When there are multiple topics with same request gambit, we get multiple replies. The reply inside the current topic should be selected, rather than the first one in replies array. The fix is to move the reply in current topic to beginning of the array.

https://github.com/superscriptjs/superscript/issues/375

How Has This Been Tested?

The code is tested with existing test cases. All test cases pass. 6 test cases are added, and all of them passed.

For the expected behavior, tested with the scenario given in issue #375

Screenshots (if appropriate):

Types of changes

Checklist:

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.2%) to 80.388% when pulling 52fea2a18a3882c13dbb9c0154bbac7c50f21475 on alexraj:retain-topic-during-conversation into 37f2be9c149112db924f817faa3726ed2c648c27 on superscriptjs:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.07%) to 80.622% when pulling 6960aae4ad7bf89b765f25791009ddacabf1dada on alexraj:retain-topic-during-conversation into 37f2be9c149112db924f817faa3726ed2c648c27 on superscriptjs:master.