Mercurial Hosting > lang
view src/private/tools/chat.html.luan @ 71:44bec62c49e2 default tip
split ask
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 24 Aug 2025 08:32:08 -0600 |
parents | e8f632349db7 |
children |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local Parsers = require "luan:Parsers.luan" local json_string = Parsers.json_string or error() local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" local head = Shared.head or error() local header = Shared.header or error() local started = Shared.started or error() local Chat = require "site:/lib/Chat.luan" local get_chat_by_id = Chat.get_by_id or error() return function() local chat_id = Http.request.parameters.chat or error() local process_markdown = Http.request.parameters.markdown ~= nil local chat = get_chat_by_id(chat_id) or error() Io.stdout = Http.response.text_writer() %> <!doctype html> <html lang="en"> <head> <% head() %> <style> <% if not process_markdown then %> [markdown] { white-space-collapse: preserve; margin-bottom: 16px; } <% end %> </style> </head> <body> <% header() %> <div content> <h1>Chat <%=chat_id%></h1> <h2 name><%= chat.name_html() %></h2> <p> <a href="/chat.html?chat=<%=chat_id%>">Chat</a> - <a href="/chat.json?chat=<%=chat_id%>">JSON</a> </p> <p>Voice: <%=chat.voice%></p> <div messages> <% chat.output_messages_html() %> </div> </div> <% if process_markdown then %> <script> handleMarkdown(<%=json_string(chat.voice)%>,<%=json_string(chat.tts_instructions)%>); </script> <% end %> </body> </html> <% end