Real-time Feedback in Chatbot: showing streaming answer instead of full answer at once.
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3479605. -->
Reported by: [dan_metille](https://www.drupal.org/user/574844)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>In the AI Assistant chatbot, I was aiming to display streaming responses as they are generated, instead of presenting the entire answer at once.</p>
<p>During a Slack discussion, it was highlighted that streaming answers is already supported as long as the web server configuration allows it. However, most web servers are set to buffer responses for performance reasons, which prevents real-time output.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Solution:</p>
<p>For <strong>nginx</strong> with php-fpm, ensure that the following setting is configured to disable buffering:</p>
<p><code>fastcgi_buffering off;</code></p>
<p>For <strong>Apache</strong> with php-fpm, you might need to adjust the following:</p>
<p><code>ProxySet enablereuse=on flushpackets=on;</code></p>
<p>Here’s my current .ddev/nginx-site.conf setup for reference (do not forget to delete the line <code>#ddev-generated</code> at the top of the file):</p>
<pre>server {<br> listen 80 default_server;<br> listen 443 ssl default_server;<br><br> root /var/www/html/web;<br><br> ssl_certificate /etc/ssl/certs/master.crt;<br> ssl_certificate_key /etc/ssl/certs/master.key;<br><br> include /etc/nginx/monitoring.conf;<br><br> index index.php index.htm index.html;<br><br> # Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html<br> sendfile off;<br> error_log /dev/stdout info;<br> access_log /var/log/nginx/access.log;<br> <strong>fastcgi_buffering off; # Disable FastCGI buffering</strong><br><br> # Other configurations...<br>}</pre><h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>See if the attached README file can be helpful.</p>
<p>Thanks to Marcus Johansson and the Drupal Slack community for sharing these insights.</p>
issue