From 75c1016ec09e3ebd2dddc66355fa0fbf40bf21d2 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sun, 27 Aug 2023 15:20:34 -0700 Subject: [PATCH] Show filtered list of commands available with the currently input text --- src/khoj/interface/web/chat.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/khoj/interface/web/chat.html b/src/khoj/interface/web/chat.html index 161f169c..659d410a 100644 --- a/src/khoj/interface/web/chat.html +++ b/src/khoj/interface/web/chat.html @@ -168,12 +168,15 @@ function onChatInput() { let chatInput = document.getElementById("chat-input"); - if (chatInput.value === "/") { + if (chatInput.value.startsWith("/") && chatInput.value.split(" ").length === 1) { let chatTooltip = document.getElementById("chat-tooltip"); chatTooltip.style.display = "block"; let helpText = "
"; + const command = chatInput.value.split(" ")[0].substring(1); for (let key in chatOptions) { - helpText += "/" + key + ": " + chatOptions[key] + "
"; + if (!!!command || key.startsWith(command)) { + helpText += "/" + key + ": " + chatOptions[key] + "
"; + } } chatTooltip.innerHTML = helpText; } else if (chatInput.value.startsWith("/")) { @@ -514,6 +517,7 @@ div#chat-tooltip { text-align: left; + font-size: medium; } @keyframes gradient {