From 8b8309d09a1ac799d7fbecfb62cb2ff8f3f850c3 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:23:07 -0700 Subject: [PATCH 01/20] Update dependencies to allow for latest OVOS packages (#78) * U[date dependencies to allow for latest OVOS packages * Update skill.json * Wait for update to troubleshoot intent test failure * Update minerva test dependency and intent test config * Fix typo in intent test config * Annotate TODO in test dependencies --------- Co-authored-by: Daniel McKnight Co-authored-by: NeonDaniel --- requirements.txt | 6 ++++-- requirements/test.txt | 4 +++- skill.json | 7 ++++--- test/test_intents.yaml | 4 +++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2921eda..48b95f0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,6 @@ -neon-utils~=1.0,!=1.9.0 +# TODO: network patching dependency resolution +neon-utils[network]~=1.0,>=1.11.1a3 beautifulsoup4~=4.0 ovos-utils~=0.0, >=0.0.28 -ovos-bus-client~=0.0.3 +ovos-bus-client~=0.0,>=0.0.3 +ovos-workshop~=0.0,>=0.0.12 \ No newline at end of file diff --git a/requirements/test.txt b/requirements/test.txt index cf7f108..7ba22e9 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1 +1,3 @@ -neon-minerva[padatious]~=0.2 \ No newline at end of file +# TODO: Update to released dependency spec. +#neon-minerva[padatious]~=0.2 +neon-minerva[padatious]@git+https://github.com/neongeckocom/neon-minerva@FEAT_BetterCommonQueryTesting \ No newline at end of file diff --git a/skill.json b/skill.json index d9f7b21..380539d 100644 --- a/skill.json +++ b/skill.json @@ -15,9 +15,10 @@ "requirements": { "python": [ "beautifulsoup4~=4.0", - "neon-utils~=1.0,!=1.9.0", - "ovos-bus-client~=0.0.3", - "ovos-utils~=0.0, >=0.0.28" + "neon-utils[network]~=1.0,>=1.11.1a3", + "ovos-bus-client~=0.0,>=0.0.3", + "ovos-utils~=0.0, >=0.0.28", + "ovos-workshop~=0.0,>=0.0.12" ], "system": {}, "skill": [] diff --git a/test/test_intents.yaml b/test/test_intents.yaml index e094305..591ae83 100644 --- a/test/test_intents.yaml +++ b/test/test_intents.yaml @@ -60,4 +60,6 @@ common query: callback: - results - message - - user \ No newline at end of file + - user + +ready event: _update_event \ No newline at end of file From a66f31b48fab468100a1fd88f92caf6fed990dbb Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Wed, 18 Sep 2024 17:23:21 +0000 Subject: [PATCH 02/20] Increment Version to 1.0.3a1 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index eca46e5..d2c0564 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "1.0.2" +__version__ = "1.0.3a1" From e1c8f5f1855967eec82e8ff15911578f3ed84712 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:04:52 -0700 Subject: [PATCH 03/20] Update PyPI shared action to troubleshoot GHA failure (#79) Co-authored-by: Daniel McKnight --- .github/workflows/publish_test_build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish_test_build.yml b/.github/workflows/publish_test_build.yml index 48d6f0e..06abe1b 100644 --- a/.github/workflows/publish_test_build.yml +++ b/.github/workflows/publish_test_build.yml @@ -10,7 +10,8 @@ on: jobs: build_and_publish_pypi: - uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@master + # TODO: Update to `master` branch + uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@REF_UpdateAlphaReleaseActionVersions secrets: inherit with: version_file: "version.py" From 40c5e6bf0674ad5fbfc94cd0a718c183b1d5f600 Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Wed, 18 Sep 2024 18:05:06 +0000 Subject: [PATCH 04/20] Increment Version to 1.0.3a2 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index d2c0564..2561151 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "1.0.3a1" +__version__ = "1.0.3a2" From d148feb777938f509b3943b0e1990040b70ff004 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:43:42 -0700 Subject: [PATCH 05/20] Add `workflow_dispatch` build trigger to diagnose build errors (#80) Co-authored-by: Daniel McKnight --- .github/workflows/publish_test_build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish_test_build.yml b/.github/workflows/publish_test_build.yml index 06abe1b..6b026ec 100644 --- a/.github/workflows/publish_test_build.yml +++ b/.github/workflows/publish_test_build.yml @@ -2,6 +2,8 @@ name: Publish Alpha Build on: + # TODO: Remove dispatch trigger + workflow_dispatch: push: branches: - dev From a7cdd456c900afd17bd25cadc1bf7c361fe805ac Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Wed, 18 Sep 2024 18:43:56 +0000 Subject: [PATCH 06/20] Increment Version to 1.0.3a3 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 2561151..f64f177 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "1.0.3a2" +__version__ = "1.0.3a3" From c8cf731360f9a490b447647f9929fd1a884b4163 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:34:44 -0700 Subject: [PATCH 07/20] Remove git dependency causing PyPI failure (#81) Skip tests depending on unreleased dependency Co-authored-by: Daniel McKnight --- .github/workflows/publish_test_build.yml | 2 -- .github/workflows/skill_tests.yml | 5 +++-- requirements/test.txt | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish_test_build.yml b/.github/workflows/publish_test_build.yml index 6b026ec..06abe1b 100644 --- a/.github/workflows/publish_test_build.yml +++ b/.github/workflows/publish_test_build.yml @@ -2,8 +2,6 @@ name: Publish Alpha Build on: - # TODO: Remove dispatch trigger - workflow_dispatch: push: branches: - dev diff --git a/.github/workflows/skill_tests.yml b/.github/workflows/skill_tests.yml index 7fad329..65b8485 100644 --- a/.github/workflows/skill_tests.yml +++ b/.github/workflows/skill_tests.yml @@ -10,8 +10,9 @@ jobs: uses: neongeckocom/.github/.github/workflows/python_build_tests.yml@master skill_unit_tests: uses: neongeckocom/.github/.github/workflows/skill_tests.yml@master - skill_intent_tests: - uses: neongeckocom/.github/.github/workflows/skill_test_intents.yml@master +# TODO: Enable with https://github.com/NeonGeckoCom/neon-minerva/pull/25 +# skill_intent_tests: +# uses: neongeckocom/.github/.github/workflows/skill_test_intents.yml@master skill_resource_tests: uses: neongeckocom/.github/.github/workflows/skill_test_resources.yml@master skill_install_tests: diff --git a/requirements/test.txt b/requirements/test.txt index 7ba22e9..cef9dc6 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,3 +1,3 @@ -# TODO: Update to released dependency spec. -#neon-minerva[padatious]~=0.2 -neon-minerva[padatious]@git+https://github.com/neongeckocom/neon-minerva@FEAT_BetterCommonQueryTesting \ No newline at end of file +# TODO: Update dependency for intent tests +neon-minerva[padatious]~=0.2 +#neon-minerva[padatious]@git+https://github.com/neongeckocom/neon-minerva@FEAT_BetterCommonQueryTesting \ No newline at end of file From f9c6c773040f7cbfb0e4d731743e61e34c70990a Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Wed, 18 Sep 2024 21:35:02 +0000 Subject: [PATCH 08/20] Increment Version to 1.0.3a4 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index f64f177..dfc0399 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "1.0.3a3" +__version__ = "1.0.3a4" From a2967913714026c27bd94d76172fc2d0c04525a9 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Tue, 11 Mar 2025 15:04:29 -0700 Subject: [PATCH 09/20] Update automation, gitignore, and license notices (#83) * Update skill.json workflow branches-ignore\nStandardize gitignore\nUpdate License Notices to 2025 * Update license notices to 2025 * Update .gitignore to exclude temporary test files * Update dependencies to stable versions * Update skill.json * Update IntentBuilder import for OVOS compat. * Cleanup test requirements --------- Co-authored-by: NeonDaniel --- .github/workflows/update_skill_json.yml | 2 + .gitignore | 170 +++++++++++++++++++++++- LICENSE.md | 2 +- __init__.py | 4 +- requirements.txt | 3 +- requirements/test.txt | 4 +- setup.py | 2 +- skill.json | 2 +- test/test_skill.py | 2 +- version.py | 2 +- 10 files changed, 175 insertions(+), 18 deletions(-) diff --git a/.github/workflows/update_skill_json.yml b/.github/workflows/update_skill_json.yml index b2c8b93..6630df6 100644 --- a/.github/workflows/update_skill_json.yml +++ b/.github/workflows/update_skill_json.yml @@ -3,6 +3,8 @@ name: Update skill.json on: push: + branches-ignore: + - XLATE_** jobs: update_skill_json: diff --git a/.gitignore b/.gitignore index 9384501..711d8a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,165 @@ -!settingsmeta.yml -*.lock -.idea/ -.msm -*.pyc +# Byte-compiled / optimized / DLL files __pycache__/ -!.github/* \ No newline at end of file +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +# Temproary test files +test/skill_fs diff --git a/LICENSE.md b/LICENSE.md index 525bb37..0fdcf76 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System # All trademark and other rights reserved by their respective owners -# Copyright 2008-2021 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # BSD-3 License Redistribution and use in source and binary forms, with or without modification, are permitted provided that the diff --git a/__init__.py b/__init__.py index 74b0849..b340cb4 100644 --- a/__init__.py +++ b/__init__.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License @@ -35,7 +35,6 @@ from threading import Event, Thread from typing import Optional, Tuple -from adapt.intent import IntentBuilder from bs4 import BeautifulSoup from time import sleep @@ -49,6 +48,7 @@ CQSMatchLevel, CommonQuerySkill from neon_utils import web_utils from ovos_workshop.decorators import intent_handler +from ovos_workshop.intents import IntentBuilder from lingua_franca.parse import normalize diff --git a/requirements.txt b/requirements.txt index 48b95f0..0cbb5b9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ -# TODO: network patching dependency resolution -neon-utils[network]~=1.0,>=1.11.1a3 +neon-utils~=1.12 beautifulsoup4~=4.0 ovos-utils~=0.0, >=0.0.28 ovos-bus-client~=0.0,>=0.0.3 diff --git a/requirements/test.txt b/requirements/test.txt index cef9dc6..9318759 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,3 +1 @@ -# TODO: Update dependency for intent tests -neon-minerva[padatious]~=0.2 -#neon-minerva[padatious]@git+https://github.com/neongeckocom/neon-minerva@FEAT_BetterCommonQueryTesting \ No newline at end of file +neon-minerva[padatious]~=0.3 \ No newline at end of file diff --git a/setup.py b/setup.py index 51b805c..562d234 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License diff --git a/skill.json b/skill.json index 380539d..b19df22 100644 --- a/skill.json +++ b/skill.json @@ -15,7 +15,7 @@ "requirements": { "python": [ "beautifulsoup4~=4.0", - "neon-utils[network]~=1.0,>=1.11.1a3", + "neon-utils~=1.12", "ovos-bus-client~=0.0,>=0.0.3", "ovos-utils~=0.0, >=0.0.28", "ovos-workshop~=0.0,>=0.0.12" diff --git a/test/test_skill.py b/test/test_skill.py index 74d5808..b6a42f7 100644 --- a/test/test_skill.py +++ b/test/test_skill.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System # -# Copyright 2008-2021 Neongecko.com Inc. | All Rights Reserved +# Copyright 2008-2025 Neongecko.com Inc. | All Rights Reserved # # Notice of License - Duplicating this Notice of License near the start of any file containing # a derivative of this software is a condition of license for this software. diff --git a/version.py b/version.py index dfc0399..ad2e9f4 100644 --- a/version.py +++ b/version.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License From f346a3b334e80acc602328322ac798412bed7d83 Mon Sep 17 00:00:00 2001 From: NeonDaniel <34697904+NeonDaniel@users.noreply.github.com> Date: Tue, 11 Mar 2025 22:04:42 +0000 Subject: [PATCH 10/20] Increment Version to 1.0.3a5 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index ad2e9f4..e75643e 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "1.0.3a4" +__version__ = "1.0.3a5" From efa2607cd6ac51ce6ea3b03127d9509a94f76c9d Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Tue, 18 Mar 2025 15:43:04 -0700 Subject: [PATCH 11/20] Refactor to extend ovos_workshop.CommonQuerySkill (#77) * Refactor to extend OVOSSkill * Troubleshoot test failures and warnings * Troubleshoot intent test failure * Troubleshooting unit test failures --- __init__.py | 148 +++++++++++++++++++++++++-------------------- test/test_skill.py | 8 +-- 2 files changed, 85 insertions(+), 71 deletions(-) diff --git a/__init__.py b/__init__.py index b340cb4..fdcd294 100644 --- a/__init__.py +++ b/__init__.py @@ -37,14 +37,14 @@ from typing import Optional, Tuple from bs4 import BeautifulSoup from time import sleep - from lingua_franca import load_language from ovos_bus_client import Message +from ovos_bus_client.message import dig_for_message from ovos_utils import classproperty from ovos_utils.log import LOG from ovos_utils.process_utils import RuntimeRequirements from neon_utils.user_utils import get_user_prefs, get_message_user -from neon_utils.skills.common_query_skill import \ +from ovos_workshop.skills.common_query_skill import \ CQSMatchLevel, CommonQuerySkill from neon_utils import web_utils from ovos_workshop.decorators import intent_handler @@ -84,37 +84,6 @@ def __init__(self, **kwargs): self._update_event = Event() CommonQuerySkill.__init__(self, **kwargs) - @classproperty - def runtime_requirements(self): - return RuntimeRequirements(network_before_load=False, - internet_before_load=False, - gui_before_load=False, - requires_internet=True, - requires_network=True, - requires_gui=False, - no_internet_fallback=True, - no_network_fallback=True, - no_gui_fallback=True) - - @property - def last_updated(self) -> Optional[datetime.datetime]: - if self.settings.get("lastUpdate"): - return datetime.datetime.strptime(self.settings["lastUpdate"], - '%Y-%m-%d %H:%M:%S.%f') - return None - - @property - def ww_enabled(self): - resp = self.bus.wait_for_response(Message("neon.query_wake_words_state")) - if not resp: - LOG.warning("No WW Status reported") - return None - if resp.data.get('enabled', True): - return True - return False - - # TODO: Move to __init__ after stable ovos-workshop - def initialize(self): goodbye_intent = IntentBuilder("CaffeineContentGoodbyeIntent")\ .require("goodbye").build() self.register_intent(goodbye_intent, self.handle_goodbye_intent) @@ -146,6 +115,38 @@ def initialize(self): # combine them as in get_new_info and add rocket chocolate: self._add_more_caffeine_data() + # TODO: Below troubleshooting intent test failures + self._update_event.wait() + + @classproperty + def runtime_requirements(self): + return RuntimeRequirements(network_before_load=False, + internet_before_load=False, + gui_before_load=False, + requires_internet=True, + requires_network=True, + requires_gui=False, + no_internet_fallback=True, + no_network_fallback=True, + no_gui_fallback=True) + + @property + def last_updated(self) -> Optional[datetime.datetime]: + if self.settings.get("lastUpdate"): + return datetime.datetime.strptime(self.settings["lastUpdate"], + '%Y-%m-%d %H:%M:%S.%f') + return None + + @property + def ww_enabled(self): + resp = self.bus.wait_for_response(Message("neon.query_wake_words_state")) + if not resp: + LOG.warning("No WW Status reported") + return None + if resp.data.get('enabled', True): + return True + return False + @intent_handler(IntentBuilder("CaffeineUpdate").require("update_caffeine")) def handle_caffeine_update(self, message): self.speak_dialog("updating") @@ -164,13 +165,13 @@ def handle_caffeine_intent(self, message): self.speak_dialog("no_drink_heard") return - if not self._update_event.isSet(): - self.speak_dialog('one_moment', private=True) + if not self._update_event.is_set(): + self.speak_dialog('one_moment') if not self._update_event.wait(30): LOG.error("Update taking more than 30s, clearing event") self._update_event.set() elif get_user_prefs(message)['response_mode'].get('hesitation'): - self.speak_dialog('one_moment', private=True) + self.speak_dialog('one_moment') if self._drink_in_database(drink): dialog, results = self._generate_drink_dialog(drink, message) @@ -179,35 +180,37 @@ def handle_caffeine_intent(self, message): else: self.speak_dialog("not_found", {'drink': drink}) - if self.neon_core: - if len(results) == 1: - if self.ww_enabled: - self.speak_dialog("how_about_more", - expect_response=True) - self.enable_intent('CaffeineContentGoodbyeIntent') - self.request_check_timeout( - self.default_intent_timeout, - ['CaffeineContentGoodbyeIntent']) - else: - self.speak_dialog("stay_caffeinated") - else: - if self.ask_yesno("more_drinks") == "yes": - self._speak_alternate_results(message, results) - self.speak_dialog("provided_by_caffeinewiz") - else: - self.speak_dialog("stay_caffeinated") + # if self.neon_core: + # if len(results) == 1: + # if self.ww_enabled: + # self.speak_dialog("how_about_more", + # expect_response=True) + # self.enable_intent('CaffeineContentGoodbyeIntent') + # self.request_check_timeout( + # self.default_intent_timeout, + # ['CaffeineContentGoodbyeIntent']) + # else: + # self.speak_dialog("stay_caffeinated") + # else: + # if self.ask_yesno("more_drinks") == "yes": + # self._speak_alternate_results(message, results) + # self.speak_dialog("provided_by_caffeinewiz") + # else: + # self.speak_dialog("stay_caffeinated") else: self.speak_dialog("not_found", {'drink': drink}) - def CQS_match_query_phrase(self, utt, message: Message = None): + def CQS_match_query_phrase(self, phrase: str): + + message = dig_for_message() try: # TODO: Language agnostic parsing here - if " of " in utt: - drink = utt.split(" of ", 1)[1] - elif " in " in utt: - drink = utt.split(" in ", 1)[1] + if " of " in phrase: + drink = phrase.split(" of ", 1)[1] + elif " in " in phrase: + drink = phrase.split(" in ", 1)[1] else: - drink = utt + drink = phrase drink = self._clean_drink_name(drink) if not drink: LOG.debug("No drink matched") @@ -225,12 +228,14 @@ def CQS_match_query_phrase(self, utt, message: Message = None): if not to_speak: # No dialog generated return None - if self.voc_match(utt, "caffeine"): + if self.voc_match(phrase, "caffeine"): + LOG.info(f"Query is about caffeine ({phrase})") conf = CQSMatchLevel.EXACT - elif matched_drink.lower() in utt.lower(): + elif matched_drink.lower() in phrase.lower(): # If the exact drink name was matched # but caffeine not requested, consider this a general match conf = CQSMatchLevel.GENERAL + LOG.debug(f"Drink ({matched_drink}) is in utterance ({phrase})") else: # We didn't match "caffeine" or an exact drink name # this request isn't for this skill @@ -239,12 +244,12 @@ def CQS_match_query_phrase(self, utt, message: Message = None): LOG.error(e) LOG.error(drink) return None - elif drink == utt: + elif drink == phrase: LOG.debug("No drink extracted from utterance") return None else: LOG.debug(f"No match for: {drink}") - if self.voc_match(utt, "caffeine"): + if self.voc_match(phrase, "caffeine"): conf = CQSMatchLevel.CATEGORY results = None to_speak = self.dialog_renderer.render("not_found", @@ -253,7 +258,7 @@ def CQS_match_query_phrase(self, utt, message: Message = None): return None LOG.info(f"results={results}, to_speak={to_speak}") user = get_message_user(message) if message else 'local' - return utt, conf, to_speak, {"user": user, + return phrase, conf, to_speak, {"user": user, "message": message.serialize() if message else None, "results": results} @@ -269,6 +274,7 @@ def CQS_action(self, phrase, data): if len(results) == 1: self.speak_dialog("stay_caffeinated") else: + # This will ask infinitely until the user responds if self.ask_yesno("more_drinks") == "yes": LOG.info("YES") self._speak_alternate_results(message, results) @@ -314,7 +320,6 @@ def handle_goodbye_intent(self, message): # Remove any awaiting confirmation try: user = get_message_user(message) - self.actions_to_confirm.pop(user) except Exception as e: LOG.error(e) @@ -463,8 +468,7 @@ def _normalize_drink_list(drink_list): try: # TODO: Check for CW and CI success if self.from_caffeine_wiz: - self.update_skill_settings({"lastUpdate": str(time_check)}, - skill_global=True) + self.update_skill_settings({"lastUpdate": str(time_check)}) if reply: self.speak_dialog("update_complete") success = True @@ -477,6 +481,16 @@ def _normalize_drink_list(drink_list): self._update_event.set() return success + def update_skill_settings(self, new_preferences: dict): + """ + Updates skill settings with the passed new_preferences + :param new_preferences: dict of updated preference values. {key: val} + """ + LOG.debug(f"Update skill settings with new: {new_preferences}") + for setting in new_preferences: + self.settings[setting] = new_preferences[setting] + self.settings.store() + def _clean_drink_name(self, drink: str) -> str: """ Normalizes an input drink name and handles known alternative names diff --git a/test/test_skill.py b/test/test_skill.py index b6a42f7..2149e2e 100644 --- a/test/test_skill.py +++ b/test/test_skill.py @@ -27,10 +27,10 @@ class TestSkillMethods(SkillTestCase): def test_00_skill_init(self): - # Test any parameters expected to be set in init or initialize methods - from neon_utils.skills.common_query_skill import CommonQuerySkill - - self.assertIsInstance(self.skill, CommonQuerySkill) + # # Test any parameters expected to be set in init or initialize methods + # from neon_utils.skills.common_query_skill import CommonQuerySkill + # + # self.assertIsInstance(self.skill, CommonQuerySkill) self.assertIsInstance(self.skill.translate_drinks, dict) self.skill._update_event.wait() From d4431f4dd3a3c0dbb19c96878927791ad7bb0d78 Mon Sep 17 00:00:00 2001 From: NeonDaniel <34697904+NeonDaniel@users.noreply.github.com> Date: Tue, 18 Mar 2025 22:43:20 +0000 Subject: [PATCH 12/20] Increment Version to 1.0.3a6 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index e75643e..0a9e9f7 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "1.0.3a5" +__version__ = "1.0.3a6" From e5429b7b0b4e8eed865886a21c77f7290f342c61 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Tue, 18 Mar 2025 15:55:26 -0700 Subject: [PATCH 13/20] Fix `convert_metric` annotation to resolve linter warning (#84) --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index fdcd294..cdb056a 100644 --- a/__init__.py +++ b/__init__.py @@ -284,7 +284,7 @@ def CQS_action(self, phrase, data): self.speak_dialog("stay_caffeinated") @staticmethod - def convert_metric(caff_oz: float, caff_mg: float) -> (str, str, str): + def convert_metric(caff_oz: float, caff_mg: float) -> Tuple[str, str, str]: """ Convert from imperial to metric units :param caff_oz: (float) oz from lookup From 9e927b0261d2a57d5ec785e9d2059c800d8c8ee2 Mon Sep 17 00:00:00 2001 From: NeonDaniel <34697904+NeonDaniel@users.noreply.github.com> Date: Tue, 18 Mar 2025 22:55:41 +0000 Subject: [PATCH 14/20] Increment Version to 1.0.3a7 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 0a9e9f7..4734da7 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "1.0.3a6" +__version__ = "1.0.3a7" From 5bc0309adac7ddbd3d372945e39e9edc13b584f4 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 19 Mar 2025 13:56:08 -0700 Subject: [PATCH 15/20] Remove stray line added to `test_intents.yaml` (#85) --- test/test_intents.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/test_intents.yaml b/test/test_intents.yaml index 591ae83..8fe9519 100644 --- a/test/test_intents.yaml +++ b/test/test_intents.yaml @@ -61,5 +61,3 @@ common query: - results - message - user - -ready event: _update_event \ No newline at end of file From 0e47e7590ce76aaa6c29daa36ef04b2eb10d8516 Mon Sep 17 00:00:00 2001 From: NeonDaniel <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 19 Mar 2025 20:56:25 +0000 Subject: [PATCH 16/20] Increment Version to 1.0.3a8 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 4734da7..beffcb9 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "1.0.3a7" +__version__ = "1.0.3a8" From bcbae1d0d6b587837e6f01fc70da14f5d0d315b1 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 19 Mar 2025 14:10:16 -0700 Subject: [PATCH 17/20] Revert testing change accidentally committed in #179 (#86) --- .github/workflows/publish_test_build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/publish_test_build.yml b/.github/workflows/publish_test_build.yml index 06abe1b..48d6f0e 100644 --- a/.github/workflows/publish_test_build.yml +++ b/.github/workflows/publish_test_build.yml @@ -10,8 +10,7 @@ on: jobs: build_and_publish_pypi: - # TODO: Update to `master` branch - uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@REF_UpdateAlphaReleaseActionVersions + uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@master secrets: inherit with: version_file: "version.py" From 842d3a8957a912bab772a759b1dc014f7bb1b021 Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Wed, 19 Mar 2025 21:10:39 +0000 Subject: [PATCH 18/20] Increment Version to 1.0.3a9 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index beffcb9..b00b4aa 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "1.0.3a8" +__version__ = "1.0.3a9" From 18194ea088d4a18cf4f98df3a2fff85a6a0633ff Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Wed, 19 Mar 2025 21:23:58 +0000 Subject: [PATCH 19/20] Increment Version to 2.0.0 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index b00b4aa..5f30d52 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "1.0.3a9" +__version__ = "2.0.0" From 4dbf50b2f1107b82ae3cbd58af7e3e5ae7845b57 Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Wed, 19 Mar 2025 21:24:27 +0000 Subject: [PATCH 20/20] Update Changelog --- CHANGELOG.md | 75 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 65 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16ee2b7..164ef32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,25 +1,80 @@ # Changelog -## [1.0.2](https://github.com/NeonGeckoCom/skill-caffeinewiz/tree/1.0.2) (2024-07-09) +## [1.0.3a9](https://github.com/NeonGeckoCom/skill-caffeinewiz/tree/1.0.3a9) (2025-03-19) -[Full Changelog](https://github.com/NeonGeckoCom/skill-caffeinewiz/compare/1.0.2a1...1.0.2) +[Full Changelog](https://github.com/NeonGeckoCom/skill-caffeinewiz/compare/1.0.3a8...1.0.3a9) -**Closed issues:** +**Merged pull requests:** + +- Update actions to use `master` branch [\#86](https://github.com/NeonGeckoCom/skill-caffeinewiz/pull/86) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [1.0.3a8](https://github.com/NeonGeckoCom/skill-caffeinewiz/tree/1.0.3a8) (2025-03-19) + +[Full Changelog](https://github.com/NeonGeckoCom/skill-caffeinewiz/compare/1.0.3a7...1.0.3a8) + +**Merged pull requests:** + +- Remove stray line added to `test_intents.yaml` [\#85](https://github.com/NeonGeckoCom/skill-caffeinewiz/pull/85) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [1.0.3a7](https://github.com/NeonGeckoCom/skill-caffeinewiz/tree/1.0.3a7) (2025-03-18) + +[Full Changelog](https://github.com/NeonGeckoCom/skill-caffeinewiz/compare/1.0.3a6...1.0.3a7) + +**Merged pull requests:** + +- Fix `convert_metric` annotation to resolve linter warning [\#84](https://github.com/NeonGeckoCom/skill-caffeinewiz/pull/84) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [1.0.3a6](https://github.com/NeonGeckoCom/skill-caffeinewiz/tree/1.0.3a6) (2025-03-18) + +[Full Changelog](https://github.com/NeonGeckoCom/skill-caffeinewiz/compare/1.0.3a5...1.0.3a6) + +**Implemented enhancements:** + +- \[FEAT\] Refactor to extend `ovos_workshop.skills.common_query_skill.CommonQuerySkill` [\#75](https://github.com/NeonGeckoCom/skill-caffeinewiz/issues/75) + +**Merged pull requests:** -- Resolve test failures [\#38](https://github.com/NeonGeckoCom/skill-caffeinewiz/issues/38) +- Refactor to extend ovos\_workshop.CommonQuerySkill [\#77](https://github.com/NeonGeckoCom/skill-caffeinewiz/pull/77) ([NeonDaniel](https://github.com/NeonDaniel)) -## [1.0.2a1](https://github.com/NeonGeckoCom/skill-caffeinewiz/tree/1.0.2a1) (2024-04-04) +## [1.0.3a5](https://github.com/NeonGeckoCom/skill-caffeinewiz/tree/1.0.3a5) (2025-03-11) + +[Full Changelog](https://github.com/NeonGeckoCom/skill-caffeinewiz/compare/1.0.3a4...1.0.3a5) + +**Merged pull requests:** + +- Update automation, gitignore, and license notices [\#83](https://github.com/NeonGeckoCom/skill-caffeinewiz/pull/83) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [1.0.3a4](https://github.com/NeonGeckoCom/skill-caffeinewiz/tree/1.0.3a4) (2024-09-18) + +[Full Changelog](https://github.com/NeonGeckoCom/skill-caffeinewiz/compare/1.0.3a3...1.0.3a4) + +**Merged pull requests:** + +- Resolve PyPI Release Failures [\#81](https://github.com/NeonGeckoCom/skill-caffeinewiz/pull/81) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [1.0.3a3](https://github.com/NeonGeckoCom/skill-caffeinewiz/tree/1.0.3a3) (2024-09-18) + +[Full Changelog](https://github.com/NeonGeckoCom/skill-caffeinewiz/compare/1.0.3a2...1.0.3a3) + +**Merged pull requests:** + +- Add `workflow_dispatch` build trigger to diagnose build errors [\#80](https://github.com/NeonGeckoCom/skill-caffeinewiz/pull/80) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [1.0.3a2](https://github.com/NeonGeckoCom/skill-caffeinewiz/tree/1.0.3a2) (2024-09-18) + +[Full Changelog](https://github.com/NeonGeckoCom/skill-caffeinewiz/compare/1.0.3a1...1.0.3a2) + +**Merged pull requests:** -[Full Changelog](https://github.com/NeonGeckoCom/skill-caffeinewiz/compare/1.0.1...1.0.2a1) +- Update PyPI shared action to troubleshoot GHA failure [\#79](https://github.com/NeonGeckoCom/skill-caffeinewiz/pull/79) ([NeonDaniel](https://github.com/NeonDaniel)) -**Fixed bugs:** +## [1.0.3a1](https://github.com/NeonGeckoCom/skill-caffeinewiz/tree/1.0.3a1) (2024-09-18) -- \[BUG\] ValueError: not enough values to unpack \(expected 4, got 2\) [\#58](https://github.com/NeonGeckoCom/skill-caffeinewiz/issues/58) -- Spoken error after "no" to "more\_drinks" [\#44](https://github.com/NeonGeckoCom/skill-caffeinewiz/issues/44) +[Full Changelog](https://github.com/NeonGeckoCom/skill-caffeinewiz/compare/1.0.2...1.0.3a1) **Merged pull requests:** -- Update deprecated references [\#74](https://github.com/NeonGeckoCom/skill-caffeinewiz/pull/74) ([NeonDaniel](https://github.com/NeonDaniel)) +- Update dependencies to allow for latest OVOS packages [\#78](https://github.com/NeonGeckoCom/skill-caffeinewiz/pull/78) ([NeonDaniel](https://github.com/NeonDaniel))