This repository has been archived on 2023-06-09. You can view files and clone it, but cannot push or open issues or pull requests.
jarvis-server/jarvis/skills/research/wikipedia/__init__.py

22 lines
755 B
Python

from jarvis.skills import Skill, SkillRegistering
from jarvis.skills.decorators import intent_file_handler
from jarvis.skills.research.wikipedia import wikipedia
class WikipediaSkill(Skill, metaclass=SkillRegistering):
def __init__(self, data=dict):
super().__init__("WikipediaSkill", data)
@intent_file_handler("search.wikipedia.intent", "WikipediaQueryIntent")
def handle_wikipedia_query_intent(self, data):
if 'query' in data:
# TODO : say somethink like "i'm searching..."
print("[INTENT RESULT] : " + wikipedia.page_summary(query=data['query']))
else:
# TODO: fallback to duckduckgo or wolfram alpha
pass
def create_skill(data):
return WikipediaSkill(data)