newbotjs / newbot-framework

Framework to create chatbots on all platforms and on the browser - https://newbot.io
40 stars 5 forks source link

Problem faced in the quiz bot. #6

Closed dhannya34 closed 4 years ago

dhannya34 commented 4 years ago

I faced an issue running the Quiz bot, it's not showing 2nd question after I have selected 1st answer option. It's not propagating the loop. Could you please help me fix this issue.

I think there's a problem with this line:- index = Array.indexOf(question.choices, :text) Screenshot from 2019-10-05 15-39-00

RSamaium commented 4 years ago

Thanks for indicating the bug

You can update the version in your project :

npm install newbot@latest

dhannya34 commented 4 years ago

But it couldn't classify the correct and incorrect answers. Screenshot from 2019-10-09 16-17-13 Here it incorrectly classified the correct answer as 'It's wrong'. Could you please fix this issue.

RSamaium commented 4 years ago

I do not have any worries on my side. Can you send me the logs (Debug tab> Download Log)

dhannya34 commented 4 years ago

I have attached the Log. newbot_log_4_2019-10-10T11_20_25.084Z.zip

RSamaium commented 4 years ago

Ok, you have two solutions (to choose) :

Use index = Array.indexOf(question.choices, :text) in your conversational code

or

create your own function

In your JS file :

import formats from 'newbot-formats'
import code from './quiz.converse'

export default {
    code,
    skills: {
        formats
    },
    functions: {
        indexOf(array, text) {
            return array.indexOf(text)
        }
    }
}

and use your function :

Use index = indexOf(question.choices, :text) in your conversational code