mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 13:20:17 +00:00
Render conversation logs on page load
This commit is contained in:
@@ -20,6 +20,14 @@ export class KhojChatModal extends Modal {
|
||||
// Create area for chat logs
|
||||
contentEl.createDiv({ attr: { class: "chat-body" } });
|
||||
|
||||
// Get conversation history from Khoj backend
|
||||
let chatUrl = `${this.setting.khojUrl}/api/chat?`;
|
||||
let response = await request(chatUrl);
|
||||
let chatLogs = JSON.parse(response).response;
|
||||
chatLogs.forEach( (chatLog: any) => {
|
||||
this.renderMessage(chatLog.message, chatLog.by);
|
||||
});
|
||||
|
||||
// Add chat input field
|
||||
new Setting(contentEl)
|
||||
.addText((text) => {
|
||||
|
||||
Reference in New Issue
Block a user