From 68aebf00e931d7e1a69b3072b969ec49f8d6105d Mon Sep 17 00:00:00 2001 From: Roland Obermair Date: Wed, 28 Jan 2026 10:06:00 +0100 Subject: [PATCH 1/2] New menu tab --- ...i_content_preparation_wizard.links.task.yml | 7 +++++++ .../js/async-plan.js | 18 +++++++++++------- .../src/Form/ContentPreparationWizardForm.php | 11 +++++++++++ 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/web/modules/custom/ai_content_preparation_wizard/ai_content_preparation_wizard.links.task.yml b/web/modules/custom/ai_content_preparation_wizard/ai_content_preparation_wizard.links.task.yml index 5b42619..ad5abd4 100644 --- a/web/modules/custom/ai_content_preparation_wizard/ai_content_preparation_wizard.links.task.yml +++ b/web/modules/custom/ai_content_preparation_wizard/ai_content_preparation_wizard.links.task.yml @@ -2,3 +2,10 @@ ai_content_preparation_wizard.settings: title: 'Settings' route_name: ai_content_preparation_wizard.settings base_route: ai_content_preparation_wizard.settings + +# Tab on /admin/content page. +ai_content_preparation_wizard.content_tab: + title: 'Content Preparation Wizard' + route_name: ai_content_preparation_wizard.wizard + base_route: system.admin_content + weight: 10 diff --git a/web/modules/custom/ai_content_preparation_wizard/js/async-plan.js b/web/modules/custom/ai_content_preparation_wizard/js/async-plan.js index 17a2671..9d16b1a 100644 --- a/web/modules/custom/ai_content_preparation_wizard/js/async-plan.js +++ b/web/modules/custom/ai_content_preparation_wizard/js/async-plan.js @@ -164,13 +164,17 @@ }.bind(this)); } - // Enable refinement controls. - var refinementSection = document.getElementById('refinement-section'); - if (refinementSection) { - var textarea = refinementSection.querySelector('textarea'); - var button = refinementSection.querySelector('input[type="submit"]'); - if (textarea) textarea.disabled = false; - if (button) button.disabled = false; + // Enable refinement controls using explicit IDs. + var refinementTextarea = document.getElementById('edit-refinement-textarea'); + var regenerateButton = document.getElementById('edit-regenerate-plan'); + if (refinementTextarea) { + refinementTextarea.disabled = false; + refinementTextarea.removeAttribute('disabled'); + } + if (regenerateButton) { + regenerateButton.disabled = false; + regenerateButton.removeAttribute('disabled'); + regenerateButton.classList.remove('is-disabled'); } // Show and enable navigation buttons. diff --git a/web/modules/custom/ai_content_preparation_wizard/src/Form/ContentPreparationWizardForm.php b/web/modules/custom/ai_content_preparation_wizard/src/Form/ContentPreparationWizardForm.php index ebd9ac5..bd67028 100644 --- a/web/modules/custom/ai_content_preparation_wizard/src/Form/ContentPreparationWizardForm.php +++ b/web/modules/custom/ai_content_preparation_wizard/src/Form/ContentPreparationWizardForm.php @@ -612,6 +612,9 @@ protected function buildStep2(array &$form, FormStateInterface $form_state): voi '#placeholder' => $this->t('Type instructions to adjust the plan...'), '#rows' => 3, '#disabled' => $needsAsyncGeneration, + '#attributes' => [ + 'id' => 'edit-refinement-textarea', + ], ]; $form['step2']['split_layout']['plan_panel']['refinement_section']['regenerate'] = [ @@ -629,6 +632,9 @@ protected function buildStep2(array &$form, FormStateInterface $form_state): voi ], '#limit_validation_errors' => [['refinement']], '#disabled' => $needsAsyncGeneration, + '#attributes' => [ + 'id' => 'edit-regenerate-plan', + ], ]; } else { @@ -1142,6 +1148,9 @@ public function submitStep2(array &$form, FormStateInterface $form_state): void * Submit handler to regenerate plan. */ public function regeneratePlan(array &$form, FormStateInterface $form_state): void { + // Always stay on step 2 when regenerating. + $form_state->set('step', 2); + $refinement = $form_state->getValue('refinement'); if (!$refinement || !$this->planGenerator) { $this->messenger()->addWarning($this->t('Please enter refinement instructions.')); @@ -1177,6 +1186,8 @@ public function regeneratePlan(array &$form, FormStateInterface $form_state): vo ])); } + // Ensure we stay on step 2 after regeneration. + $form_state->set('step', 2); $form_state->setRebuild(); } From 28880e45c7c61fd0c6caf3edc6ac2a696adb56f8 Mon Sep 17 00:00:00 2001 From: Florin-Gabriel Dumitru <81620182+FGDumitru@users.noreply.github.com> Date: Wed, 28 Jan 2026 10:21:46 +0100 Subject: [PATCH 2/2] Fixes the extensions type errors (array <-> strings list) --- .../ai_content_preparation_wizard.settings.yml | 14 ++++++++------ .../src/Form/ContentPreparationWizardForm.php | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/config/sync/ai_content_preparation_wizard.settings.yml b/config/sync/ai_content_preparation_wizard.settings.yml index 000ca3c..298c94e 100644 --- a/config/sync/ai_content_preparation_wizard.settings.yml +++ b/config/sync/ai_content_preparation_wizard.settings.yml @@ -2,13 +2,15 @@ _core: default_config_hash: CnMDjnwForHi_GT3i_XaQPEufjjthpNa6Wd_HO7_Wws pandoc_path: /usr/bin/pandoc max_file_size: 10485760 -allowed_extensions: - - txt - - md - - docx - - pdf -default_ai_provider: '' +allowed_extensions: 'txt,md,docx,pdf' +default_ai_provider: amazeeio default_ai_model: '' session_timeout: 3600 enable_refinement: true max_refinement_iterations: 5 +document_processors: "pdf|/usr/bin/pdftotext\r\ntxt,md,docx|/usr/bin/pandoc" +enable_logging: false +webpage_processor_mode: basic +webpage_processor_binary: '' +webpage_processor_arguments: '{url}' +webpage_processor_timeout: 30 diff --git a/web/modules/custom/ai_content_preparation_wizard/src/Form/ContentPreparationWizardForm.php b/web/modules/custom/ai_content_preparation_wizard/src/Form/ContentPreparationWizardForm.php index bd67028..41ce42d 100644 --- a/web/modules/custom/ai_content_preparation_wizard/src/Form/ContentPreparationWizardForm.php +++ b/web/modules/custom/ai_content_preparation_wizard/src/Form/ContentPreparationWizardForm.php @@ -210,15 +210,16 @@ protected function buildStep1(array &$form, FormStateInterface $form_state): voi '#attributes' => ['class' => ['wizard-step-content']], ]; + $extensions = str_replace(',',' ', $extensions); $form['step1']['documents'] = [ '#type' => 'managed_file', '#title' => $this->t('Upload Documents'), '#description' => $this->t('Drag and drop files here or click to browse. Supported formats: @formats', [ - '@formats' => implode(', ', $extensions), + '@formats' => str_replace(',', ' ', $extensions), ]), '#upload_location' => 'private://ai_content_preparation_wizard', '#upload_validators' => [ - 'FileExtension' => ['extensions' => implode(' ', $extensions)], + 'FileExtension' => ['extensions' => $extensions], 'FileSizeLimit' => ['fileLimit' => $maxSize], ], '#multiple' => TRUE,