Integrate ChatProcessor plugin system into AI Chatbot DeepChat block
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3585077. --> Reported by: [ahmad khader](https://www.drupal.org/user/3727855) Related to !1497 >>> <p>[Tracker]<br> <strong>Update Summary: </strong>[One-line status update for stakeholders]<br> <strong>Short Description: </strong>[One-line issue summary for stakeholders]<br> <strong>Check-in Date: </strong>MM/DD/YYYY<br> <em>Metadata is used by the <a href="https://www.drupalstarforge.ai/" title="AI Tracker">AI Tracker.</a> Docs and additional fields <a href="https://www.drupalstarforge.ai/ai-dashboard/docs" title="AI Issue Tracker Documentation">here</a>.</em><br> [/Tracker]</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Integrate the ChatProcessor plugin system (added in <a href="https://www.drupal.org/project/ai/issues/3492940">#3492940</a>) into the AI Chatbot module's DeepChat block. This allows site builders to select which ChatProcessor plugin handles chat interactions, decoupling the chatbot UI from processing logic.</p> <p>The ChatProcessor plugin infrastructure was added to AI core in #3492940 (targeting 1.4.x), but the chatbot UI integration was deferred to 1.5.x per <a href="https://www.drupal.org/project/ai/issues/3492940#comment-15738317">comment #47</a>. Currently, the DeepChat block is hardcoded to use the AI Assistant API. With ChatProcessor plugins available, the block should allow selecting any registered processor.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Apply the chatbot integration code that was developed in the #3492940 branch but excluded from the 1.4.x merge. This includes:</p> <h4>1. DeepChatFormBlock changes</h4> <ul> <li>Add a <strong>ChatProcessor plugin selector</strong> dropdown to the block configuration form, allowing site builders to choose which processor handles chat.</li> <li>Pass the selected processor configuration to the DeepChat API controller.</li> <li>Add config schema for the new block settings.</li> </ul> <h4>2. DeepChatApi controller changes</h4> <ul> <li>Refactor the controller to use the selected <code>ChatProcessorInterface</code> plugin instead of directly calling AI Assistant API.</li> <li>Set <code>ChatInput</code>, call <code>execute()</code>, return <code>ChatOutput</code>.</li> </ul> <h4>3. Config schemas</h4> <ul> <li><code>ai_chatbot.settings.schema.yml</code> &mdash; general chatbot settings.</li> <li><code>ai_chatbot.styling.schema.yml</code> &mdash; styling configuration.</li> <li><code>block.settings.ai_chatbot_block.schema.yml</code> &mdash; block settings including processor selection.</li> <li>Updated <code>block.settings.ai_deepchat_block.schema.yml</code>.</li> </ul> <h4>4. Documentation</h4> <ul> <li>Add <code>docs/modules/ai_chatbot/index.md</code> documenting the chatbot module and its ChatProcessor integration.</li> <li>Update <code>mkdocs.yml</code> navigation to include the chatbot module docs.</li> <li>Update <code>README.md</code>.</li> </ul> <h4>5. ChatFormBlock (deprecated)</h4> <ul> <li>The old <code>ChatFormBlock</code> was part of the branch &mdash; evaluate whether to include it for backward compatibility or remove per <a href="https://www.drupal.org/project/ai/issues/3530307">#3530307</a>.</li> </ul> <h3>Existing code</h3> <p>The implementation already exists in the <code>3492940-add-chatconsumer</code> branch (commit history before <code>f35dd91a</code>). The relevant files were reverted in that commit and need to be re-applied as a separate MR targeting 1.5.x.</p> <h3>Files involved</h3> <ul> <li><code>modules/ai_chatbot/src/Plugin/Block/DeepChatFormBlock.php</code></li> <li><code>modules/ai_chatbot/src/Plugin/Block/ChatFormBlock.php</code></li> <li><code>modules/ai_chatbot/src/Controller/DeepChatApi.php</code></li> <li><code>modules/ai_chatbot/config/schema/ai_chatbot.settings.schema.yml</code></li> <li><code>modules/ai_chatbot/config/schema/ai_chatbot.styling.schema.yml</code></li> <li><code>modules/ai_chatbot/config/schema/block.settings.ai_chatbot_block.schema.yml</code></li> <li><code>modules/ai_chatbot/config/schema/block.settings.ai_deepchat_block.schema.yml</code></li> <li><code>modules/ai_chatbot/README.md</code></li> <li><code>modules/ai_chatbot/css/sticky-chatbot.css</code></li> <li><code>modules/ai_chatbot/js/deepchat-init.js</code></li> <li><code>modules/ai_chatbot/js/sticky-chatbot.js</code></li> <li><code>docs/modules/ai_chatbot/index.md</code></li> <li><code>mkdocs.yml</code></li> </ul> <h3>Related issues</h3> <ul> <li>Parent: <a href="https://www.drupal.org/project/ai/issues/3492940">#3492940: Add ChatProcessor</a></li> <li><a href="https://www.drupal.org/project/ai/issues/3530307">#3530307: Remove AI Chatbot</a> (old chatbot deprecation)</li> </ul> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3>Optional: Other details as applicable (e.g., User interface changes, API changes, Data model changes)</h3> <h3 id="summary-ai-usage">AI usage (if applicable)</h3> <p>[x] AI Assisted Issue<br> This issue was generated with AI assistance, but was reviewed and refined by the creator.</p> <p>[ ] AI Assisted Code<br> This code was mainly generated by a human, with AI autocompleting or parts AI generated, but under full human supervision.</p> <p>[ ] AI Generated Code<br> This code was mainly generated by an AI with human guidance, and reviewed, tested, and refined by a human.</p> <p>[ ] Vibe Coded<br> This code was generated by an AI and has only been functionally tested.</p> > Related issue: [Issue #3585075](https://www.drupal.org/node/3585075) > Related issue: [Issue #3492940](https://www.drupal.org/node/3492940)
issue