I want to integrate my web application with IBM's dialog api. Basically, I want to sometimes send the pure text result from the IBM dialog API, as I set it up in the XML, and other times, such as when the user wants a dynamic response, which might involve me querying a database to find an account balance, for example. My current thought is to include some sort of syntax in my dialog XML which I can parse to know if the response from the conversation requires me to change it. I was thinking of something like:
<input>
<grammar>
<item>What is my account balance?</item>
</grammar>
<output>
<prompt selectionType="RANDOM">
<item>{ACTION_GETBALANCE}</item>
</prompt>
</output>
</input>
So if I got a response like {ACTION_***} I would take my own action. Is this an appropriate way of doing this? Is there another way which might be better?
答案 0 :(得分:1)
这确实是推荐的方法
请参阅dialog file上提供的电影应用示例WDC git repo上的第1358行
<prompt selectionType="RANDOM">
<item>"{Search_Now:"{Search_Now}", Recency:"{Recency_Preference}", Rating:"{Certification_Preference}", Genre:"{Genre_Preference}", Index:"{Current_Index}", Page:"{Page}"}"</item>
</prompt>
&#13;