diff src/chat.js @ 27:176a182c02cf

add view_course
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 01 Aug 2025 20:08:13 -0600
parents 3a80ddafe5a4
children 99b71a377f2c
line wrap: on
line diff
--- a/src/chat.js	Fri Aug 01 17:12:03 2025 -0600
+++ b/src/chat.js	Fri Aug 01 20:08:13 2025 -0600
@@ -48,18 +48,16 @@
 	}
 }
 
+function scrollToEnd() {
+	window.scrollTo(0, document.body.scrollHeight);
+}
+
 function updateAi(html) {
 	hideWaitingAiIcon();
 	document.querySelector('div[messages]').insertAdjacentHTML('beforeend',html);
 	handleMarkdown();
 	document.querySelector('textarea').focus();
-	window.scrollTo(0, document.body.scrollHeight);
-/*
-	let scroll = aiDialog.querySelector('[scroll]');
-	setTimeout(function(){
-		scroll.scrollTo(0,scroll.scrollHeight);
-	});
-*/
+	scrollToEnd();
 	playLastMessage();
 }