Commit Graph

702 Commits (dev)

Author SHA1 Message Date
Åke ab242a2c82
Handle multiple intents with the same name (#2921)
* Add check for duplicate adapt intents

There are two cases, duplicated named intent and duplicated anonymous intent.

A named intent will cause a ValueError exception notifying the skill
author that there is a collision.

An anonymous intent will silently derive a new name and use that
instead of the default generated one.

* Add tests for intent collisions

* Make enable/disable intent handle the new exception

The enable/disable intent did not mark an intent as detached, instead it
remained in the list of intents after disabling in the IntentServiceInterface
to be retrieved when the intent should be re-enabled.

This moves detached intents into a list of detached intents to so they
won't cause the double enable exception.

* Add move logic to find if intent is detached

MycroftSkill.enable_intent() will now check if the intent is detached
before trying to re-enable it.

* Lock updates of intents

This should avoid some race conditions that may occur if multiple
threads tries to enable / disable intents
2022-11-23 15:52:56 +09:30
Åke 5f4c68e583
Don't overwrite invalid json in config (#2881)
* Separate tests of LocalConf into new test class

* Do not overwrite configs with malformed json

If a config file is loaded and is invalid saves to that file will not be
possible until it's manually restored. The store accepts a force flag to
override this protection.

The method returns True if the store succeeded so call sites can
verbally report the issue as well.
2022-03-07 10:03:10 +09:30
Åke e7ddd51256
TTS playback queue singleton (#3055)
* fix issues when remote excepts out

* Remove explicit clear_cache from MimicTTS

* Updates for using singleton TTS playback thread

- Cache is called on all tts's registered as using the thread
- Begin audio and end audio is handled by the playback thread
- Further changes from self.playback to TTS.playback for consistency

* Remove redundant try/except

* Consolidate general and TTS-specific sentence splitting

This performs all sentence-splitting at the same stage. This fixes a
subtle issue where a TTS splits a sentence into chunks and throws an
error on only one of those chunks. The fallback would generate a
sentence for the original un-chunked sentence. possibly saying the same
parts twice.

This also pre-compiles the regexes used to speed things up a bit.

Co-authored-by: Ken <ken.smith@mycroft.ai>
2022-03-02 09:59:57 +09:30
Kris Gesling 99ac12cbf8
Merge pull request #3068 from forslund/bugfix/vk-dialogfile-from-sentence
Voight kampff: Bugfix dialogfile from sentence
2022-02-23 16:44:33 +09:30
TheRealDGD 34f66d234c
Added duration_to_bytes to FileMockMicrophone (#3071)
* Added duration_to_bytes to FileMockMicrophone

Added duration_to_bytes to fix AttributeError: 'FileMockMicrophone' object has no attribute 'duration_to_bytes'
in call from mycroft-core/mycroft/client/speech/mic.py _wait_until_wake_word

* Update wake_word_test.py

Fixed formatting issues

* Update wake_word_test.py

Fixed formatting

* Remove whitespaces for PEP8

Co-authored-by: Kris Gesling <kris.gesling@mycroft.ai>
2022-02-23 16:08:46 +09:30
Åke Forslund f8aa77c8e7 VK simplify dialog matching
This uses the existing dialog renderer and the standard format library
to in two steps create a regex where the {elements} in a dialog is
replaced with ".*" to match the given sentence.
2022-01-28 21:48:25 +01:00
Åke Forslund a3fd830cb0 VK: Expand the parentheses from dialog files 2022-01-26 20:09:12 +01:00
Åke Forslund 825b3879a5 VK: Fix regex used in _match_dialog_patterns
A redundant step caused issue when performing tests in the tv-remove-control-skill
2022-01-25 07:15:31 +01:00
Åke Forslund 03ef7f4b21 VK: Include locale folders in dialog_from_sentence
Only dialog folder was used previously this adds globbing through the
locale/lang/ folder and it's subfolders
2022-01-25 07:15:31 +01:00
Kris Gesling 89cfad7943
Check if GUI is connected rather than maintain list of platforms (#3025)
* Check if GUI is connected rather than maintain list of platforms

There are already many Mycroft platforms that have GUIs
and this will only grow. We want to know if the device
has a GUI connected rather than if it is in a pre-defined
list of platforms.

* Create a mock GUI with a settable connected attribute
2021-11-24 14:51:10 +09:30
Gaëtan Trellu 0247b3a4b5
[log_format] Add an option to change the log format (#3016)
* [log_format] Add an option to change the log format

Hacing an option to change the log format could be useful when logs
are shipped into an aggregator such as Elasticsearch.

The current format is very hard to parse.

* [log_format] Set default Formatter

Because mycroft.configuration.Configuration() class import LOG class,
a default Formatter have to be defined before import the
mycroft.configuration.Configuration() class.
2021-10-29 14:59:22 +09:30
Bart Ribbers 34ee3a9a84
Upgrade websocket-client to 1.2.1 (#2879)
* Upgrade websocket-client to 1.2.1

core equivalent of https://github.com/MycroftAI/mycroft-messagebus-client/pull/21
There was an incompability with the latest websocket-client and the
messagebus which needed fixing for Linux distro compatibility. Since
messagebus-client was going to depend on websocket-client 1.2.1, let's
do the same in core

* Bump message bus client and tornado versions

New version of the messagebus-client released.
Upgraded Tornado to match new function signature.

* Revert removal of websocket-client

It is still used in the `mycroft.client.text.gui_server`

Should investigate removal of this so that websocket client versions do not need to be
kept in sync between mycroft-core and mycroft-messagebus-client.

Co-authored-by: Kris Gesling <kris.gesling@mycroft.ai>
2021-10-28 14:42:23 +09:30
Chris Veilleux df78af15cb
Merge pull request #3002 from MycroftAI/test/extend-criteria-matcher
Extended the idea of the VK CriteriaWaiter
2021-10-07 10:59:50 -05:00
Chris Veilleux 4b729dc978 Make matcher class signatures more consistent. 2021-09-29 17:57:31 -05:00
Chris Veilleux acd6d4065a Apply code review changes. 2021-09-28 13:08:16 -05:00
Kris Gesling 2a6bb90c9f
Merge pull request #2963 from forslund/feature/update-adapt-keyword-registration-message
Update key names in adapt keyword registration message
2021-09-27 10:30:12 +09:30
Åke Forslund f709bb9a1e Use IntentServiceInterface in MycroftSkill.register_vocabulary()
This moves the message logic for adapt keyword registration into a single location.
2021-09-26 19:15:21 +02:00
Åke Forslund 189267b6f6 Minor cleanup of test case for keyword registration 2021-09-26 19:15:21 +02:00
Åke Forslund 693100e8c6 Match keyword entity terms in Mycroft with Adapt
This changes the internally used names for entities and entity values when
sent on the messagebus and used interanally in the intent service from start / end to entity_value and entity_type.

This makes the terminology easier to understand and follow across into Adapt.

The old terms are still included and usable for compatibility but should be
removed in an upcoming major release (22.02).
2021-09-26 19:15:17 +02:00
ken-mycroft 5e81e2747b
Improve confidence calculation for Common Query (#2986)
* Improve confidence calculation

* Add actual noise words file

* Update expected test confidence levels

Co-authored-by: Kris Gesling <kris.gesling@mycroft.ai>
2021-09-20 16:33:28 +09:30
Chris Veilleux 7f7460a6cd Fix a PEP8 speaks issue 2021-09-14 14:49:39 -05:00
Chris Veilleux 1856296ea7 Extended the idea of the criteria matcher to handle other types of matching 2021-09-14 14:40:27 -05:00
Chris Veilleux 0896c3ceda fixed an error with message formatting in a ValueError message. 2021-09-14 14:31:35 -05:00
Kris Gesling 9e9f2f74e5
Merge pull request #2975 from MycroftAI/feature/vk-only-shutdown-on-ci
VK: Only stop Mycroft services if running in CI
2021-09-13 16:37:49 +09:30
Chris Veilleux 5a1e4ed8b9
Merge pull request #2990 from MycroftAI/bugfix/vk-bus-clear-messages
Fix messages clearing in the InterceptAllBusClient
2021-09-10 16:29:14 -05:00
Kris Gesling 59c473cac8 Fix pulseaudio daemon failing to start in CI 2021-09-03 14:54:09 +09:30
Chris Veilleux df94e2192a fixed a few spelling errors. 2021-09-01 13:21:50 -05:00
Chris Veilleux b6066f90c6 fixed an issue with how messages are cleared in the InterceptAllBusClient 2021-09-01 13:15:53 -05:00
Kris Gesling 8d11349b65 Only stop Mycroft services if running in CI 2021-08-12 10:24:38 +09:30
Kris Gesling 5f72294b61
Merge pull request #2968 from forslund/test/vk-no-skill-updates-at-runtime
Voight Kampff: No skill updates at runtime
2021-08-10 15:39:44 +09:30
Åke Forslund a65a3f7770 Disable auto updates of skills during VK test run 2021-08-06 10:06:05 +02:00
Bart Ribbers e20443b824 Use XDG Base directories for settings, cache and runtime data
Improve deprecation warning message
2021-08-05 10:04:45 +02:00
Kris Gesling 170ebc44ec
Merge pull request #2951 from forslund/feature/then-wait-with-event-handler
Use event handler to capture messages in then_wait()
2021-08-05 15:40:04 +09:30
Kris Gesling e40530a8ac
Merge pull request #2948 from forslund/bugfix/vk-message-race
Fix Possible vk message race
2021-08-05 15:39:12 +09:30
Kris Gesling 313f4e8759
Merge pull request #2946 from MycroftAI/refactor/vk-test-helpers
Improve the speed of waiting for dialogs helper function
2021-08-05 09:29:17 +09:30
Kris Gesling a794db0c9a Make network tests configurable
Previously test URIs were hardcoded.
They can now be configured in mycroft.conf
2021-08-02 21:00:05 +09:30
Åke Forslund b40fcf0e93 Update VK then step for checking messagetype
Simplify the function and use the standard then_wait() for the heavy lifting,
this makes it utilize the new event driven functionality.
2021-07-23 09:46:07 +02:00
Åke Forslund 171d3840f3 Remove sleeps from end of scenarios and features 2021-07-23 09:45:44 +02:00
Åke Forslund 578a3ec439 Use event to capture messages in then_wait()
Instead of busily polling the bus for new messages an event handler is
registered (and teared down after check is complete)
2021-07-23 09:45:44 +02:00
Åke Forslund cbd17a8dc3 Remove mycroft-stock from install list 2021-07-22 17:20:04 +02:00
Chris Veilleux 8f41d176d0 remove print statement used for testing 2021-07-09 16:39:49 -05:00
Chris Veilleux 6fd97b4e85 fixed PEP8 issue 2021-07-09 15:45:07 -05:00
Åke Forslund 4b66fb1dd1 Add docstrings to InterceptAllBusClient 2021-07-09 17:06:33 +02:00
Åke Forslund cf355360ad Fix message race when using clear_messages()
This handles a scenario that a message arrives between a call to get_messages() and clear_messages(). clear_messages() will only clear the messages that has been evaluated atleast once.

A new method clear_all_messages() has been added to clear the entire message stack and is used between scenarios to reset the list.
2021-07-09 17:06:30 +02:00
Kris Gesling b3a0b3b1e4
Merge pull request #2938 from forslund/bugfix/tts-returned-cache-path
Fix TTS using the returned path
2021-07-08 11:56:32 +09:30
Chris Veilleux 105a5b4be4 Improve the speed of waiting for dialogs by exiting the loop after a match is spoken. Also provide error handling for when a match is not found. 2021-07-06 14:26:23 -05:00
Chris Veilleux 18cb28088d Added comments to document race condition 2021-07-06 13:48:52 -05:00
Åke Forslund 0ae02b5939 Fix TTS using the returned path 2021-07-02 08:34:03 +02:00
Chris Veilleux 3959267726 Reordered wait_while_speaking and sleep to fix a race condition that was occurring with the converse logic in MycroftSkill.get_response() 2021-07-01 22:31:22 -05:00
Kris Gesling 0394568704 Use returned TTS audio file path
This reverts an unintentional breaking change.
A TTS engine may return a different file path than was requested.
This again uses the returned path but adds a deprecation warning
that this behaviour will no longer be supported in an upcoming release.

Fixes #2929
2021-06-29 21:53:53 +09:30