What the propper way to include checkpoint in the middle of the story?

My use case is to simplify stories via including checkpoint with login actions. What I’ve tried:

Example of auth_cases.md
## Auth success
> check_auth
  - action_check_auth
  - slot{"auth": true}
> auth_true

## Auth login success
> check_auth
  - action_check_auth
  - slot{"auth": false}
  - followup{"name": "auth_form"}
  - auth_form
  - form{"name": "auth_form"}
  - slot{"auth": true}
  - form{"name": null}
> auth_true

## Auth failed
> check_auth
  - action_check_auth
  - slot{"auth": false}
  - followup{"name": "auth_form"}
  - auth_form
  - form{"name": "auth_form"}
* deny
  - action_deactivate_form
  - form{"name": null}
  - slot{"auth": false}
> auth_failed


## Auth explain failed 
> auth_false
  - action_check_auth
  - slot{"auth": false}
  - followup{"name": "auth_form"}
  - auth_form
  - form{"name": "auth_form"}
  - slot{"requested_slot": "email"}
* explain
  - utter_auth_explain
  - form{"name": "auth_form"}
* deny
  - action_deactivate_form
  - form{"name": null}
  - slot{"auth": false}
  - utter_cancel
> auth_failed
Example of general_stories.md
## general story to deny unauth user
> auth_false
  - utter_cant_do

## example action 1 pass
* request_action_1
> check_auth
> auth_true
  - action_request_action_1

## example action 2 pass
* request_action_2
> check_auth
> auth_true
  - action_request_action_2

It kinda works, but replies are confused: when I request action 1, bot utteres action 2 and so on. It follow checkpoint, but looks like bot forgot what I’ve asked before checkpoint, and gives me random answer after auth.

I’ve also tried increase max_history, but it didn’t help, may be it should be increased even more?

How can I simplify stories?

Hi @selphe,

Try separating your checkpoints in the story - having one checkpoint after another in the same story is not how they’re intended to be used, for example your general_stories.md should look more like this:

## general story to deny unauth user
> auth_false
  - utter_cant_do

## example action 1 request
* request_action_1
> check_auth

## example action 1 pass
> auth_true
  - action_request_action_1

Of course, in order to have two separate request actions, you’ll need to use a slot to keep track of which one was requested.

On another note, what do you mean by “the bot forgot what I’ve asked before checkpoint”?

Seems in my case checkpoints is useless, because it can’t simplify stories like mine… It would be helpful, if checkpoints could work like “inlude”.

Example
## Story 1
* request_story_1
> check_auth_block
> auth_true_block
  - utter_welcome
  - action_story1

## Story 2
* request_story_2
> check_auth_block
> auth_true_block
  - utter_welcome
  - action_story2

## include block 1
> check_auth_block
  - action_check_auth
  - slot{"auth": false}


## include block 2
> auth_true_block
  - auth_form
  - form{"name": "auth_form"}
  - slot{"auth": true}
  - form{"name": null}

In this example, I have a long “include” block with part of story, which will be repeated from story to another story. As result, the target story (Story 1 or Story 2) will be much simple to understand and read, and even simply to debug or edit included part.

May be is there some way to achieve that behaviour in current release?

1 Like