Class: TrixGeniusController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- TrixGeniusController
- Defined in:
- lib/generators/trix_genius/install/templates/trix_genius_controller.rb
Instance Method Summary collapse
Instance Method Details
#calculate_expression ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/generators/trix_genius/install/templates/trix_genius_controller.rb', line 6 def calculate_expression text = params.require(:text) calculus = call_ai_calculate_expression(text) render json: { calculus: calculus } rescue StandardError => e Rails.logger.error("Calculate Expression Error: #{e.message}") render json: { error: "An error occurred while CalculatingExpression." }, status: :unprocessable_entity end |
#correct_spelling ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/generators/trix_genius/install/templates/trix_genius_controller.rb', line 15 def correct_spelling text = params.require(:text) corrected_text = call_ai_check_spell(text) render json: { corrected_text: corrected_text } rescue StandardError => e Rails.logger.error("Orthography Correction Error: #{e.message}") render json: { error: "An error occurred while correcting orthography." }, status: :unprocessable_entity end |