Search code examples
javachatbotaiml

AIML on program-ab : chatbot flow doesn't work with topic tags


Appreciate anyone who can help me with this. I tried running the AIML below on program-ab, but it doesn't work. Specifically, it skips 'step003'. Anyone who can enlighten me on what is wrong?

There is no error, but the input keeps skipping into the next step and the resulting output is different from the input keyed in. Would be great if anyone knows what's wrong. Thanks.

<?xml version="1.0" encoding="UTF-8"?>
<aiml version="2.0">
<category>
    <pattern># Product engine #</pattern>
    <template>
<think><set name="topic">step001</set></think> 
What is your age bracket?
A: less than 17
B: 18-30
C: 31-60
D: more than 61
</template>
</category>

<topic name = "step001"> 
<category>
    <pattern>#</pattern>
    <template>
What is your income bracket per year?
A: less than 12000
B: 12001-30000
C: 30001-60000
D: more than 60000

    <think><set name="agebracket"><star/></set><set name="topic">step002</set></think> 
    </template>
</category>
</topic>

<topic name = "step002">
<category>
    <pattern>#</pattern>
    <that> # less than 12000 # </that>
    
    <template>
What is your total current loan ?
A: less than 100000
B: 100001-300000
C: 300001-600000
D: more than 600000

    <think><set name="incbracket"><star/></set><set name="topic">step003</set></think> 
    </template>
</category>
</topic>

<topic name = "step003">
<category>
    <pattern>#</pattern>
    <template>
agebracket=<get name="agebracket"/>
incomebracket=<get name="incbracket"/>
gender=M
curloanbracket=<set name="loanbracket"><star/></set>

</template>
</category>
</topic>
</aiml>


Solution

  • The code works. It is a noob mistake when I started previously. I forgot to delete the cached files that contain old flow. Anyone interested in doing some flows may use the approach. Thanks.