{# sendChatDelta() for digital-twin pages — the JS half of _twin_chat_panel.html. This function was duplicated verbatim across four twin.html templates. The copies differed on exactly ONE line: the fetch URL. Everything else — the spinner handling, the _loadedGraphJson passthrough, the error and explanation rendering — was identical. Context: chat_api_prefix REQUIRED canvas route prefix, no slashes, e.g. "data" chat_id_var JS global holding the twin id; default "DESIGN_ID" (boundary_canvas uses PROJECT_ID) The id is read into a local first so the fetch stays a plain JS template literal: `${_twinId}` passes through Jinja untouched, whereas interpolating the variable name directly inside ${...} collides with Jinja's own {{ }}. Depends on the ids in _twin_chat_panel.html and on a `deltaInput` textarea in the host template. `_loadedGraphJson` is optional — canvases that do not implement "Load from Canvas" simply leave it undefined. Usage: {% with chat_api_prefix="data" %} {% include "includes/_twin_chat_script.html" %} {% endwith %} #}