Alter PreGenerateResponseEvent response
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3506391. -->
Reported by: [g.rocchini](https://www.drupal.org/user/2815423)
Related to !464
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Hi all,<br>
it would be interesting to have the possibility to modify the flow of the chat managed by AI Assistant to interrupt the standard response flow.</p>
<p>Talking with marcus_johansson on Slack I gave the example of allowing the user to ask only n questions to the chatbot, and then start returning a fixed answer with a link to a page.<br>
Or, after n unanswered questions (which we can probably verify via postResponse EventSubscriber) always return a message like "we suggest you contact us via the Contacts page".</p>
<p>Marcus proposed to add that as a possibility to the PreGenerateResponseEvent for it to work</p>
<p>I think it's an interesting implementation and that it could be useful to others too</p>
<h3 id="summary-api-changes">API changes</h3>
<p>Alter the PreGenerateResponseEvent to support the modify of the stream</p>
issue