mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Fetch chat history from backend and render it on chat page load
This commit is contained in:
parent
330febaa1a
commit
177756be7e
1 changed files with 10 additions and 0 deletions
|
@ -87,6 +87,16 @@
|
|||
if (type_via_url)
|
||||
document.getElementById("chat-type").value = type_via_url;
|
||||
|
||||
fetch('/api/beta/chat')
|
||||
.then(response => response.json())
|
||||
.then(data => data.response)
|
||||
.then(chat_logs => {
|
||||
// Render conversation history, if any
|
||||
chat_logs.forEach(chat_log => {
|
||||
renderMessage(chat_log.message, chat_log.by, new Date(chat_log.created));
|
||||
});
|
||||
});
|
||||
|
||||
// Set welcome message on load
|
||||
renderMessage("Hey, what's up?", "khoj");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue