Mercurial Hosting > lang
comparison src/chat.js @ 6:025bb19b65b1
use claude
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 17 Jul 2025 23:19:22 -0600 |
parents | a970b7a01a74 |
children | 46097e607701 |
comparison
equal
deleted
inserted
replaced
5:a970b7a01a74 | 6:025bb19b65b1 |
---|---|
33 | 33 |
34 function hideWaitingAiIcon() { | 34 function hideWaitingAiIcon() { |
35 document.querySelector('[waiting-ai-icon]').style.display = 'none'; | 35 document.querySelector('[waiting-ai-icon]').style.display = 'none'; |
36 } | 36 } |
37 | 37 |
38 // requires markdown-it | |
39 function handleMarkdown() { | |
40 let converter = window.markdownit(); | |
41 let divs = document.querySelectorAll('[role]'); | |
42 for( let div of divs ) { | |
43 div.innerHTML = converter.render(div.textContent); | |
44 } | |
45 } | |
46 | |
38 function updateAi(html) { | 47 function updateAi(html) { |
39 hideWaitingAiIcon(); | 48 hideWaitingAiIcon(); |
40 document.querySelector('div[messages]').innerHTML = html; | 49 document.querySelector('div[messages]').innerHTML = html; |
41 //handleMarkdown(); | 50 handleMarkdown(); |
42 document.querySelector('textarea').focus(); | 51 document.querySelector('textarea').focus(); |
52 window.scrollTo(0, document.body.scrollHeight); | |
43 /* | 53 /* |
44 let scroll = aiDialog.querySelector('[scroll]'); | 54 let scroll = aiDialog.querySelector('[scroll]'); |
45 setTimeout(function(){ | 55 setTimeout(function(){ |
46 scroll.scrollTo(0,scroll.scrollHeight); | 56 scroll.scrollTo(0,scroll.scrollHeight); |
47 }); | 57 }); |