-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix:utterance filename #171
Conversation
companion to OpenVoiceOS/ovos-dinkum-listener#140 the current default value in config is no longer valid
WalkthroughThe pull request modifies the Changes
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #171 +/- ##
=====================================
Coverage ? 0.00%
=====================================
Files ? 10
Lines ? 877
Branches ? 0
=====================================
Hits ? 0
Misses ? 877
Partials ? 0 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
ovos_config/mycroft.conf (1)
Line range hint
458-461
: Review related utterance saving settingsWhile updating the
utterance_filename
format, it's important to review the related settings:
"save_utterances": false,
(line 461): This setting is currently set tofalse
, which means utterances are not being saved. If the intention is to use the new filename format, make sure to set this totrue
when needed.
"save_path": "/tmp",
(line 459): This line is commented out, but it specifies where utterances would be saved. Ensure that the desired save path is correctly set and uncommented ifsave_utterances
is enabled.Consider adding a comment explaining the new
utterance_filename
format for better documentation:"utterance_filename": "{md5}-{uuid4}", + // Generates a filename using an MD5 hash of the transcription and a random UUID
Also applies to: 469-471
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- ovos_config/mycroft.conf (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
ovos_config/mycroft.conf (2)
Line range hint
1-1000
: Overall configuration reviewThe change to the
utterance_filename
setting is the primary modification in this configuration file. The rest of the configuration remains unchanged and appears to be well-structured.The update to use an MD5 hash in the filename is a reasonable change that provides more specificity in the filename generation process. The configuration file as a whole seems to be comprehensive and well-organized, covering various aspects of the OVOS system.
To ensure the configuration file is valid JSON, we can run a quick check:
#!/bin/bash # Validate JSON structure of the configuration file jq . ovos_config/mycroft.conf > /dev/null if [ $? -eq 0 ]; then echo "Configuration file is valid JSON" else echo "Error: Configuration file is not valid JSON" fiThis will help catch any potential syntax errors that might have been introduced during the update.
473-473
: Update to utterance filename formatThe
utterance_filename
setting has been changed from"{hash}-{uuid4}"
to"{md5}-{uuid4}"
. This change specifies that an MD5 hash should be used instead of a generic hash.This change provides a more specific and standardized approach to generating filenames for saved utterances. MD5 is a well-known hashing algorithm, which can lead to more consistent and predictable filename generation.
However, it's worth noting a few points:
- MD5 is considered cryptographically weak, but for filename generation purposes, it should be sufficient.
- Ensure that any code or scripts that rely on the old filename format are updated accordingly.
To ensure this change doesn't break any existing functionality, let's check for any references to the old format:
backwards compat check wasnt quite right in #140 ``` Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: 2024-10-19 08:04:47.463 - voice - ovos_dinkum_listener.service:_stt_audio:747 - ERROR - Error while saving STT audio Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: Traceback (most recent call last): Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/service.py", line 742, in _stt_audio Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: stt_context["filename"] = self._save_stt(audio_bytes, stt_context) Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/service.py", line 707, in _save_stt Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: filename = formatter.format(utterance_filename) Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/_util.py", line 107, in format Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: fmtkw = self._build_fmtkw(template, **kwargs) Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/_util.py", line 91, in _build_fmtkw Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: fmtkw[key] = builder() Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/service.py", line 705, in transcription_md5 Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: return hash_sentence(text) Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_plugin_manager/utils/tts_cache.py", line 20, in hash_sentence Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: encoded_sentence = sentence.encode("utf-8", "ignore") Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: AttributeError: 'NoneType' object has no attribute 'encode' ``` also needs OpenVoiceOS/ovos-config#171
* fix:save utterances backwards compat check wasnt quite right in #140 ``` Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: 2024-10-19 08:04:47.463 - voice - ovos_dinkum_listener.service:_stt_audio:747 - ERROR - Error while saving STT audio Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: Traceback (most recent call last): Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/service.py", line 742, in _stt_audio Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: stt_context["filename"] = self._save_stt(audio_bytes, stt_context) Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/service.py", line 707, in _save_stt Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: filename = formatter.format(utterance_filename) Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/_util.py", line 107, in format Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: fmtkw = self._build_fmtkw(template, **kwargs) Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/_util.py", line 91, in _build_fmtkw Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: fmtkw[key] = builder() Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/service.py", line 705, in transcription_md5 Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: return hash_sentence(text) Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_plugin_manager/utils/tts_cache.py", line 20, in hash_sentence Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: encoded_sentence = sentence.encode("utf-8", "ignore") Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: AttributeError: 'NoneType' object has no attribute 'encode' ``` also needs OpenVoiceOS/ovos-config#171 * Update requirements.txt
companion to OpenVoiceOS/ovos-dinkum-listener#140
the current default value in config is no longer valid
Summary by CodeRabbit
New Features
Documentation