refactor(open-sse): DRY SSE primitives into utils/sseConstants.js
Gom SSE_DONE + SSE_HEADERS + SSE_HEADERS_NO_BUFFER vào 1 file không phụ thuộc (tránh kéo usageDb vào executor). Áp cho kiro, cursor, qoder, github, commandcode, perplexity-web, grok-web. Byte-for-byte verified (headers/DONE giữ nguyên; biến thể no-buffer dùng const riêng). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
15
open-sse/utils/sseConstants.js
Normal file
15
open-sse/utils/sseConstants.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// Shared SSE primitives (no imports → safe for executors + stream.js)
|
||||
export const SSE_DONE = "data: [DONE]\n\n";
|
||||
|
||||
export const SSE_HEADERS = {
|
||||
"Content-Type": "text/event-stream",
|
||||
"Cache-Control": "no-cache",
|
||||
"Connection": "keep-alive"
|
||||
};
|
||||
|
||||
// Variant for web-cookie executors behind nginx (disable proxy buffering)
|
||||
export const SSE_HEADERS_NO_BUFFER = {
|
||||
"Content-Type": "text/event-stream",
|
||||
"Cache-Control": "no-cache",
|
||||
"X-Accel-Buffering": "no"
|
||||
};
|
||||
Reference in New Issue
Block a user