Sessions

A unique feature of Dinkum is sessions. These are managed by the intent service, and allow for centralized deconfliction of the GUI and TTS systems.

With sessions, skill intent handlers change from:

def handle_intent(self):
    self.speak_dialog("my-dialog", data={"x": 1})
    self.gui["y"] = 2
    self.gui.show_page("my-page.qml")

to this:

def handle_intent(self):
    return self.end_session(
        dialog=("my-dialog", {"x": 1}),
        gui=("my-page.qml", {"y": 2})
    )

Rather than executing commands to control the GUI and TTS, the skill is returning a message that expresses what it wants to do. The session manager (intent service) can then decide whether or not to do it.

A new session begins when an utterance is received, and is usually ended by a skill's intent handler (self.end_session()). When the session is over, the GUI returns to the home screen after all TTS has been spoken.

Exceptions to the default flow include:

  • Using self.continue_session(expect_response=True) to get a response from the user.

    • The skill's raw_utterance method is called with the utterance

  • Common Query/Play

    • The parent skill uses continue_session and expects the child skill to end it

Last updated