Class: LatoCms::TranslateComponentFieldsJob
- Inherits:
-
Lato::ApplicationJob
- Object
- Lato::ApplicationJob
- LatoCms::TranslateComponentFieldsJob
- Defined in:
- app/jobs/lato_cms/translate_component_fields_job.rb
Overview
Translates a just-cloned component's free-text fields via the configured LLM, as a Lato::Operation so a slow/unreachable LLM never blocks the clone request (see PagesController#clone_component_action). The verbatim clone this follows has already happened synchronously and is not undone if this fails.
Instance Method Summary collapse
Instance Method Details
#perform(params = {}) ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/jobs/lato_cms/translate_component_fields_job.rb', line 8 def perform(params = {}) params = params.with_indifferent_access page = LatoCms::Page.find(params[:page_id]) page.translate_component_fields!(params[:template_component_id]) (I18n.t('lato_cms.component_clone_translated')) if operation? end |