Class: RcrewAI::Rails::Api::V1::CrewsController
- Inherits:
-
RcrewAI::Rails::ApplicationController
- Object
- ActionController::Base
- RcrewAI::Rails::ApplicationController
- RcrewAI::Rails::Api::V1::CrewsController
- Defined in:
- app/controllers/rcrewai/rails/api/v1/crews_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/rcrewai/rails/api/v1/crews_controller.rb', line 18 def create @crew = Crew.new(crew_params) if @crew.save render json: @crew, status: :created else render json: { errors: @crew.errors }, status: :unprocessable_entity end end |
#execute ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/rcrewai/rails/api/v1/crews_controller.rb', line 28 def execute inputs = params[:inputs] || {} execution = @crew.execute_async(inputs) render json: { execution_id: execution.id, status: execution.status, message: 'Crew execution started successfully' } end |
#index ⇒ Object
9 10 11 12 |
# File 'app/controllers/rcrewai/rails/api/v1/crews_controller.rb', line 9 def index @crews = Crew.includes(:agents, :tasks).all render json: @crews.as_json(include: [:agents, :tasks]) end |
#show ⇒ Object
14 15 16 |
# File 'app/controllers/rcrewai/rails/api/v1/crews_controller.rb', line 14 def show render json: @crew.as_json(include: [:agents, :tasks, :executions]) end |