Spaces:
Paused
Paused
frdel commited on
Commit ·
e93554b
1
Parent(s): 4d8c6f2
scroller fix
Browse files- webui/js/messages.js +8 -13
webui/js/messages.js
CHANGED
|
@@ -12,7 +12,6 @@ let messageGroup = null;
|
|
| 12 |
// Simplified implementation - no complex interactions needed
|
| 13 |
|
| 14 |
export function setMessage(id, type, heading, content, temp, kvps = null) {
|
| 15 |
-
|
| 16 |
// Search for the existing message container by id
|
| 17 |
let messageContainer = document.getElementById(`message-${id}`);
|
| 18 |
let isNewMessage = false;
|
|
@@ -70,9 +69,9 @@ export function setMessage(id, type, heading, content, temp, kvps = null) {
|
|
| 70 |
messageGroup.appendChild(messageContainer);
|
| 71 |
chatHistory.appendChild(messageGroup);
|
| 72 |
}
|
| 73 |
-
|
| 74 |
// Simplified implementation - no setup needed
|
| 75 |
-
|
| 76 |
return messageContainer;
|
| 77 |
}
|
| 78 |
|
|
@@ -179,6 +178,9 @@ export function _drawMessage(
|
|
| 179 |
messageDiv.appendChild(bodyDiv);
|
| 180 |
}
|
| 181 |
|
|
|
|
|
|
|
|
|
|
| 182 |
// Handle KVPs incrementally
|
| 183 |
drawKvpsIncremental(bodyDiv, kvps, false);
|
| 184 |
|
|
@@ -205,9 +207,6 @@ export function _drawMessage(
|
|
| 205 |
processedContent = convertPathsToLinks(processedContent);
|
| 206 |
processedContent = addBlankTargetsToLinks(processedContent);
|
| 207 |
|
| 208 |
-
// reapply scroll position or autoscroll
|
| 209 |
-
const scroller = new Scroller(contentDiv);
|
| 210 |
-
|
| 211 |
spanElement.innerHTML = processedContent;
|
| 212 |
|
| 213 |
// KaTeX rendering for markdown
|
|
@@ -223,8 +222,6 @@ export function _drawMessage(
|
|
| 223 |
addActionButtonsToElement(contentDiv);
|
| 224 |
adjustMarkdownRender(contentDiv);
|
| 225 |
|
| 226 |
-
// reapply scroll position or autoscroll
|
| 227 |
-
scroller.reApplyScroll();
|
| 228 |
} else {
|
| 229 |
let preElement = bodyDiv.querySelector(".msg-content");
|
| 230 |
if (!preElement) {
|
|
@@ -244,16 +241,11 @@ export function _drawMessage(
|
|
| 244 |
preElement.appendChild(spanElement);
|
| 245 |
}
|
| 246 |
|
| 247 |
-
// reapply scroll position or autoscroll
|
| 248 |
-
const scroller = new Scroller(preElement);
|
| 249 |
-
|
| 250 |
spanElement.innerHTML = convertHTML(content);
|
| 251 |
|
| 252 |
// Ensure action buttons exist
|
| 253 |
addActionButtonsToElement(preElement);
|
| 254 |
|
| 255 |
-
// reapply scroll position or autoscroll
|
| 256 |
-
scroller.reApplyScroll();
|
| 257 |
}
|
| 258 |
} else {
|
| 259 |
// Remove content if it exists but content is empty
|
|
@@ -263,6 +255,9 @@ export function _drawMessage(
|
|
| 263 |
}
|
| 264 |
}
|
| 265 |
|
|
|
|
|
|
|
|
|
|
| 266 |
if (followUp) {
|
| 267 |
messageContainer.classList.add("message-followup");
|
| 268 |
}
|
|
|
|
| 12 |
// Simplified implementation - no complex interactions needed
|
| 13 |
|
| 14 |
export function setMessage(id, type, heading, content, temp, kvps = null) {
|
|
|
|
| 15 |
// Search for the existing message container by id
|
| 16 |
let messageContainer = document.getElementById(`message-${id}`);
|
| 17 |
let isNewMessage = false;
|
|
|
|
| 69 |
messageGroup.appendChild(messageContainer);
|
| 70 |
chatHistory.appendChild(messageGroup);
|
| 71 |
}
|
| 72 |
+
|
| 73 |
// Simplified implementation - no setup needed
|
| 74 |
+
|
| 75 |
return messageContainer;
|
| 76 |
}
|
| 77 |
|
|
|
|
| 178 |
messageDiv.appendChild(bodyDiv);
|
| 179 |
}
|
| 180 |
|
| 181 |
+
// reapply scroll position or autoscroll
|
| 182 |
+
const scroller = new Scroller(bodyDiv);
|
| 183 |
+
|
| 184 |
// Handle KVPs incrementally
|
| 185 |
drawKvpsIncremental(bodyDiv, kvps, false);
|
| 186 |
|
|
|
|
| 207 |
processedContent = convertPathsToLinks(processedContent);
|
| 208 |
processedContent = addBlankTargetsToLinks(processedContent);
|
| 209 |
|
|
|
|
|
|
|
|
|
|
| 210 |
spanElement.innerHTML = processedContent;
|
| 211 |
|
| 212 |
// KaTeX rendering for markdown
|
|
|
|
| 222 |
addActionButtonsToElement(contentDiv);
|
| 223 |
adjustMarkdownRender(contentDiv);
|
| 224 |
|
|
|
|
|
|
|
| 225 |
} else {
|
| 226 |
let preElement = bodyDiv.querySelector(".msg-content");
|
| 227 |
if (!preElement) {
|
|
|
|
| 241 |
preElement.appendChild(spanElement);
|
| 242 |
}
|
| 243 |
|
|
|
|
|
|
|
|
|
|
| 244 |
spanElement.innerHTML = convertHTML(content);
|
| 245 |
|
| 246 |
// Ensure action buttons exist
|
| 247 |
addActionButtonsToElement(preElement);
|
| 248 |
|
|
|
|
|
|
|
| 249 |
}
|
| 250 |
} else {
|
| 251 |
// Remove content if it exists but content is empty
|
|
|
|
| 255 |
}
|
| 256 |
}
|
| 257 |
|
| 258 |
+
// reapply scroll position or autoscroll
|
| 259 |
+
scroller.reApplyScroll();
|
| 260 |
+
|
| 261 |
if (followUp) {
|
| 262 |
messageContainer.classList.add("message-followup");
|
| 263 |
}
|