Add chat-ui-htmx module: streaming chat page on Spring AI 2.0.2 with htmx and its SSE extension (vendored), MessageChatMemoryAdvisor keyed by the HTTP session, a Stop button, and the traps measured: EventSource strips one leading space per data line, model text must be HTML-escaped, a cancelled stream left the upstream connection open in 7 of 8 runs until an OkHttp interceptor calls Call.cancel (8 of 8 closed after), and the SDK push source ignores back-pressure (limitRate changes only the demand; a bounded buffer works). The model is a stub OpenAI-compatible SSE server written for the module; no real provider was run.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6Kg9RWSTJzyz6KP9X
This commit is contained in:
2026-10-31 04:02:56 +00:00
co-authored by Claude Sonnet 5.5
parent c97bcf9adf
commit 68da642f9a
35 changed files with 1571 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env python3
"""A deliberately slow SSE reader on a raw socket: recv() up to CHUNK bytes every INTERVAL seconds
(default 64 KiB / 0.2 s, about 320 KB/s at most) and keep the running byte count in a file so another
process can sample it. Usage: slow_client.py URL COUNTER_FILE [CHUNK] [INTERVAL] [SECONDS]"""
import socket, sys, time, urllib.parse
url, counter = sys.argv[1], sys.argv[2]
chunk = int(sys.argv[3]) if len(sys.argv) > 3 else 64 * 1024
interval = float(sys.argv[4]) if len(sys.argv) > 4 else 0.2
limit = float(sys.argv[5]) if len(sys.argv) > 5 else 14.0
u = urllib.parse.urlparse(url)
s = socket.create_connection((u.hostname, u.port))
s.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 64 * 1024)
s.sendall(f"GET {u.path}?{u.query} HTTP/1.1\r\nHost: {u.hostname}\r\nAccept: text/event-stream\r\n\r\n".encode())
total, t0 = 0, time.time()
while time.time() - t0 < limit:
data = s.recv(chunk)
if not data:
break
total += len(data)
open(counter, "w").write(str(total))
time.sleep(interval)
s.close()