comparison src/chat.html.luan @ 50:85c5f62070d8

misc
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 15 Aug 2025 09:33:29 +0900
parents 97b0d206cacd
children 4581a20b8124
comparison
equal deleted inserted replaced
49:97b0d206cacd 50:85c5f62070d8
49 <% if is_owner then %> 49 <% if is_owner then %>
50 <span onclick="editChat()">Edit Chat</span> 50 <span onclick="editChat()">Edit Chat</span>
51 <span onclick="deleteChat()">Delete Chat</span> 51 <span onclick="deleteChat()">Delete Chat</span>
52 <% end %> 52 <% end %>
53 <span onclick="systemPrompt()">System Prompt</span> 53 <span onclick="systemPrompt()">System Prompt</span>
54 <span onclick="chatJson()">Chat JSON</span> 54 <a href="chat.json?chat=<%=chat_id%>">Chat JSON</a>
55 </div> 55 </div>
56 </span> 56 </span>
57 </div> 57 </div>
58 <div messages> 58 <div messages>
59 <% chat.output_messages_html() %> 59 <% chat.output_messages_html() %>
60 </div> 60 </div>
61 <% if is_owner then %> 61 <% if is_owner then %>
62 <div ask> 62 <div ask>
63 <textarea autofocus oninput="fixChatTextarea(event.target)" onkeydown="textareaKey(event)"><%= html_encode(init_text) %></textarea> 63 <textarea oninput="fixChatTextarea(event.target)" onkeydown="textareaKey(event)"><%= html_encode(init_text) %></textarea>
64 <div buttons> 64 <div buttons>
65 <audio controls preload=none></audio> 65 <audio controls preload=none></audio>
66 <button record onclick="toggleRecording()">Record</button> 66 <button record onclick="toggleRecording()">Record</button>
67 <button onclick="askAi()" title="Send"><img src="/images/send.svg"></button> 67 <button onclick="askAi()" title="Send"><img src="/images/send.svg"></button>
68 </div> 68 </div>
114 <dialog system_prompt> 114 <dialog system_prompt>
115 <h2>System Prompt</h2> 115 <h2>System Prompt</h2>
116 <pre> 116 <pre>
117 <% chat.output_system_prompt() %> 117 <% chat.output_system_prompt() %>
118 </pre> 118 </pre>
119 <h3>Text to speech instructions</h3>
120 <pre>
121 <%= chat.tts_instructions %>
122 </pre>
119 <p><a href="view_course.html?course=<%=chat.course_id%>">View course</a></p> 123 <p><a href="view_course.html?course=<%=chat.course_id%>">View course</a></p>
120 <div buttons> 124 <div buttons>
121 <button onclick="closeModal(this)">Close</button> 125 <button onclick="closeModal(this)">Close</button>
122 </div> 126 </div>
123 </dialog> 127 </dialog>
124 <input name=initialized style="display:none"> 128 <input name=initialized style="display:none">
125 <script> 129 <script>
126 'use strict'; 130 'use strict';
127 //let test = 'a';
128 //alert(test);
129 //test = 'b';
130 setChat(<%= json_string(chat.info()) %>); 131 setChat(<%= json_string(chat.info()) %>);
131 handleChatMarkdown(); 132 handleChatMarkdown();
132 scrollToEnd();
133 /*
134 setTimeout(function(){ 133 setTimeout(function(){
135 let initialized = document.querySelector('[name=initialized]'); 134 let initialized = document.querySelector('[name=initialized]');
136 if( !initialized.value ) { 135 if( !initialized.value ) {
137 initialized.value = 'yes'; 136 initialized.value = 'yes';
138 //alert('init'); 137 //alert('init');
138 document.querySelector('textarea').focus();
139 scrollToEnd(); 139 scrollToEnd();
140 } 140 }
141 },10); 141 },100);
142 */
143 </script> 142 </script>
144 </body> 143 </body>
145 </html> 144 </html>
146 <% 145 <%
147 end 146 end