mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-12 16:16:42 +03:00
Correctly remove classification model from config
This commit is contained in:
parent
740c618240
commit
71965e8366
@ -844,8 +844,15 @@ def delete_classification_model(request: Request, name: str):
|
|||||||
config_file = find_config_file()
|
config_file = find_config_file()
|
||||||
try:
|
try:
|
||||||
# Setting value to empty string deletes the key
|
# 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)
|
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:
|
except Exception as e:
|
||||||
logger.error(f"Error updating config file: {e}")
|
logger.error(f"Error updating config file: {e}")
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user