implement skill parent class, change some comments/ documentation

This commit is contained in:
samerbam 2023-09-05 14:37:21 -04:00
parent e2c1936488
commit 4e9b212077
11 changed files with 48 additions and 16 deletions

View File

@ -1,15 +1,15 @@
# A Siri like AI Assistant
* Uses ChatGPT for general queries
* Uses Wolfram Alpha for anything math related
* Has built in NLP (using a NLI model) for determining if we can process query locally
* Uses ChatGPT (or alternative LLM) for general queries
* Uses Wolfram Alpha API for anything math related
* Has built in NLP (using a NLI model) for determining if we can process query locally (skills system)
* Frontend/Backend architecture for ability to deploy lightweight clients
## Skills
- [ ] Translations
- [ ] Alarms
- [ ] Alarms (potentally complete, if we use Timers logic)
- [ ] Calendar
- [ ] Gmail
- [ ] ChatGPT
@ -40,4 +40,8 @@ More examples (includes jwt authentication, though this is in node.js, still use
## Ideas
* Dashboard with api call counts
* Dashboard with api call counts (would require linking into all active skills, callbacks with class inheritance maybe?)
## Wants, but limitations prevent
* *tumble weed bounces by* Oh, dear.

View File

@ -6,6 +6,8 @@ https://developers.google.com/calendar/api/quickstart/python
https://git.imsam.ca/sam/ThermalTodos/src/branch/main/application/sync_calendar.py (readonly application of previous link)
"""
class Cal:
from skills.skill import Skill
class Cal(Skill):
def __init__(self):
self.trigger_phrase = "calendar"

View File

@ -6,6 +6,8 @@ https://developers.google.com/gmail/api/quickstart/python
https://git.imsam.ca/sam/ThermalTodos/src/branch/main/application/sync_calendar.py (for autherizing user)
"""
class Gmail:
from skills.skill import Skill
class Gmail(Skill):
def __init__(self):
self.trigger_phrase = "gmail"

View File

@ -1,5 +1,6 @@
from skills.skill import Skill
class GPT:
class GPT(Skill):
def __init__(self):
self.trigger_phrase = "gpt"

View File

@ -5,8 +5,15 @@ Using notification logic from timers.py to notify at specified time
have web app to access list of reminders? (notion api?)
look into location based reminders and see if thats possible (maybe ntfy.sh supports this?)
Look into using ios reminders url scheme to add reminder to ios reminders app - send url to ios device using ntfy.sh
Even better, use this library: https://github.com/picklepete/pyicloud/blob/master/pyicloud/services/reminders.py
(icloud reminders api, reads/writes reminders from/to ios reminders app)
"""
class Reminders: # ntfy.sh notification?
from skills.skill import Skill
class Reminders(Skill): # ntfy.sh notification?
def __init__(self):
self.trigger_phrase = "reminders"

8
backend/skills/skill.py Normal file
View File

@ -0,0 +1,8 @@
class Skill:
def __init__(self):
self.trigger_phrase = ""
def update_dashboard(self):
"""Call this function to update data for dashboard"""
pass #TODO: When implementing dashboard, have all skills inherit from this class and call update_dashboard when needed.

View File

@ -3,9 +3,11 @@ import requests
if __name__ == "__main__": # Handle running this script directly vs as a project
from config import ntfy_url
from utility import parsetime2
from skill import Skill
else:
from skills.config import ntfy_url
from skills.utility import parsetime2
from skills.skill import Skill
import threading
@ -48,10 +50,10 @@ def run_continuously(schedule, interval=1):
# time.sleep(1)
class Timers:
class Timers(Skill):
def __init__(self):
self.trigger_phrase = "timer"
self.timers = {}
self.timers = {} #This is a good canidate for dashboard data
self.schedule = schedule.Scheduler()

View File

@ -1,5 +1,9 @@
"""
"""
class Todos: # Notion api?
from skills.skill import Skill
class Todos(Skill): # Notion api? reminders app?
def __init__(self):
self.trigger_phrase = "todos"

View File

@ -1,7 +1,7 @@
import requests
from skills.config import deepl_api_key
from skills.config import google_api_key
from skills.skill import Skill
"""
Reading material for this:
@ -10,7 +10,7 @@ https://www.deepl.com/en/docs-api
https://cloud.google.com/translate/docs/overview
"""
class Translations:
class Translations(Skill):
def __init__(self):
self.trigger_phrase = "translate"

View File

@ -1,5 +1,6 @@
from skills.skill import Skill
class Weather: #open weather map api
class Weather(Skill): #open weather map api
def __init__(self):
self.trigger_phrase = "weather"

View File

@ -1,5 +1,6 @@
from skills.skill import Skill
class Wolfram: #wolfram alpha api
class Wolfram(Skill): #wolfram alpha api
def __init__(self):
self.trigger_phrase = "wolfram"