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
This commit is contained in:
Debanjum Singh Solanky
2022-08-15 22:51:23 +03:00
parent 2647e6bab4
commit 67ab40bb01

View File

@@ -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():