comparison src/chat.html.luan @ 2:78708fa556a0

add login
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 08 Jul 2025 15:55:34 -0600
parents src/index.html.luan@1c87f785eb42
children b1adec083e44
comparison
equal deleted inserted replaced
1:1c87f785eb42 2:78708fa556a0
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
9
10 local function get_ai_thread(ai_key)
11 return "thread"
12 end
13
14 return function()
15 local ai_key = "whatever"
16 local thread = get_ai_thread(ai_key)
17 Io.stdout = Http.response.text_writer()
18 %>
19 <!doctype html>
20 <html lang="en">
21 <head>
22 <% head() %>
23 </head>
24 <body>
25 <% header() %>
26 <div content>
27 <h1>Chat</h1>
28 <div ai_container="<%=ai_key%>" >
29 <div flex>
30 <div scroll>
31 <h2>Let's chat</h2>
32 <div messages>
33 </div>
34 </div>
35 <div ask>
36 <textarea autofocus oninput="fixTextarea(event)" onkeydown="textareaKey('<%=ai_key%>',event)"></textarea>
37 <button onclick="askAi('<%=ai_key%>')" title="Send"><img src="/images/send.svg"></button>
38 </div>
39 </div>
40 <img waiting-ai-icon src="/images/spinner_green.gif">
41 </div>
42 </div>
43 </body>
44 </html>
45 <%
46 end