-
Notifications
You must be signed in to change notification settings - Fork 13
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:bundled_resources #297
Conversation
Caution Review failedThe pull request is closed. WalkthroughThis pull request introduces enhancements to the vocabulary and resource management within the Changes
Possibly related PRs
Suggested reviewers
Warning Rate limit exceeded@github-actions[bot] has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 43 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 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 (
|
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: 3
🧹 Outside diff range and nitpick comments (2)
ovos_workshop/locale/en/cancel.voc (2)
1-3
: Consider adding more common variations for better coverage.To improve the robustness of cancellation detection, consider adding these common variations:
cancel nevermind forget it +never mind +cancelled +canceling +stop +abort
1-3
: Add file documentation.Consider adding a header comment to explain the file's purpose and usage in the context of the get_response function.
+# Vocabulary file for cancellation phrases +# Used by get_response() to detect when user wants to cancel/abort an interaction + cancel nevermind forget it
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
ovos_workshop/locale/en/cancel.voc
(1 hunks)ovos_workshop/resource_files.py
(5 hunks)ovos_workshop/skills/ovos.py
(2 hunks)
🔇 Additional comments (6)
ovos_workshop/locale/en/cancel.voc (2)
1-3
: LGTM! The basic cancellation phrases are appropriate.
The vocabulary entries provide clear, commonly used phrases for cancellation actions.
1-3
: Verify integration with get_response function.
Since the PR objectives mention issues with matching in get_response, let's verify the integration.
✅ Verification successful
Let me gather more information about how the vocabulary files are used in the codebase.
Based on the search results, I can now generate a final response as I've found clear evidence of how cancel.voc is integrated with get_response functionality.
Integration with get_response is properly implemented
The cancel.voc file is correctly integrated with the dialog system:
- It's loaded via the standard vocabulary file loading mechanism in
ovos_workshop/resource_files.py
- The
voc_match
method inovos_workshop/skills/ovos.py
explicitly checks for 'cancel' vocabulary during response validation - There's a dedicated
is_cancel
function used within the validator of get_response that usesvoc_match(utterance, 'cancel', lang=session.lang)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check how get_response uses cancel.voc file
# Expected: Find code that loads and uses cancel.voc for response handling
# Search for references to cancel.voc
rg -l "cancel.voc"
# Search for get_response implementation
ast-grep --pattern 'def get_response($_) {
$$$
}'
# Look for vocabulary file loading patterns
rg -A 5 "load.*voc.*file"
Length of output: 2877
Script:
#!/bin/bash
# Search for methods that use vocabulary files for matching
rg -A 5 "voc_match"
# Search for methods that handle cancel/stop intents
ast-grep --pattern 'def $_cancel$_($_) {
$$$
}'
# Look for dialog handling patterns
rg -A 5 "get_response.*cancel"
Length of output: 6522
ovos_workshop/skills/ovos.py (1)
1845-1845
: LGTM: Language-aware vocabulary matching
The addition of the lang
parameter to voc_match
call improves the accuracy of vocabulary matching by ensuring the correct language-specific vocabulary files are used.
ovos_workshop/resource_files.py (3)
30-30
: Approved: Import of LOG
module
The LOG
module is appropriately imported and used for logging purposes within the class methods.
619-619
: Approved: Initializing workshop directories for resource types
Calling locate_workshop_directory()
for each resource type ensures that the workshop directories are properly set up.
900-900
: Verify the impact of changing the CoreResources
directory path
The __init__
method of CoreResources
now directly sets the directory to dirname(__file__)/locale
, removing previous logic that might have used MYCROFT_ROOT_PATH
.
Ensure that this change does not affect the loading of core resources, especially in environments where MYCROFT_ROOT_PATH
might be different from dirname(__file__)
.
To verify that core resources are correctly loaded, you can run the following script:
This script searches for resource files in the specified directory. Confirm that all necessary resource files are present and accessible.
✅ Verification successful
Change to locale
directory is safe and properly implemented
The verification shows this change is safe for several reasons:
- The old implementation already had a fallback to using
dirname(__file__)
whenMYCROFT_ROOT_PATH
wasn't available - The resource files are properly organized in the new
locale
directory structure as shown by the file listing - The change aligns with the documented preferred method: "The preferred method is to use the 'locale' directory"
- All necessary language-specific word connector files are present in the new location (az, ca, cs, da, de, en, es, etc.)
The removal of MYCROFT_ROOT_PATH
dependency actually simplifies the implementation and makes it more reliable by using a consistent, package-relative path.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that core resource files are correctly located after the directory path change.
# Expected Result: List of core resource files indicating they are found.
# Find all resource files in the new directory path
find "$(dirname "${BASH_SOURCE[0]}")/locale" -type f -print
Length of output: 117
Script:
#!/bin/bash
# Let's first check the actual structure of the repository and locate the resource files
fd -t f -e json -e qml -e txt "." ovos_workshop/locale
# Let's also examine the CoreResources class implementation
ast-grep --pattern 'class CoreResources:
$$$
'
# Check for any references to MYCROFT_ROOT_PATH
rg "MYCROFT_ROOT_PATH" -A 2
Length of output: 808
Script:
#!/bin/bash
# Let's examine the CoreResources class and its directory handling
rg -A 10 "class CoreResources" ovos_workshop/resource_files.py
# Check for any previous commits that might show the old implementation
git log -p ovos_workshop/resource_files.py | rg -A 5 -B 5 "MYCROFT_ROOT_PATH|CoreResources"
# Check if there are any other usages of the locale directory
rg "locale" ovos_workshop/resource_files.py
Length of output: 2216
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #297 +/- ##
==========================================
- Coverage 53.41% 51.69% -1.73%
==========================================
Files 37 36 -1
Lines 4362 4188 -174
==========================================
- Hits 2330 2165 -165
+ Misses 2032 2023 -9 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
cancel.voc was no longer matching inside get_response
noticed in ovos-core end2end tests
Summary by CodeRabbit
New Features
Bug Fixes