diff --git a/src/khoj/interface/web/chat.html b/src/khoj/interface/web/chat.html index 12338096..bb5d355a 100644 --- a/src/khoj/interface/web/chat.html +++ b/src/khoj/interface/web/chat.html @@ -87,7 +87,14 @@ .then(data => { if (data.detail) { // If the server returns a 500 error with detail, render it as a message. - renderMessage(data.detail + " You can configure Khoj chat in your settings.", "khoj"); + renderMessage("Hi 👋🏾, to get started
1. Get your OpenAI API key
2. Save it in the Khoj chat settings
3. Click Configure on the Khoj settings page", "khoj"); + + // Disable chat input field and update placeholder text + document.getElementById("chat-input").setAttribute("disabled", "disabled"); + document.getElementById("chat-input").setAttribute("placeholder", "Configure Khoj to enable chat"); + } else { + // Set welcome message on load + renderMessage("Hey 👋🏾, what's up?", "khoj"); } return data.response; }) @@ -101,9 +108,6 @@ return; }); - // Set welcome message on load - renderMessage("Hey, what's up?", "khoj"); - // Fill query field with value passed in URL query parameters, if any. var query_via_url = new URLSearchParams(window.location.search).get("q"); if (query_via_url) { diff --git a/src/khoj/interface/web/index.html b/src/khoj/interface/web/index.html index 949ab783..15deba05 100644 --- a/src/khoj/interface/web/index.html +++ b/src/khoj/interface/web/index.html @@ -161,6 +161,14 @@ fetch("/api/config/types") .then(response => response.json()) .then(enabled_types => { + // Show warning if no content types are enabled + if (enabled_types.detail) { + document.getElementById("results").innerHTML = "
To use Khoj search, setup your content plugins on the Khoj settings page.
"; + document.getElementById("query").setAttribute("disabled", "disabled"); + document.getElementById("query").setAttribute("placeholder", "Configure Khoj to enable search"); + return []; + } + document.getElementById("type").innerHTML = enabled_types .map(type => ``) @@ -407,6 +415,7 @@ border-radius: 50%; } + div#results-error, div.results-markdown, div.results-org, div.results-pdf { @@ -418,6 +427,10 @@ border: 4px solid rgb(229, 229, 229); } + div#results-error { + box-shadow: 2px 2px 2px #FF5722; + } + img { max-width: 90%; } @@ -481,8 +494,7 @@