mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
Toggle chat session view on clicking the Obsidian chat sessions button
This commit is contained in:
@@ -91,7 +91,7 @@ export class KhojChatView extends KhojPaneView {
|
|||||||
class: "khoj-input-row-button clickable-icon",
|
class: "khoj-input-row-button clickable-icon",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
chatSessions.addEventListener('click', async (_) => { await this.showChatSessions(chatBodyEl) });
|
chatSessions.addEventListener('click', async (_) => { await this.toggleChatSessions(chatBodyEl) });
|
||||||
setIcon(chatSessions, "history");
|
setIcon(chatSessions, "history");
|
||||||
|
|
||||||
let chatInput = inputRow.createEl("textarea", {
|
let chatInput = inputRow.createEl("textarea", {
|
||||||
@@ -468,7 +468,11 @@ export class KhojChatView extends KhojPaneView {
|
|||||||
this.renderMessage(chatBodyEl, "Hey 👋🏾, what's up?", "khoj");
|
this.renderMessage(chatBodyEl, "Hey 👋🏾, what's up?", "khoj");
|
||||||
}
|
}
|
||||||
|
|
||||||
async showChatSessions(chatBodyEl: HTMLElement): Promise<boolean> {
|
async toggleChatSessions(chatBodyEl: HTMLElement): Promise<boolean> {
|
||||||
|
if (this.contentEl.getElementsByClassName("side-panel")?.length > 0) {
|
||||||
|
chatBodyEl.innerHTML = "";
|
||||||
|
return this.getChatHistory(chatBodyEl);
|
||||||
|
}
|
||||||
chatBodyEl.innerHTML = "";
|
chatBodyEl.innerHTML = "";
|
||||||
const sidePanelEl = this.contentEl.createDiv("side-panel");
|
const sidePanelEl = this.contentEl.createDiv("side-panel");
|
||||||
const newConversationEl = sidePanelEl.createDiv("new-conversation");
|
const newConversationEl = sidePanelEl.createDiv("new-conversation");
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ If your plugin does not need CSS, delete this file.
|
|||||||
|
|
||||||
.khoj-chat {
|
.khoj-chat {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
grid-template-rows: auto 1fr auto;
|
||||||
background: var(--background-primary);
|
background: var(--background-primary);
|
||||||
color: var(--text-normal);
|
color: var(--text-normal);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user