Mercurial Hosting > lang
comparison src/chat.html.luan @ 29:505185272dd7
edit chat
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 02 Aug 2025 22:39:48 -0600 |
parents | 99b71a377f2c |
children | 1e7d855afde3 |
comparison
equal
deleted
inserted
replaced
28:99b71a377f2c | 29:505185272dd7 |
---|---|
1 local Luan = require "luan:Luan.luan" | 1 local Luan = require "luan:Luan.luan" |
2 local error = Luan.error | 2 local error = Luan.error |
3 local Parsers = require "luan:Parsers.luan" | |
4 local json_string = Parsers.json_string or error() | |
3 local Io = require "luan:Io.luan" | 5 local Io = require "luan:Io.luan" |
4 local Http = require "luan:http/Http.luan" | 6 local Http = require "luan:http/Http.luan" |
5 local Shared = require "site:/lib/Shared.luan" | 7 local Shared = require "site:/lib/Shared.luan" |
6 local head = Shared.head or error() | 8 local head = Shared.head or error() |
7 local header = Shared.header or error() | 9 local header = Shared.header or error() |
25 <head> | 27 <head> |
26 <% head() %> | 28 <% head() %> |
27 <style> | 29 <style> |
28 @import "/chat.css?s=<%=started%>"; | 30 @import "/chat.css?s=<%=started%>"; |
29 </style> | 31 </style> |
30 <script> | |
31 let chatId = <%= chat.id %>; | |
32 let lang = '<%= chat.language_region %>'; | |
33 </script> | |
34 <script src="/chat.js?s=<%=started%>"></script> | 32 <script src="/chat.js?s=<%=started%>"></script> |
35 </head> | 33 </head> |
36 <body> | 34 <body> |
37 <% header() %> | 35 <% header() %> |
38 <div content ai_container> | 36 <div content ai_container> |
39 <div top> | 37 <div top> |
40 <h3 name><%= chat.name_html() %></h3> | 38 <h3 name></h3> |
41 <span pulldown> | 39 <span pulldown> |
42 <img onclick="clickMenu(this)" src="/images/menu.svg"> | 40 <img onclick="clickMenu(this)" src="/images/menu.svg"> |
43 <div> | 41 <div> |
44 <span onclick="renameChat()">Rename Chat</span> | 42 <span onclick="editChat()">Edit Chat</span> |
45 <span onclick="deleteChat()">Delete Chat</span> | 43 <span onclick="deleteChat()">Delete Chat</span> |
46 <span onclick="systemPrompt()">System Prompt</span> | 44 <span onclick="systemPrompt()">System Prompt</span> |
47 </div> | 45 </div> |
48 </span> | 46 </span> |
49 </div> | 47 </div> |
58 <button onclick="askAi()" title="Send"><img src="/images/send.svg"></button> | 56 <button onclick="askAi()" title="Send"><img src="/images/send.svg"></button> |
59 </div> | 57 </div> |
60 </div> | 58 </div> |
61 </div> | 59 </div> |
62 <img waiting-ai-icon src="/images/spinner_green.gif"> | 60 <img waiting-ai-icon src="/images/spinner_green.gif"> |
63 <dialog rename> | 61 <dialog edit> |
64 <h2>Rename Chat</h2> | 62 <h2>Edit Chat</h2> |
65 <form action="javascript:saveRenameChat()"> | 63 <form onsubmit="saveChat(this)" action="javascript:"> |
64 <input type=hidden name=chat value="<%=chat.id%>"> | |
66 <p> | 65 <p> |
67 <label>Chat name</label><br> | 66 <label>Chat name</label><br> |
68 <input name=name required><br> | 67 <input name=name required><br> |
69 <span error></span> | 68 <span error></span> |
70 </p> | 69 </p> |
71 <div buttons> | 70 <div buttons> |
72 <button type=button onclick="closeModal(this)">Cancel</button> | 71 <button type=button onclick="closeModal(this)">Cancel</button> |
73 <button type=submit>Rename</button> | 72 <button type=submit>Save</button> |
74 </div> | 73 </div> |
75 </form> | 74 </form> |
76 </dialog> | 75 </dialog> |
77 <dialog delete> | 76 <dialog delete> |
78 <h2>Delete Chat</h2> | 77 <h2>Delete Chat</h2> |
92 <button onclick="closeModal(this)">Close</button> | 91 <button onclick="closeModal(this)">Close</button> |
93 </div> | 92 </div> |
94 </dialog> | 93 </dialog> |
95 <input name=initialized style="display:none"> | 94 <input name=initialized style="display:none"> |
96 <script> | 95 <script> |
97 handleMarkdown(); | 96 setChat(<%= json_string(chat.info()) %>); |
97 handleChatMarkdown(); | |
98 setTimeout(function(){ | 98 setTimeout(function(){ |
99 let initialized = document.querySelector('[name=initialized]'); | 99 let initialized = document.querySelector('[name=initialized]'); |
100 if( !initialized.value ) { | 100 if( !initialized.value ) { |
101 initialized.value = 'yes'; | 101 initialized.value = 'yes'; |
102 //alert('init'); | 102 //alert('init'); |