-
Notifications
You must be signed in to change notification settings - Fork 12
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
Is there a way to delete states by identifier? #19
Comments
Hi! Not through the command line, but what you can do is get details about the state:
It will return something like: {:state=>
{:path=>
"/home/user/.local/state/nano-bots/ruby-nano-bots/none/unknown/0-0-0/XPTO/state.json",
:content=>
{:key=>"ABC",
:history=>
[{:at=>"2024-06-04 17:05:58 -0300", :who=>"user", :mode=>"eval", :input=>"hi", :message=>"hi"},
{:who=>"AI", :message=>"Hello! How can I assist you today?", :mode=>"eval", :output=>"Hello! How can I assist you today?\n", :at=>"2024-06-04 17:06:01 -0300"}]}}} Then you can delete the file:
|
Perfect, thank you very much! This works for my cause. I didn't see the debugging part in the readme (mostly because I was searching for 'delete' or 'state'). The only thing that bothers me: Debugging a non-existing state will create it. So if I want to check if a state with a given name exists, I will always create it, and therefore it will exists. Is this intended behaviour? Seems like debugging a non-existing state should throw an error. |
@rcheetah Yeah, you would need to check the state file, and if it's empty ( When CLI is used through In this process of creating the bot, it will call The unintended collateral effect is creating a new state file with an empty history for the ones that don't exist when just checking/debugging. |
@rcheetah I'm not sure about throwing an error, but in version 3.3.0 and beyond, it will no longer create a file if the state does not exist and will return nb - XPTO state
nil |
Can we add a functionality like:
? |
@icebaker Awesome, thank you! |
The state names in the storage folder are encrypted, as well as the contents. I wonder if it is possible to delete a given state by providing the state string? Something like
nb delete state123
The text was updated successfully, but these errors were encountered: