mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-03 13:19:16 +00:00
Do not version API. Premature given current state of the codebase
- Reason - All clients that currently consume the API are part of Khoj - Any breaking API changes will be fixed in clients immediately - So decoupling client from API is not required - This removes the burden of maintaining muliple versions of the API
This commit is contained in:
@@ -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/api/v1.0/config/data" khoj-server-url)))
|
||||
(let ((config-url (format "%s/api/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/api/v1.0/search?q=%s&t=%s&r=%s&n=%s" khoj-server-url encoded-query search-type rerank khoj-results-count)))
|
||||
(format "%s/api/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.
|
||||
|
||||
@@ -10,7 +10,7 @@ var emptyValueDefault = "🖊️";
|
||||
/**
|
||||
* Fetch the existing config file.
|
||||
*/
|
||||
fetch("/api/v1.0/config/data")
|
||||
fetch("/api/config/data")
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
rawConfig = data;
|
||||
@@ -26,7 +26,7 @@ fetch("/api/v1.0/config/data")
|
||||
configForm.addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
console.log(rawConfig);
|
||||
fetch("/api/v1.0/config/data", {
|
||||
fetch("/api/config/data", {
|
||||
method: "POST",
|
||||
credentials: "same-origin",
|
||||
headers: {
|
||||
@@ -46,7 +46,7 @@ regenerateButton.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
regenerateButton.style.cursor = "progress";
|
||||
regenerateButton.disabled = true;
|
||||
fetch("/api/v1.0/update?force=true")
|
||||
fetch("/api/update?force=true")
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
regenerateButton.style.cursor = "pointer";
|
||||
|
||||
@@ -77,8 +77,8 @@
|
||||
|
||||
// Generate Backend API URL to execute Search
|
||||
url = type === "image"
|
||||
? `/api/v1.0/search?q=${encodeURIComponent(query)}&t=${type}&n=${results_count}`
|
||||
: `/api/v1.0/search?q=${encodeURIComponent(query)}&t=${type}&n=${results_count}&r=${rerank}`;
|
||||
? `/api/search?q=${encodeURIComponent(query)}&t=${type}&n=${results_count}`
|
||||
: `/api/search?q=${encodeURIComponent(query)}&t=${type}&n=${results_count}&r=${rerank}`;
|
||||
|
||||
// Execute Search and Render Results
|
||||
fetch(url)
|
||||
@@ -94,7 +94,7 @@
|
||||
|
||||
function updateIndex() {
|
||||
type = document.getElementById("type").value;
|
||||
fetch(`/api/v1.0/update?t=${type}`)
|
||||
fetch(`/api/update?t=${type}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
@@ -118,7 +118,7 @@
|
||||
function populate_type_dropdown() {
|
||||
// Populate type dropdown field with enabled search types only
|
||||
var possible_search_types = ["org", "markdown", "ledger", "music", "image"];
|
||||
fetch("/api/v1.0/config/data")
|
||||
fetch("/api/config/data")
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
document.getElementById("type").innerHTML =
|
||||
|
||||
Reference in New Issue
Block a user