-
Notifications
You must be signed in to change notification settings - Fork 44k
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
Improve Key Validation and Handling in Overwrite Memory and Message Agent Functions #208
Improve Key Validation and Handling in Overwrite Memory and Message Agent Functions #208
Conversation
See also PR #105 |
scripts/commands.py
Outdated
elif isinstance(key, str): | ||
_text = "Overwriting memory with key " + key + " and string " + string | ||
# Overwrite the memory slot with the given string key and string | ||
mem.string_key_memory[key] = string |
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.
What is the point of saving on this attribute if it is not used anywhere else?
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.
SYSTEM: Command memory_ovr returned: Error: module 'memory' has no attribute 'string_key_memory'
More importantly, that doesn't even seem to be an existing attribute.
Fixes: ```Command memory_ovr returned: Error: module 'memory' has no attribute 'string_key_memory'```
Fixes #90 |
Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
This pull request introduces improvements to key validation and handling in the
overwrite_memory
andmessage_agent
functions within thescripts/commands.py
file.Changes include:
is_valid_int
to check if a value can be converted to an integer.overwrite_memory
function to handle both integer and string keys, and providing more informative error messages.message_agent
function to use theis_valid_int
helper function for key validation and providing an informative error message for invalid keys.These changes aim to make the code more robust and user-friendly, allowing for better handling of different key types and more informative error messages when invalid keys are encountered.