"Ask AI" button breaks UI when using streamed output in AI Explorers
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3521390. --> Reported by: [sarvjeetsingh](https://www.drupal.org/user/3637489) Related to !666 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>When using the AI Explorers feature with the "streamed" option enabled, clicking the "Ask AI" button causes the entire UI to break.<br> The response returned inside the response wrapper is the entire DOM of the page again, instead of just the expected AI-generated response.<br> This overwrites the original page content and causes layout and functionality issues.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>Steps to reproduce:</p> <p>Enable a provider module, e.g., ai_provider_deepseek.</p> <p>Set up and configure the API key for the provider.</p> <p>Go to /admin/config/ai/explorers.</p> <p>Select the "Streamed" option under Advanced settings.</p> <p>Fill in the required fields.</p> <p>Click the "Ask AI" button.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Ensure that the streamed response is processed correctly and only the intended content is injected.</p> <p>Validate the response format and handle streaming differently than full responses.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3 id="summary-ui-changes">User interface changes</h3> <h3 id="summary-api-changes">API changes</h3> <h3 id="summary-data-model-changes">Data model changes</h3> <p><img src="https://www.drupal.org/files/issues/2025-04-27/Chat-Generation-Explorer-UI-issue.png" width="300" height="300" alt="chat generator ui break"></p>
issue