1 Stream
Robin edited this page 2026-11-22 06:37:56 +01:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Answers shown all at once

The chatbot writes its answer word by word in the chat window, as the model writes it. Some servers keep the answer until it is complete before passing it on: the visitor then waits for several seconds in front of Writing…, and sees the whole answer at once. Nothing is lost, but the wait feels long.

Find out

Chatbot › Server › Display of the answer as it is written › Test the display.

The test sends a test answer through your site (no model is called, nothing is paid) and measures when each part reaches your browser. It then says one of three things:

  • Your server lets the answers through as they are written. Nothing to do.
  • Your server holds the answers: workaround on. The test found a setting that works and saved it (see below).
  • Your server holds the answers, even with the workaround. Give the rules shown by the test to your host (below).

The workaround

Many servers pass the answer on once they hold enough of it. With My server holds the answers: work around it, the chatbot adds invisible filler after each part of the answer, so that each part goes at once.

  • Size of the filler: the test finds the smallest size that works; the smaller, the lighter for the visitor.
  • Send the text every (milliseconds): with the workaround, the text leaves in groups at this interval, each with its filler, and the window writes it at a steady pace in between.

Compression

Compression makes the answer much lighter for the visitor, filler included: Left to the server, or done by PHP with gzip or brotli (when PHP has the extension). A mode is offered only once the test has shown that the answer is still displayed as it is written with it.

Rules for your host

When the server in front of PHP holds the answers even with the workaround, it needs to let the chatbot's address through without holding it.

nginx in front of the site (as a proxy):

location ^~ /wp-json/lrob-chatbot/v1/chat/ {
    proxy_buffering off;
    proxy_cache off;
    proxy_http_version 1.1;
    proxy_hide_header upgrade;
    # then the same proxy_pass and proxy_set_header lines as the site's "location /"
}

Apache, when its compression holds the answer:

SetEnvIfNoCase Request_URI "/wp-json/lrob-chatbot/v1/chat/" no-gzip=1 no-brotli=1

A CDN or a firewall in front of the site can hold answers too: look in its settings for "buffering" or "streaming" for the address /wp-json/lrob-chatbot/v1/chat/.

Where the delay comes from

Reception from Anthropic › Test sends a tiny question to the model (a fraction of a cent) and shows whether its text reaches your server as it is written. If it does not, the delay comes before your server (the network between your server and Anthropic), not from it.

From the command line, wp lrob-chatbot stream-test gives a key valid for 15 minutes and the commands that measure, from any machine, when each part of a test answer arrives. Options: --pad=<bytes>, --hold, --compression=<off|server|gzip|brotli> to try a setting before saving it.