24
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
|
3 local Html = require "luan:Html.luan"
|
|
4 local html_encode = Html.encode or error()
|
|
5 local Io = require "luan:Io.luan"
|
|
6 local Http = require "luan:http/Http.luan"
|
|
7 local Shared = require "site:/lib/Shared.luan"
|
|
8 local head = Shared.head or error()
|
|
9 local header = Shared.header or error()
|
|
10 local Course = require "site:/lib/Course.luan"
|
|
11 local get_course_by_id = Course.get_by_id or error()
|
|
12
|
|
13
|
|
14 return function()
|
|
15 local course_id = Http.request.parameters.course
|
27
|
16 local course = get_course_by_id(course_id) or error()
|
24
|
17 Io.stdout = Http.response.text_writer()
|
|
18 %>
|
|
19 <!doctype html>
|
|
20 <html lang="en">
|
|
21 <head>
|
|
22 <% head() %>
|
|
23 <style>
|
25
|
24 h4 {
|
|
25 margin-top: 22px;
|
|
26 margin-bottom: 4px;
|
|
27 }
|
24
|
28 </style>
|
|
29 </head>
|
|
30 <body>
|
|
31 <% header() %>
|
27
|
32 <div content>
|
25
|
33 <input type=hidden name=language value="<%=course.language%>">
|
24
|
34 <% if course_id ~= nil then %>
|
25
|
35 <input type=hidden name=course value="<%=course_id%>">
|
24
|
36 <% end %>
|
27
|
37 <h1>View Course</h1>
|
25
|
38
|
27
|
39 <h2><%= course.name_html() %></h2>
|
|
40
|
|
41 <h3><%= course.language_name() %></h3>
|
25
|
42
|
48
|
43 <p><a href="new_chat.red?course=<%=course.id%>">New chat</a></p>
|
47
|
44
|
25
|
45 <h4>AI system prompt</h4>
|
27
|
46 <pre><%=html_encode(course.ai_system_prompt)%></pre>
|
25
|
47
|
|
48 <h4>AI first message (optional)</h4>
|
47
|
49 <pre><%=html_encode(course.ai_first_message)%></pre>
|
|
50
|
|
51 <h4>Text to speech instructions</h4>
|
|
52 <pre><%=html_encode(course.tts_instructions)%></pre>
|
25
|
53
|
27
|
54 </div>
|
24
|
55 </body>
|
|
56 </html>
|
|
57 <%
|
|
58 end
|