Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 62b74b7

Browse files
ethanovaEthan Garberqnixsynapse
authored
fix bug where for local models, delete only the model passed in, not all local models (menloresearch#2207)
Co-authored-by: Ethan Garber <[email protected]> Co-authored-by: Akarshan Biswas <[email protected]>
1 parent aab3586 commit 62b74b7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

engine/services/model_service.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -500,13 +500,10 @@ cpp::result<void, std::string> ModelService::DeleteModel(
500500
std::filesystem::remove(yaml_fp);
501501
CTL_INF("Removed: " << yaml_fp.string());
502502
} else {
503-
// Remove yaml files
504-
for (const auto& entry :
505-
std::filesystem::directory_iterator(yaml_fp.parent_path())) {
506-
if (entry.is_regular_file() && (entry.path().extension() == ".yml")) {
507-
std::filesystem::remove(entry);
508-
CTL_INF("Removed: " << entry.path().string());
509-
}
503+
// Is a local model - Remove only this model's yaml file
504+
if (std::filesystem::exists(yaml_fp)) {
505+
std::filesystem::remove(yaml_fp);
506+
CTL_INF("Removed: " << yaml_fp.string());
510507
}
511508
}
512509

0 commit comments

Comments
 (0)