comparison src/lib/ai/claude/Chat.luan @ 16:f5425a3c1898

add languages
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 30 Jul 2025 10:38:27 -0600
parents 65bd7e245c63
children
comparison
equal deleted inserted replaced
15:49e9138b5460 16:f5425a3c1898
25 local system_prompt = thread.system or error 25 local system_prompt = thread.system or error
26 system_prompt = html_encode(system_prompt) 26 system_prompt = html_encode(system_prompt)
27 %><%=system_prompt%><% 27 %><%=system_prompt%><%
28 end 28 end
29 29
30 function Chat.output_messages_html(thread,old_thread) 30 function Chat.output_messages_html(lang,thread,old_thread)
31 if thread == nil then 31 if thread == nil then
32 return 32 return
33 end 33 end
34 thread = json_parse(thread) 34 thread = json_parse(thread)
35 local messages = thread.messages or error 35 local messages = thread.messages or error
54 end 54 end
55 local function output(text) 55 local function output(text)
56 text = html_encode(text) 56 text = html_encode(text)
57 %> 57 %>
58 <h3><%=who%></h3> 58 <h3><%=who%></h3>
59 <div markdown role="<%=role%>"><%=text%></div> 59 <div markdown role="<%=role%>" lang="<%=lang%>"><%=text%></div>
60 <% 60 <%
61 end 61 end
62 local content = message.content or error() 62 local content = message.content or error()
63 if type(content) == "string" then 63 if type(content) == "string" then
64 output(content) 64 output(content)