Class: AdminSuite::Renderers::LegacyGleania::TurnMessagesRenderer
- Inherits:
-
AdminSuite::Renderer
- Object
- AdminSuite::Renderer
- AdminSuite::Renderers::LegacyGleania::TurnMessagesRenderer
- Defined in:
- lib/admin_suite/renderers/legacy_gleania.rb
Overview
Verbatim from BaseHelper#render_turn_messages_preview.
Instance Attribute Summary
Attributes inherited from AdminSuite::Renderer
Instance Method Summary collapse
Methods inherited from AdminSuite::Renderer
Constructor Details
This class inherits a constructor from AdminSuite::Renderer
Instance Method Details
#render ⇒ Object
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/admin_suite/renderers/legacy_gleania.rb', line 197 def render LegacyGleania.warn_once(:turn_messages_preview) user_msg = record.respond_to?(:user_message) ? record. : nil asst_msg = record.respond_to?(:assistant_message) ? record. : nil content_tag(:div, class: "space-y-4") do if user_msg view.concat(content_tag(:div, class: "rounded-lg border p-4 bg-blue-50 border-blue-200") do view.concat(content_tag(:div, class: "flex items-center gap-2 mb-2") do view.concat('<svg class="w-4 h-4 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/></svg>'.html_safe) view.concat(content_tag(:span, "User", class: "text-sm font-medium text-slate-700")) end) view.concat(content_tag(:div, view.simple_format(h(user_msg.respond_to?(:content) ? user_msg.content.to_s : user_msg.to_s)), class: "prose prose-sm max-w-none")) end) end if asst_msg view.concat(content_tag(:div, class: "rounded-lg border p-4 bg-emerald-50 border-emerald-200") do view.concat(content_tag(:div, class: "flex items-center gap-2 mb-2") do view.concat('<svg class="w-4 h-4 text-emerald-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"/></svg>'.html_safe) view.concat(content_tag(:span, "Assistant", class: "text-sm font-medium text-slate-700")) end) view.concat(content_tag(:div, view.simple_format(h(asst_msg.respond_to?(:content) ? asst_msg.content.to_s : asst_msg.to_s)), class: "prose prose-sm max-w-none")) end) end view.concat(content_tag(:p, "No messages found", class: "text-slate-400 italic text-sm")) unless user_msg || asst_msg end end |