Support multiple chat sessions within the web UI (#638)

* Enable support for multiple chat sessions within the web client

- Allow users to create multiple chat sessions and manage them
- Give chat session slugs based on the most recent message
- Update web UI to have a collapsible menu with active chats
- Move chat routes into a separate file

* Make the collapsible side panel more graceful, improve some styling elements of the new layout

* Support modification of the conversation title

- Add a new field to the conversation object
- Update UI to add a threedotmenu to each conversation

* Get the default conversation if a matching one is not found by id
This commit is contained in:
sabaimran
2024-02-11 02:18:28 -08:00
committed by GitHub
parent 208ccc83ec
commit 1412ed6a00
15 changed files with 981 additions and 301 deletions

View File

@@ -107,7 +107,7 @@ a.khoj-nav-selected {
background-color: var(--primary);
}
img.khoj-logo {
width: min(60vw, 111px);
width: min(60vw, 90px);
max-width: 100%;
justify-self: center;
}
@@ -117,7 +117,7 @@ img.khoj-logo {
display: grid;
grid-auto-flow: column;
gap: 20px;
padding: 16px 10px;
padding: 12px 10px;
margin: 0 0 16px 0;
}

View File

@@ -54,7 +54,6 @@
// Add event listener to toggle full reference on click
referenceButton.addEventListener('click', function() {
console.log(`Toggling ref-${index}`)
if (this.classList.contains("collapsed")) {
this.classList.remove("collapsed");
this.classList.add("expanded");
@@ -100,7 +99,6 @@
// Add event listener to toggle full reference on click
referenceButton.addEventListener('click', function() {
console.log(`Toggling ref-${index}`)
if (this.classList.contains("collapsed")) {
this.classList.remove("collapsed");
this.classList.add("expanded");
@@ -586,8 +584,10 @@
return data.response;
})
.then(response => {
const fullChatLog = response.chat;
// Render conversation history, if any
response.forEach(chat_log => {
fullChatLog.forEach(chat_log => {
renderMessageWithReference(chat_log.message, chat_log.by, chat_log.context, new Date(chat_log.created), chat_log.onlineContext, chat_log.intent?.type, chat_log.intent?.["inferred-queries"]);
});
})