comparison src/lib/Chat.luan @ 69:f5e72f2d1025

add stt_prompt
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 23 Aug 2025 07:07:59 -0600
parents ecb851fabd75
children 44bec62c49e2
comparison
equal deleted inserted replaced
68:a366d27db8f1 69:f5e72f2d1025
35 voice = doc.voice 35 voice = doc.voice
36 show_text = doc.show_text 36 show_text = doc.show_text
37 autoplay = doc.autoplay == "true" 37 autoplay = doc.autoplay == "true"
38 is_private = doc.is_private == "true" 38 is_private = doc.is_private == "true"
39 has_ruby = doc.has_ruby == "true" 39 has_ruby = doc.has_ruby == "true"
40 stt_prompt = doc.stt_prompt or ""
40 } 41 }
41 end 42 end
42 43
43 local function to_doc(chat) 44 local function to_doc(chat)
44 return { 45 return {
48 chat_updated = long(chat.updated) 49 chat_updated = long(chat.updated)
49 course_id = long(chat.course_id) 50 course_id = long(chat.course_id)
50 name = chat.name or error() 51 name = chat.name or error()
51 ai_thread = chat.ai_thread or error() 52 ai_thread = chat.ai_thread or error()
52 language = chat.language or error() 53 language = chat.language or error()
53 tts_instructions = chat.tts_instructions -- or error() 54 tts_instructions = chat.tts_instructions or error()
54 voice = chat.voice or error() 55 voice = chat.voice or error()
55 show_text = chat.show_text 56 show_text = chat.show_text
56 autoplay = chat.autoplay and "true" or "false" 57 autoplay = chat.autoplay and "true" or "false"
57 is_private = chat.is_private and "true" or nil 58 is_private = chat.is_private and "true" or nil
58 has_ruby = chat.has_ruby and "true" or nil 59 has_ruby = chat.has_ruby and "true" or nil
60 stt_prompt = chat.stt_prompt or error()
59 } 61 }
60 end 62 end
61 63
62 function Chat.new(chat) 64 function Chat.new(chat)
63 chat.updated = chat.updated or time_now() 65 chat.updated = chat.updated or time_now()
85 tts_instructions = chat.tts_instructions 87 tts_instructions = chat.tts_instructions
86 name = chat.name 88 name = chat.name
87 show_text = chat.show_text 89 show_text = chat.show_text
88 autoplay = chat.autoplay 90 autoplay = chat.autoplay
89 is_private = chat.is_private 91 is_private = chat.is_private
92 stt_prompt = chat.stt_prompt
90 } 93 }
91 end 94 end
92 95
93 function chat.name_html() 96 function chat.name_html()
94 return html_encode(chat.name) 97 return html_encode(chat.name)