Fix indexing content from Emacs #883 from aam-at/bugfix/fix_emacs_if

Previously `force' was passed as a query param to the single indexing API. After the recent API updates, it is meant to select the API method to use (PATCH vs PATCH). Converting `force' argument to a bool fixes implementing this new behavior
This commit is contained in:
Debanjum 2024-08-16 07:32:46 -07:00 committed by GitHub
commit 2b1482d2b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -425,7 +425,7 @@ Auto invokes setup steps on calling main entrypoint."
"Send multi-part form `BODY' of `CONTENT-TYPE' in request to khoj server.
Append 'TYPE-QUERY' as query parameter in request url.
Specify `BOUNDARY' used to separate files in request header."
(let ((url-request-method ((if force) "PUT" "PATCH"))
(let ((url-request-method (if force "PUT" "PATCH"))
(url-request-data body)
(url-request-extra-headers `(("content-type" . ,(format "multipart/form-data; boundary=%s" boundary))
("Authorization" . ,(format "Bearer %s" khoj-api-key)))))
@ -1266,7 +1266,7 @@ Paragraph only starts at first text after blank line."
(transient-define-suffix khoj--update-command (&optional args)
"Call khoj API to update index of specified content type."
(interactive (list (transient-args transient-current-command)))
(let* ((force-update (if (member "--force-update" args) "true" "false"))
(let* ((force-update (if (member "--force-update" args) t nil))
;; set content type to: specified > last used > based on current buffer > default type
(content-type (or (transient-arg-value "--content-type=" args) (khoj--buffer-name-to-content-type (buffer-name))))
(url-request-method "GET"))