Clear chat history html in Obsidian if getChatHistory works too

This commit is contained in:
Debanjum Singh Solanky 2023-12-21 17:47:08 +05:30
parent 8d1e988059
commit 350fd89c8d

View file

@ -255,8 +255,8 @@ export class KhojChatModal extends Modal {
});
}
} catch (err) {
let errorMsg = "Unable to get response from Khoj server ❤️‍🩹. Ensure server is running or contact developers for help at <a href='mailto:team@khoj.dev'>team@khoj.dev</a> or on <a href='https://discord.gg/BDgyabRM6e'>Discord</a>";
this.renderMessage(chatBodyEl, errorMsg, "khoj", undefined, true);
let errorMsg = "Unable to get response from Khoj server ❤️‍🩹. Ensure server is running or contact developers for help at [team@khoj.dev](mailto:team@khoj.dev) or in [Discord](https://discord.gg/BDgyabRM6e)";
this.renderMessage(chatBodyEl, errorMsg, "khoj", undefined);
return false;
}
return true;
@ -395,9 +395,9 @@ export class KhojChatModal extends Modal {
// Throw error if conversation history isn't cleared
throw new Error("Failed to clear conversation history");
} else {
// If conversation history is cleared successfully, clear chat logs from modal
chatBody.innerHTML = "";
let getChatHistoryStatus = await this.getChatHistory(chatBody);
// If conversation history is cleared successfully, clear chat logs from modal
if (getChatHistoryStatus) chatBody.innerHTML = "";
let statusMsg = getChatHistoryStatus ? result.message : "Failed to clear conversation history";
this.flashStatusInChatInput(statusMsg);
}