Mercurial Hosting > lang
comparison src/lib/ai/claude/Ai_chat.luan @ 29:505185272dd7
edit chat
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 02 Aug 2025 22:39:48 -0600 |
parents | 3a80ddafe5a4 |
children | 0fb3488a017d |
comparison
equal
deleted
inserted
replaced
28:99b71a377f2c | 29:505185272dd7 |
---|---|
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 Ai_chat.output_messages_html(lang,thread,old_thread) | 30 function Ai_chat.output_messages_html(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%>" lang="<%=lang%>"><%=text%></div> | 59 <div markdown role="<%=role%>"><%=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) |