| name | wsh-crok-optimization |
| description | Removing artificial delays in Crok AI chat SSE endpoint for WSH 2026 user flow scoring. |
WSH: Crok AI Optimization
The Crok AI endpoint has intentional artificial delays — 3000ms TTFT and 10ms per character. This directly impacts the "Crok AI チャット" user flow score (50 pts).
Use this skill when optimizing the Crok AI SSE endpoint.
Technique
await sleep(3000);
for (const char of response) {
res.write(`event: message\n...`);
await sleep(10);
}
for (const char of response) {
res.write(`event: message\ndata: ${JSON.stringify({ content: char })}\n\n`);
}
Or even better — send the entire response at once:
res.write(`event: message\ndata: ${JSON.stringify({ content: response })}\n\n`);
res.write("event: done\ndata: {}\n\n");
Impact: User flow score for Crok AI chat: +30-50 pts (INP, TBT)
VRT Risks
| Change | Visual Impact | Mitigation |
|---|
| Faster response | Chat messages appear instantly | No visual diff in screenshots |
Project-Specific Notes
- Endpoint at
application/server/src/routes/api/crok.ts
- SSE format:
event: message, event: done
- Client listens via EventSource in CrokContainer
- The sleep utility is imported — just remove the calls