0
|
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
|
2
|
10 local function get_ai_thread(ai_key)
|
|
11 return "thread"
|
|
12 end
|
|
13
|
0
|
14 return function()
|
1
|
15 local ai_key = "whatever"
|
2
|
16 local thread = get_ai_thread(ai_key)
|
0
|
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>
|
2
|
27 <h1>Chat</h1>
|
1
|
28 <div ai_container="<%=ai_key%>" >
|
|
29 <div flex>
|
|
30 <div scroll>
|
|
31 <h2>Let's chat</h2>
|
2
|
32 <div messages>
|
|
33 </div>
|
1
|
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>
|
0
|
42 </div>
|
|
43 </body>
|
|
44 </html>
|
|
45 <%
|
|
46 end
|