AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Hey i need help in my project
 
 

hey everybody i have a problem in my final year project:

<category>
        <
pattern>JANIS</pattern>
        <
template>
            <
random>
                <
li>Yes?</li>
                <
li>At your service</li>
                <
li>Thats me name.</li>
                <
li>Im here </li>
                <if 
exists="true" name="username" ><li><get name="username"/></li></if>
            </
random>
        </
template>
 </
category

now, when i insert “JANIS” it picks one of the <li>s there but not the one with the <if> even though it has the username. i tried to delete every other option, so that it will have to pick it, and its just blank. please help me guys! Thanks ahead

 

 
  [ # 1 ]

A few things with this category:

1 - Your <if> tags are not within <li> tags and so will never be called.
2 - <if> is depreciated now. You should use <condition> instead.
3 - Even if the <if> did work, if the username hasn’t been set, the bot will produce a blank response.

Try this:

<category>
        <
pattern>JANIS</pattern>
        <
template>
            <
random>
                <
li>Yes?</li>
                <
li>At your service</li>
                <
li>Thats me name.</li>
                <
li>Im here </li>
                <
li>
                    <
condition name="username">
                    <
li value="*"><get name="username"/></li>
                    <
li>Can I help you?</li>
                    </
condition>
                 </
li>
            </
random>
        </
template>
 </
category
 

 
  [ # 2 ]
Steve Worswick - Aug 13, 2016:

A few things with this category:

1 - Your <if> tags are not within <li> tags and so will never be called.
2 - <if> is depreciated now. You should use <condition> instead.
3 - Even if the <if> did work, if the username hasn’t been set, the bot will produce a blank response.

Try this:

<category>
        <
pattern>JANIS</pattern>
        <
template>
            <
random>
                <
li>Yes?</li>
                <
li>At your service</li>
                <
li>Thats me name.</li>
                <
li>Im here </li>
                <
li>
                    <
condition name="username">
                    <
li value="*"><get name="username"/></li>
                    <
li>Can I help you?</li>
                    </
condition>
                 </
li>
            </
random>
        </
template>
 </
category

Thanks a lot man really helped me!

 

 
  login or register to react