-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to subscribe to all intents with a prefix #13
Comments
One use case i came up with is that it enables a easy way to handle multiple skills via one entrypoint and run a specific function/module only based on the name. |
Shouldn't this already be possible using the standard mqtt topics with this decorator aswell (I did not test it)? @app.on_intent("megaApp/+") to receive all messages one namespace below megaApp and @app.on_intent("megaApp/#") to receive all messages below megaApp. At least for me @app.on_intent("megaApp", prefix = True) is not really clearer, since at least for me it is unclear what prefix means here. It could mean I receive |
This doesn't work at the moment (I just tested it), because the intent names are really interpreted as intent names in
So if we want to support this syntax, we would have to unravel the underlying MQTT topic already in the decorator, taking into account the wildcards, and then the callbacks should be added differently. Or the I'm not convinced yet about having MQTT topic wildcards in the |
Another option would be to completely abstract this namespace away everywhere. So this namespace would simply always be the skill name. @app.on_intent("megaIntent") to listen for @app.on_intent() to listen for |
I like this idea! An app shouldn't listen on intents of other apps anyway. @JonahKr I suppose this still fits your use case? |
I think so. Yes. |
Yes, this already works: rhasspy/rhasspy-hermes#12 (comment) The "real" intent name that Rhasspy sees would then indeed be |
So the only thing holding me back now to implement this change is this: what if someone wants to write an app to react to some "general" intents that have been installed separately, and thus without the app name as a prefix? For instance, on the forum there were some discussions about supplying general intents, like yes/no, common media player intents and so on. Do we want to support this in Rhasspy Hermes App? Or does it make sense to only support intents that are supplied together with the app in an intents file? |
Wouldn't this still be possible by subscribing to wildcards? Something like |
Hm maybe make the decorator on_intent(intent="#", namespace=skill_name) and then have a logic along the lines intent = f"{namespace}/{intent}" if namespace else intent this way the simple default behaviour is @app.on_intent("megaIntent") to listen for @app.on_intent() to listen for and something like @app.on_intent("yes_no", namespace=None) or @app.on_intent("yes_no", namespace="common") to listen to other namespaces |
Something like this could be interesting for some use case:
@app.on_intent("megaApp", prefix = True)
This would then subscribe to intents
megaApp/GetTime
,megaApp/GetDate
and so on.Suggested by @JonahKr
Does anyone have a use case for this?
The text was updated successfully, but these errors were encountered: