Correctly remove classification model from config

This commit is contained in:
Nicolas Mowen 2025-11-03 07:23:57 -07:00
parent 740c618240
commit 71965e8366

View File

@ -844,8 +844,15 @@ def delete_classification_model(request: Request, name: str):
config_file = find_config_file()
try:
# Setting value to empty string deletes the key
updates = {f"classification.custom.{name}": None}
updates = {"classification.custom": None}
update_yaml_file_bulk(config_file, updates)
# Reload and update the in-memory config
with open(config_file, "r") as f:
new_raw_config = f.read()
new_config = FrigateConfig.parse(new_raw_config)
request.app.frigate_config = new_config
except Exception as e:
logger.error(f"Error updating config file: {e}")
return JSONResponse(