Skip to content
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

missing tests for conversational intents #191

Open
JarbasAl opened this issue Mar 19, 2024 · 0 comments
Open

missing tests for conversational intents #191

JarbasAl opened this issue Mar 19, 2024 · 0 comments

Comments

@JarbasAl
Copy link
Member

JarbasAl commented Mar 19, 2024

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)
@JarbasAl JarbasAl added the good first issue Good for newcomers label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant