Use new schema to update khoj.yml config from khoj.el

This commit is contained in:
Debanjum Singh Solanky
2023-07-26 17:34:16 -07:00
parent 8b2af0b5ef
commit 715d56d4f0

View File

@@ -439,11 +439,8 @@ CONFIG is json obtained from Khoj config API."
(message "khoj.el: Chat not configured yet.") (message "khoj.el: Chat not configured yet.")
(setq config (delq (assoc 'processor config) config)) (setq config (delq (assoc 'processor config) config))
(cl-pushnew `(processor . ((conversation . ((conversation-logfile . ,(format "%s/conversation.json" default-chat-dir)) (cl-pushnew `(processor . ((conversation . ((conversation-logfile . ,(format "%s/conversation.json" default-chat-dir))
(openai . ( (openai . ((chat-model . ,chat-model)
(chat-model . ,chat-model) (api-key . ,khoj-openai-api-key)))))))
(api-key . ,khoj-openai-api-key)
))
))))
config)) config))
((not (alist-get 'conversation (alist-get 'processor config))) ((not (alist-get 'conversation (alist-get 'processor config)))
@@ -451,8 +448,8 @@ CONFIG is json obtained from Khoj config API."
(let ((new-processor-type (alist-get 'processor config))) (let ((new-processor-type (alist-get 'processor config)))
(setq new-processor-type (delq (assoc 'conversation new-processor-type) new-processor-type)) (setq new-processor-type (delq (assoc 'conversation new-processor-type) new-processor-type))
(cl-pushnew `(conversation . ((conversation-logfile . ,(format "%s/conversation.json" default-chat-dir)) (cl-pushnew `(conversation . ((conversation-logfile . ,(format "%s/conversation.json" default-chat-dir))
(chat-model . ,chat-model) (openai . ((chat-model . ,chat-model)
(openai-api-key . ,khoj-openai-api-key))) (api-key . ,khoj-openai-api-key)))))
new-processor-type) new-processor-type)
(setq config (delq (assoc 'processor config) config)) (setq config (delq (assoc 'processor config) config))
(cl-pushnew `(processor . ,new-processor-type) config))) (cl-pushnew `(processor . ,new-processor-type) config)))
@@ -465,8 +462,8 @@ CONFIG is json obtained from Khoj config API."
(new-processor-type (alist-get 'processor config))) (new-processor-type (alist-get 'processor config)))
(setq new-processor-type (delq (assoc 'conversation new-processor-type) new-processor-type)) (setq new-processor-type (delq (assoc 'conversation new-processor-type) new-processor-type))
(cl-pushnew `(conversation . ((conversation-logfile . ,(format "%s/conversation.json" chat-directory)) (cl-pushnew `(conversation . ((conversation-logfile . ,(format "%s/conversation.json" chat-directory))
(chat-model . ,khoj-chat-model) (openai . ((chat-model . ,khoj-chat-model)
(openai-api-key . ,khoj-openai-api-key))) (api-key . ,khoj-openai-api-key)))))
new-processor-type) new-processor-type)
(setq config (delq (assoc 'processor config) config)) (setq config (delq (assoc 'processor config) config))
(cl-pushnew `(processor . ,new-processor-type) config)))) (cl-pushnew `(processor . ,new-processor-type) config))))