Version Khoj API, Update frontends, tests and docs to reflect it

- Split router.py into v1.0, beta and frontend (no-prefix) api modules
  under new router package. Version tag in main.py via prefix
- Update frontends to use the versioned api endpoints
- Update tests to work with versioned api endpoints
- Update docs to mentioned, reference only versioned api endpoints
This commit is contained in:
Debanjum Singh Solanky
2022-09-14 21:22:20 +03:00
parent ee65a4f2c7
commit e42a38e825
11 changed files with 154 additions and 124 deletions

View File

@@ -226,7 +226,7 @@ Use `which-key` if available, else display simple message in echo area"
(defun khoj--get-enabled-content-types ()
"Get content types enabled for search from API."
(let ((config-url (format "%s/config/data" khoj-server-url)))
(let ((config-url (format "%s/api/v1.0/config/data" khoj-server-url)))
(with-temp-buffer
(erase-buffer)
(url-insert-file-contents config-url)
@@ -243,7 +243,7 @@ Use `which-key` if available, else display simple message in echo area"
"Construct API Query from QUERY, SEARCH-TYPE and (optional) RERANK params."
(let ((rerank (or rerank "false"))
(encoded-query (url-hexify-string query)))
(format "%s/search?q=%s&t=%s&r=%s&n=%s" khoj-server-url encoded-query search-type rerank khoj-results-count)))
(format "%s/api/v1.0/search?q=%s&t=%s&r=%s&n=%s" khoj-server-url encoded-query search-type rerank khoj-results-count)))
(defun khoj--query-api-and-render-results (query search-type query-url buffer-name)
"Query Khoj API using QUERY, SEARCH-TYPE, QUERY-URL.