diff src/lib/ai/claude/Chat.luan @ 13:65bd7e245c63

add html
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 24 Jul 2025 22:47:48 -0600
parents 2d4b3f003ec2
children f5425a3c1898
line wrap: on
line diff
--- a/src/lib/ai/claude/Chat.luan	Thu Jul 24 22:14:49 2025 -0600
+++ b/src/lib/ai/claude/Chat.luan	Thu Jul 24 22:47:48 2025 -0600
@@ -27,13 +27,22 @@
 	%><%=system_prompt%><%
 end
 
-function Chat.output_messages_html(thread)
+function Chat.output_messages_html(thread,old_thread)
 	if thread == nil then
 		return
 	end
 	thread = json_parse(thread)
 	local messages = thread.messages or error
-	for _, message in ipairs(messages) do
+	local n = 0
+	if old_thread ~= nil then
+		old_thread = json_parse(old_thread)
+		local old_messages = old_thread.messages or error
+		n = #old_messages
+	end
+	for i, message in ipairs(messages) do
+		if i <= n then
+			continue
+		end
 		local role = message.role or error()
 		local who
 		if role=="assistant" then
@@ -96,7 +105,7 @@
 	messages[#messages+1] = {
 		role = "assistant"
 		content = [[
-uhuh
+hello
 ]]
 	}
 	if true then