I was wondering, if it is possible, to keep a skill alive after invoking it to get a kind of dialog with Mycroft.
This would mean that the skill remains active and I wouldn’t have to use the wake word again to continue the conversation and previous variables are still available.
What I mean is that if I have a skill which for example provides the user information about the weather from a certain location at a certain date, the user should also be able to invoke the skill with incomplete information (only date, only location, none of them).
A simple example: User says:Hey Mycroft, what’s the weather for Seattle. Mycroft replies:At what date and time? User says:Tomorrow at 10:00. Mycroft replies:The weather for Seattle at 10am tomorrow will be the following: …
Basically Mycroft replies with the full response - Seattle stored from previous request.
This is just an example, I’m not planning to make a weather skill but I found it easier to explain with this sample.
I already looked through the documentation and the sample- / third party skills but none seem to have this feature.
Is there a way to realize this and if it is possible, how do I have to do it?
I know, that several intents are needed to get full information for the complete request but how are the session variables stored and how do I keep the skill active (no wake-word needed).
right now when missing some parameter (location) i think you can make self.location_flag = True and register an intent for “the location is (Location)” than when triggered checks this flag and resumes original intent execution and turns location_flag = False
(de-register would be good for other skills that also require location parameter, or mycroft wont know for which skill it is directed without messagebus / intent skill voodo)
when missing some parameter you can now register an intent for getting that parameter , a time-out is recommended to de-register that intent (say if in 3 minutes no-one answered, its safe to assume the parameter will never be given)
PR #576 adds simple support for the dialog-like communication. (without needing to say “Hey Mycroft” when answering Mycroft’s questions). Also, I think PR #539 will make this kind of thing more easy and intuitive to handle.
was happy to see that this feature got implemented today .
I am currently storing the variables in a global dict during the session, but I think an approach similar to Alexa’s session attributes would be better.
I don’t think using a global variable is a clean solution, because after a successful execution of the skill, it would have to be reset to {} . An attributes dict or list would be great, which is kept “alive” as long as the expect_response flag is set true in the previous dialog.
For now I’ll just stick to the global variable and keep developing.