mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Render conversation logs on page load
This commit is contained in:
parent
cd46a17e5f
commit
1d3d949962
1 changed files with 8 additions and 0 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue