ctrl: allow to erasing training data leaving graph files

This commit is contained in:
jeefo 2025-01-31 20:40:08 +03:00
commit 4c5cf2503e
No known key found for this signature in database
GPG key ID: D696786B81B667C8
4 changed files with 24 additions and 4 deletions

View file

@ -355,6 +355,7 @@ int BotControl::cmdNode () {
"load",
"help",
"erase",
"erase_training",
"fileinfo",
"check"
};
@ -399,6 +400,7 @@ int BotControl::cmdNode () {
addGraphCmd ("save", "save [noarguments]", "Save graph file to disk.", &BotControl::cmdNodeSave);
addGraphCmd ("load", "load [noarguments]", "Load graph file from disk.", &BotControl::cmdNodeLoad);
addGraphCmd ("erase", "erase [iamsure]", "Erases the graph file from disk.", &BotControl::cmdNodeErase);
addGraphCmd ("erase_training", "erase_training", "Erases the training data leaving graph files.", &BotControl::cmdNodeEraseTraining);
addGraphCmd ("delete", "delete [nearest|index]", "Deletes single graph node from map.", &BotControl::cmdNodeDelete);
addGraphCmd ("check", "check [noarguments]", "Check if graph working correctly.", &BotControl::cmdNodeCheck);
addGraphCmd ("cache", "cache [nearest|index]", "Caching node for future use.", &BotControl::cmdNodeCache);
@ -616,7 +618,7 @@ int BotControl::cmdNodeErase () {
// prevent accidents when graph are deleted unintentionally
if (arg <StringRef> (iamsure) == "iamsure") {
bstor.unlinkFromDisk ();
bstor.unlinkFromDisk (false);
}
else {
msg ("Please, append \"iamsure\" as parameter to get graph erased from the disk.");
@ -624,6 +626,14 @@ int BotControl::cmdNodeErase () {
return BotCommandResult::Handled;
}
int BotControl::cmdNodeEraseTraining () {
enum args { graph_cmd = 1, cmd };
bstor.unlinkFromDisk (true);
return BotCommandResult::Handled;
}
int BotControl::cmdNodeDelete () {
enum args { graph_cmd = 1, cmd, nearest };