-
-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
Description
tests for #12
from ovos_utils.fakebus import FakeBus, Message
from ovos_workshop.decorators import intent_handler, conversational_intent
from ovos_workshop.skills import OVOSSkill
class DogFactsSkill(OVOSSkill):
@intent_handler("dog_facts.intent")
def handle_intent(self, message):
fact = "Dogs sense of smell is estimated to be 100,000 times more sensitive than humans"
self.speak(fact)
@conversational_intent("another_one.intent")
def handle_followup_question(self, message):
fact2 = "Dogs have a unique nose print, making each one distinct and identifiable."
self.speak(fact2)
if __name__ == "__main__":
s = DogFactsSkill(skill_id="test", bus=FakeBus())
r = s.converse_matchers["en-us"].calc_intent("another one")
print(r) # {'entities': {}, 'conf': 1, 'name': 'test.converse:another_one.intent'}
m = Message(f"test.converse.request", {"utterances": ["one more"]})
def handle_speak(m):
print(m.data)
# {'utterance': 'Dogs have a unique nose print, making each one distinct and identifiable.',
# 'expect_response': False, 'meta': {'skill': 'test'}, 'lang': 'en-us'}
s.bus.on("speak", handle_speak)
s.bus.emit(m)