Auto configure server before loading khoj-menu

If the config hasn't changed there'll be no update. If config has
changed indexing will get triggered asynchronously. But user cannot
make query till indexing done

As easier to know when server ready to configure
This commit is contained in:
Debanjum Singh Solanky 2023-03-27 01:16:05 +07:00
parent 8a21aff438
commit d7fb9a596e

View file

@ -266,7 +266,9 @@ for example), set this to the full interpreter path."
(setq khoj--server-ready? nil))
:filter (lambda (process msg)
(cond ((string-match (format "Uvicorn running on %s" khoj-server-url) msg)
(setq khoj--server-ready? t))
(progn
(setq khoj--server-ready? t)
(khoj--server-configure)))
((not khoj--server-ready?)
(dolist (line (split-string msg "\n"))
(message "khoj.el: %s" (nth 1 (split-string msg " " t " *"))))))
@ -923,6 +925,7 @@ Paragraph only starts at first text after blank line."
(khoj--server-setup))
(while (not khoj--server-ready?)
(sleep-for 0.5))
(khoj--server-configure)
(khoj--menu))
(provide 'khoj)