wit icon indicating copy to clipboard operation
wit copied to clipboard

After finishing a story strange "echo" from another branch in the same story

Open misysdclabs opened this issue 10 years ago • 7 comments

I have slot-machine like pizza ordering story:

screen shot 2016-07-13 at 14 22 21

I have a separate story for handling when the user thanks my bot the service: screen shot 2016-07-13 at 14 30 43

When I go straightforward with the pizza ordering in the main branch, it works very well. Until I try to thank to the bot for receiving my pizza order... instead of switching into the thank_you story it asks me about which size of pizza do I want (the missingSize branch of order_pizza story). Then for the second "thanks" it finds the way to the thank_you story. I can reproduce this bug (or feature?) any time with this wit app. My log is here:

sessinId: 36706580-48f2-11e6-ba17-8bbc7b272b51

I want a small pizza with tomato and salami pizza context in: {} entities in: {"contact":[{"confidence":0.8280456758027681,"type":"value","value":"I","suggested":true}],"pizza_size":[{"confidence":0.944235900226009,"type":"value","value":"small"}],"pizza_topping":[{"confidence":0.9631527182151784,"type":"value","value":"tomato"},{"confidence":0.9664413795613482,"type":"value","value":"salami"}],"intent":[{"confidence":0.9887004645112,"value":"order_pizza"}]} context out: {"topping_str":"TOMATO","size_str":"SMALL"} sending... {"text":"You want a SMALL pizza with TOMATO, is that right?"} yes commit context in: {"topping_str":"TOMATO","size_str":"SMALL"} entities in: {"yes_no":[{"confidence":0.9682024898498399,"value":"yes"}]} context out: {"topping_str":"TOMATO","size_str":"SMALL","commit_success":"Ok, it's done."} sending... {"text":"Ok, it's done."} reset_context context in: {"topping_str":"TOMATO","size_str":"SMALL","commit_success":"Ok, it's done."} entities in: undefined context out: {} thanks sending... {"text":"Which size do you want?"} thanks sending... {"text":"Welcome :)"}

The log screenshot from the website: screen shot 2016-07-13 at 14 18 23

(Here you can see that the BE goes into finished state after finishing the order_pizza story.. and than goes back into it for the "thanks" input string.)

What am I doing wrong?

Best, Krisztián

misysdclabs avatar Jul 13 '16 13:07 misysdclabs

Under Tab "Actions" you also have to define/add the context for the responses.

jhoelzl avatar Jul 13 '16 13:07 jhoelzl

@jhoelzl, thanks for your hint, now my app works definitely much better.

What do you think about the actions (I mean the functions)? Does it help to define the context params for the actions? I tried to define 'Always if' params, but it turned my stories into red.

misysdclabs avatar Jul 15 '16 08:07 misysdclabs

Hi @misysdclabs, great to hear.

An example:

I have a story called "Call Contact". It is triggered when the person enters the text "call now" , "make a telephone call" or "call maria" etc. This performs the action "callContact" in my python code.

When the contact entity is not present in the initial user text, i add context contactMissing to the context variable in my code. On Wit.ai in my story, i can define a new branch contactMissing after the action "callContact". This is triggered and the bot asks "Which person do you want to call?".

Then the person can enter the contact name and in the Wit.ai story i jump back to the action "callContact".

This text "Which person do you want to call" should only be visible when the context contactMissing is present, therefore under "Actions" i add contactMissing to "Only if" for this bot response.

I also have some other responses and contexts for action "callContact" and i sometimes recognized that Wit.at does not perform the correctly. However, when you add your contexts under the tab "Actions" to your responses, the stories definitely work much better.

jhoelzl avatar Jul 15 '16 09:07 jhoelzl

Hi @jhoelzl , I have something very similar with my pizza ordering example. I have two missing-branch as you can see here on my order_pizza story, switched to the missingTopping branch:

screen shot 2016-07-20 at 10 48 30

And yes, after adding the toppingMissing context to the "Only if" section of this bot answer, it works definitely better:

screen shot 2016-07-20 at 11 24 47

What I'm asking is that did you set anything here for the function calls?

screen shot 2016-07-20 at 11 23 10

I don't see how can it help to improve the stability of the wit.ai app... do you have any experience about it?

misysdclabs avatar Jul 20 '16 09:07 misysdclabs

Hi @misysdclabs , no i haven't set any context for the actions, because the context is set DURING the action (in my code).

After the action the different branches are based on the context output of my action.

jhoelzl avatar Jul 20 '16 10:07 jhoelzl

@l5t I have the same blocking issue. Could you help, please?

gaborlabancz avatar Jul 26 '16 14:07 gaborlabancz

Closing since we will stop Stories and serving requests to the associated /converse endpoint on February 1, 2018: https://wit.ai/blog/2017/07/27/sunsetting-stories

l5t avatar Jan 22 '18 01:01 l5t