Class: Assistant::ChatResponseComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Assistant::ChatResponseComponent
- Defined in:
- app/components/assistant/chat_response_component.rb
Overview
ViewComponent for rendering AI chat responses
Features:
- Markdown rendering with proper HTML formatting
- SQL queries in collapsible Bootstrap accordions
- Tables with export buttons (CSV/Excel)
- Formatted numbers, dates, and currency
- Entity links to CRM (customers, orders, products)
- Copy to clipboard button
Usage:
<%= render Assistant::ChatResponseComponent.new(response_text: message['content']) %>
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(response_text:) ⇒ ChatResponseComponent
constructor
A new instance of ChatResponseComponent.
Constructor Details
#initialize(response_text:) ⇒ ChatResponseComponent
Returns a new instance of ChatResponseComponent.
18 19 20 21 |
# File 'app/components/assistant/chat_response_component.rb', line 18 def initialize(response_text:) @response_text = response_text.to_s super() end |
Instance Method Details
#call ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'app/components/assistant/chat_response_component.rb', line 23 def call content_tag :div, class: 'chat-response' do safe_join([ , render_formatted_content ]) end end |