Skip to content

Latest commit

 

History

History
36 lines (30 loc) · 1.45 KB

completion.md

File metadata and controls

36 lines (30 loc) · 1.45 KB

Completion

Parsers may not be able to complete a command from a single message. When that happens, they need to store a fragment and prompt for completion.

Prompts happen one field at a time, without any knowledge of other fields that may yet need to be filled (knowing would be impossible, since the required fields may depend on defined ones).

The completion model is based on the programming model of the AWS Lex service, which uses a slotToElicit parameter to indicate that a slot (field) still needs to be filled.

Example

  1. User pings Bot
  2. Listener sends Message
  3. Lex Parser handles Message
    1. Parser sends message to Lex runtime
      1. Response has slotToElicit set
    2. Parser creates a completion Command (completion:create)
  4. Completion Controller handles Command
    1. Controller creates and saves Fragment
    2. Controller sends a Message prompting user for the next field
  5. Listener responds to user with completion code
  6. User responds with value
  7. Listener sends Message
  8. Completion Parser handles Message
    1. Parser extracts next value
    2. Parser loads Fragment
    3. Parser forwards (Fragment, value) to original Parser
  9. Lex Parser completes Fragment
    1. Parser sends next value to Lex runtime
    2. Parser merges (next) response slots with (prev) fragment data
    3. Parser executes complete Command