mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 21:29:11 +00:00
Keep loading animation at message end & reduce lists padding in Obsidian
Previously loading animation would be at top of message. Moving it to bottom is more intuitve and easier to track. Remove white-space: pre from list elements. It was adding too much y axis padding to chat messages (and train of thought)
This commit is contained in:
@@ -1299,13 +1299,18 @@ export class KhojChatView extends KhojPaneView {
|
|||||||
|
|
||||||
handleStreamResponse(newResponseElement: HTMLElement | null, rawResponse: string, loadingEllipsis: HTMLElement | null, replace = true) {
|
handleStreamResponse(newResponseElement: HTMLElement | null, rawResponse: string, loadingEllipsis: HTMLElement | null, replace = true) {
|
||||||
if (!newResponseElement) return;
|
if (!newResponseElement) return;
|
||||||
if (replace && newResponseElement.getElementsByClassName("lds-ellipsis").length > 0 && loadingEllipsis) {
|
// Remove loading ellipsis if it exists
|
||||||
|
if (newResponseElement.getElementsByClassName("lds-ellipsis").length > 0 && loadingEllipsis)
|
||||||
newResponseElement.removeChild(loadingEllipsis);
|
newResponseElement.removeChild(loadingEllipsis);
|
||||||
}
|
// Clear the response element if replace is true
|
||||||
if (replace) {
|
if (replace) newResponseElement.innerHTML = "";
|
||||||
newResponseElement.innerHTML = "";
|
|
||||||
}
|
// Append response to the response element
|
||||||
newResponseElement.appendChild(this.formatHTMLMessage(rawResponse, false, replace));
|
newResponseElement.appendChild(this.formatHTMLMessage(rawResponse, false, replace));
|
||||||
|
|
||||||
|
// Append loading ellipsis if it exists
|
||||||
|
if (!replace && loadingEllipsis) newResponseElement.appendChild(loadingEllipsis);
|
||||||
|
// Scroll to bottom of chat view
|
||||||
this.scrollChatToBottom();
|
this.scrollChatToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,12 @@ If your plugin does not need CSS, delete this file.
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
white-space: pre-line;
|
white-space: pre-line;
|
||||||
}
|
}
|
||||||
|
/* Override white-space for ul, ol, li under khoj-chat-message-text.khoj */
|
||||||
|
.khoj-chat-message-text.khoj ul,
|
||||||
|
.khoj-chat-message-text.khoj ol,
|
||||||
|
.khoj-chat-message-text.khoj li {
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
/* add left protrusion to khoj chat bubble */
|
/* add left protrusion to khoj chat bubble */
|
||||||
.khoj-chat-message-text.khoj:after {
|
.khoj-chat-message-text.khoj:after {
|
||||||
content: '';
|
content: '';
|
||||||
|
|||||||
Reference in New Issue
Block a user