diff --git a/src/interface/desktop/chat.html b/src/interface/desktop/chat.html
index 455a8750..d7a10db6 100644
--- a/src/interface/desktop/chat.html
+++ b/src/interface/desktop/chat.html
@@ -541,6 +541,7 @@
chatInput.value = chatInput.value.trimStart();
let questionStarterSuggestions = document.getElementById("question-starters");
+ questionStarterSuggestions.innerHTML = "";
questionStarterSuggestions.style.display = "none";
if (chatInput.value.startsWith("/") && chatInput.value.split(" ").length === 1) {
@@ -592,6 +593,7 @@
const headers = { 'Authorization': `Bearer ${khojToken}` };
let chatBody = document.getElementById("chat-body");
+ chatBody.innerHTML = "";
let conversationId = chatBody.dataset.conversationId;
let chatHistoryUrl = `/api/chat/history?client=desktop`;
if (conversationId) {
@@ -672,11 +674,11 @@
fetch(`${hostURL}/api/chat/starters?client=desktop`, { headers })
.then(response => response.json())
.then(data => {
- // Render chat options, if any
+ // Render conversation starters, if any
if (data.length > 0) {
let questionStarterSuggestions = document.getElementById("question-starters");
- for (let index in data) {
- let questionStarter = data[index];
+ questionStarterSuggestions.innerHTML = "";
+ data.forEach((questionStarter) => {
let questionStarterButton = document.createElement('button');
questionStarterButton.innerHTML = questionStarter;
questionStarterButton.classList.add("question-starter");
@@ -686,7 +688,7 @@
chat();
});
questionStarterSuggestions.appendChild(questionStarterButton);
- }
+ });
questionStarterSuggestions.style.display = "grid";
}
})
diff --git a/src/khoj/interface/web/chat.html b/src/khoj/interface/web/chat.html
index 7ecb70d6..bed128d5 100644
--- a/src/khoj/interface/web/chat.html
+++ b/src/khoj/interface/web/chat.html
@@ -523,6 +523,7 @@ To get started, just start typing below. You can also type / to see a list of co
chatInput.value = chatInput.value.trimStart();
let questionStarterSuggestions = document.getElementById("question-starters");
+ questionStarterSuggestions.innerHTML = "";
questionStarterSuggestions.style.display = "none";
if (chatInput.value.startsWith("/") && chatInput.value.split(" ").length === 1) {
@@ -568,6 +569,7 @@ To get started, just start typing below. You can also type / to see a list of co
function loadChat() {
let chatBody = document.getElementById("chat-body");
+ chatBody.innerHTML = "";
let conversationId = chatBody.dataset.conversationId;
let chatHistoryUrl = `/api/chat/history?client=web`;
if (conversationId) {
@@ -650,8 +652,8 @@ To get started, just start typing below. You can also type / to see a list of co
// Render chat options, if any
if (data.length > 0) {
let questionStarterSuggestions = document.getElementById("question-starters");
- for (let index in data) {
- let questionStarter = data[index];
+ questionStarterSuggestions.innerHTML = "";
+ data.forEach((questionStarter) => {
let questionStarterButton = document.createElement('button');
questionStarterButton.innerHTML = questionStarter;
questionStarterButton.classList.add("question-starter");
@@ -661,7 +663,7 @@ To get started, just start typing below. You can also type / to see a list of co
chat();
});
questionStarterSuggestions.appendChild(questionStarterButton);
- }
+ });
questionStarterSuggestions.style.display = "grid";
}
})