From 5a7ef5c1df2d866621cdc40fbce3d00024a8b574 Mon Sep 17 00:00:00 2001 From: Edwin Jose Date: Fri, 19 Dec 2025 13:56:08 -0500 Subject: [PATCH] Add config.yaml removal to factory reset The factory reset process now deletes config.yaml to reset provider settings and model selections, in addition to clearing opensearch data. This ensures a more complete reset of the application's state. --- src/tui/screens/monitor.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/tui/screens/monitor.py b/src/tui/screens/monitor.py index 570679d8..699eeea0 100644 --- a/src/tui/screens/monitor.py +++ b/src/tui/screens/monitor.py @@ -535,7 +535,7 @@ class MonitorScreen(Screen): self.operation_in_progress = False async def _factory_reset_with_data_clear(self) -> AsyncIterator[tuple[bool, str]]: - """Generator that stops services and clears opensearch data.""" + """Generator that stops services and clears opensearch data and config.""" # First stop all services async for success, message in self.container_manager.reset_services(): yield success, message @@ -563,6 +563,18 @@ class MonitorScreen(Screen): yield False, f"Error recreating opensearch-data directory: {e}" return + # Clear config.yaml to reset provider settings and model selections + yield False, "Clearing configuration..." + config_path = Path(env_manager.config.openrag_config_path.replace("$HOME", str(Path.home()))).expanduser() + config_file = config_path / "config.yaml" + if config_file.exists(): + try: + config_file.unlink() + yield True, "Configuration file removed" + except Exception as e: + yield False, f"Error removing config file: {e}" + return + yield True, "Factory reset completed successfully" def _check_flow_backups(self) -> bool: