Mercurial Hosting > lang
comparison src/private/tools/chat.html.luan @ 7:255c36830154
chat tools
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 18 Jul 2025 17:42:45 -0600 |
parents | |
children | 46097e607701 |
comparison
equal
deleted
inserted
replaced
6:025bb19b65b1 | 7:255c36830154 |
---|---|
1 local Luan = require "luan:Luan.luan" | |
2 local error = Luan.error | |
3 local Io = require "luan:Io.luan" | |
4 local Http = require "luan:http/Http.luan" | |
5 local Shared = require "site:/lib/Shared.luan" | |
6 local head = Shared.head or error() | |
7 local header = Shared.header or error() | |
8 local started = Shared.started or error() | |
9 local Chat = require "site:/lib/Chat.luan" | |
10 local get_chat_by_id = Chat.get_by_id or error() | |
11 | |
12 | |
13 return function() | |
14 local chat_id = Http.request.parameters.chat or error() | |
15 local process_markdown = Http.request.parameters.markdown ~= nil | |
16 local chat = get_chat_by_id(chat_id) or error() | |
17 Io.stdout = Http.response.text_writer() | |
18 %> | |
19 <!doctype html> | |
20 <html lang="en"> | |
21 <head> | |
22 <% head() %> | |
23 <style> | |
24 @import "/chat.css?s=<%=started%>"; | |
25 | |
26 <% if not process_markdown then %> | |
27 [ai_container] [role] { | |
28 white-space-collapse: preserve; | |
29 } | |
30 <% end %> | |
31 </style> | |
32 <script src="https://cdn.jsdelivr.net/npm/markdown-it@14.1.0/dist/markdown-it.min.js"></script> | |
33 <script src="/chat.js?s=<%=started%>"></script> | |
34 </head> | |
35 <body ai_container> | |
36 <% header() %> | |
37 <div content> | |
38 <h1>Chat <%=chat_id%></h1> | |
39 <h3 name><%= chat.name_html() %></h3> | |
40 <div messages> | |
41 <% chat.output_messages_html() %> | |
42 </div> | |
43 </div> | |
44 <% if process_markdown then %> | |
45 <script> | |
46 handleMarkdown(); | |
47 </script> | |
48 <% end %> | |
49 </body> | |
50 </html> | |
51 <% | |
52 end |