mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 05:39:12 +00:00
Use new config/types API to set enabled content types in khoj.el menu
This commit is contained in:
@@ -262,19 +262,15 @@ Use `which-key` if available, else display simple message in echo area"
|
|||||||
|
|
||||||
(defun khoj--get-enabled-content-types ()
|
(defun khoj--get-enabled-content-types ()
|
||||||
"Get content types enabled for search from API."
|
"Get content types enabled for search from API."
|
||||||
(let ((config-url (format "%s/api/config/data" khoj-server-url))
|
(let ((config-url (format "%s/api/config/types" khoj-server-url))
|
||||||
(url-request-method "GET"))
|
(url-request-method "GET"))
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
(url-insert-file-contents config-url)
|
(url-insert-file-contents config-url)
|
||||||
(let* ((json-response (json-parse-buffer :object-type 'alist))
|
(thread-last
|
||||||
(content-type (cdr (assoc 'content-type json-response))))
|
(json-parse-buffer :object-type 'alist)
|
||||||
;; return content-type items with configuration
|
(mapcar 'downcase)
|
||||||
(mapcar
|
(mapcar 'intern)))))
|
||||||
#'car
|
|
||||||
(cl-remove-if-not
|
|
||||||
(lambda (a) (not (eq (cdr a) :null)))
|
|
||||||
content-type))))))
|
|
||||||
|
|
||||||
(defun khoj--construct-api-query (query content-type &optional rerank)
|
(defun khoj--construct-api-query (query content-type &optional rerank)
|
||||||
"Construct API Query from QUERY, CONTENT-TYPE and (optional) RERANK params."
|
"Construct API Query from QUERY, CONTENT-TYPE and (optional) RERANK params."
|
||||||
|
|||||||
Reference in New Issue
Block a user