Mercurial Hosting > lang
comparison src/chat.js @ 9:46097e607701
romaji
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 21 Jul 2025 15:16:47 -0600 |
parents | 025bb19b65b1 |
children | 003a90ce72d7 |
comparison
equal
deleted
inserted
replaced
8:2b7dcf355a78 | 9:46097e607701 |
---|---|
25 function doDeleteChat(el) { | 25 function doDeleteChat(el) { |
26 closeModal(el); | 26 closeModal(el); |
27 ajax(`delete_chat.js?chat=${chatId}`); | 27 ajax(`delete_chat.js?chat=${chatId}`); |
28 } | 28 } |
29 | 29 |
30 function systemPrompt() { | |
31 let dialog = document.querySelector('dialog[system_prompt]'); | |
32 dialog.showModal(); | |
33 } | |
34 | |
30 function showWaitingAiIcon() { | 35 function showWaitingAiIcon() { |
31 document.querySelector('[waiting-ai-icon]').style.display = 'block'; | 36 document.querySelector('[waiting-ai-icon]').style.display = 'block'; |
32 } | 37 } |
33 | 38 |
34 function hideWaitingAiIcon() { | 39 function hideWaitingAiIcon() { |
35 document.querySelector('[waiting-ai-icon]').style.display = 'none'; | 40 document.querySelector('[waiting-ai-icon]').style.display = 'none'; |
36 } | |
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 } | 41 } |
46 | 42 |
47 function updateAi(html) { | 43 function updateAi(html) { |
48 hideWaitingAiIcon(); | 44 hideWaitingAiIcon(); |
49 document.querySelector('div[messages]').innerHTML = html; | 45 document.querySelector('div[messages]').innerHTML = html; |