Class: Raif::Admin::ConversationsController
- Inherits:
-
ApplicationController
- Object
- Raif::ApplicationController
- ApplicationController
- Raif::Admin::ConversationsController
- Defined in:
- app/controllers/raif/admin/conversations_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
6 7 8 |
# File 'app/controllers/raif/admin/conversations_controller.rb', line 6 def index @pagy, @conversations = pagy(Raif::Conversation.order(Arel.sql("latest_entry_at IS NULL, latest_entry_at DESC, created_at DESC"))) end |
#show ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/raif/admin/conversations_controller.rb', line 10 def show @conversation = Raif::Conversation.find(params[:id]) @system_prompt = @conversation.entries.last&.system_prompt # Archived cost events for all of this conversation's entries, loaded # once with their archives and grouped by entry id: the entry partial # renders archived-attempt badges from this hash instead of querying # per rendered entry. Stamp-only: an event without raif_archive_id # belongs to a completion deleted outside the archive job, which was # never archived, so nothing may claim it was. @archived_events_by_entry_id = Raif::InferenceCostEvent .where(source: @conversation.entries, raif_model_completion_id: nil) .where.not(raif_archive_id: nil) .includes(:raif_archive) .order(:id) .group_by(&:source_id) end |