From 67ab40bb01f57d406038364c3efece7424b4eda8 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Mon, 15 Aug 2022 22:51:23 +0300 Subject: [PATCH] Regenerate embeddings everytime user clicks configure in Desktop GUI Previously if the embeddings were already there only the khoj.yml config file would get updated. The embeddings would remain old. 1. This results in a stale app state where the config doesn't match the embeddings 2. Currently the user cannot update their config from the config screen. They'd have to use a combination of config screen and web interface>regenerate button to trigger it or delete their ~/.khoj dir This commit should resolve the above issues --- src/interface/desktop/main_window.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/interface/desktop/main_window.py b/src/interface/desktop/main_window.py index c67f1c92..6afff350 100644 --- a/src/interface/desktop/main_window.py +++ b/src/interface/desktop/main_window.py @@ -29,6 +29,11 @@ class MainWindow(QtWidgets.QMainWindow): def __init__(self, config_file: Path): super(MainWindow, self).__init__() self.config_file = config_file + # Set regenerate flag to regenerate embeddings everytime user clicks configure + if state.cli_args: + state.cli_args += ['--regenerate'] + else: + state.cli_args = ['--regenerate'] # Load config from existing config, if exists, else load from default config if resolve_absolute_path(self.config_file).exists():