Class: Raif::Admin::PromptStudio::AgentsController

Inherits:
BaseController show all
Defined in:
app/controllers/raif/admin/prompt_studio/agents_controller.rb

Instance Method Summary collapse

Methods inherited from Raif::ApplicationController

#raif_current_user

Instance Method Details

#indexObject



7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/raif/admin/prompt_studio/agents_controller.rb', line 7

def index
  @agent_types = Raif::Agent.distinct.pluck(:type).sort
  @selected_type = params[:agent_type] if params[:agent_type].present?
  @llm_model_keys = Raif::Agent.where(type: @selected_type).distinct.pluck(:llm_model_key).compact.sort if @selected_type.present?

  if @selected_type.present?
    agents = apply_filters(Raif::Agent.where(type: @selected_type)).order(created_at: :desc)
    @pagy, @agents = pagy(agents)
  end
end

#showObject



18
19
20
21
# File 'app/controllers/raif/admin/prompt_studio/agents_controller.rb', line 18

def show
  @agent = Raif::Agent.find(params[:id])
  @comparison = build_prompt_comparison(@agent)
end