Class: CompletionKit::ImportsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/completion_kit/imports_controller.rb

Constant Summary

Constants inherited from ApplicationController

ApplicationController::ONBOARDING_DISMISS_COOKIE

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/completion_kit/imports_controller.rb', line 6

def create
  content = uploaded_content

  if content.blank?
    flash.now[:alert] = "Paste or upload a promptfooconfig.yaml to import."
    return render :new, status: :unprocessable_entity
  end

  @result = PromptfooImporter.call(content)

  if @result.ok
    render :create
  else
    flash.now[:alert] = @result.error
    render :new, status: :unprocessable_entity
  end
end

#newObject



3
4
# File 'app/controllers/completion_kit/imports_controller.rb', line 3

def new
end