Files
ST-Bionic-Memory-Ecology/llm
Youzini-afk 0749ef29c5 fix(extraction): add SSE stream idle timeout and vector sync timeout to prevent extraction hang
Root cause analysis: extraction can appear stuck at '正在提取xx-xx楼层' indefinitely
when the LLM API connection goes half-open (server stops sending data but keeps the
TCP connection alive). The SSE stream reader.read() would block forever with no
per-chunk idle timeout.

Changes:
1. llm/llm.js: Add LLM_STREAM_IDLE_TIMEOUT_MS (90s default) to
   parseDedicatedStreamingResponse. When no SSE data is received for 90 seconds,
   the read loop aborts with a clear timeout error instead of hanging forever.
   The idle timeout is configurable per-request (defaults to 30% of config timeout,
   minimum 30s).

2. index.js: Add EXTRACTION_VECTOR_SYNC_TIMEOUT_MS (120s) timeout wrapper around
   syncVectorState in handleExtractionSuccess. Vector sync now uses a combined
   AbortSignal (extraction signal + timeout) so that either user abort or 120s
   timeout will break out. Vector sync timeout is treated as non-fatal (doesn't
   abort the entire extraction batch).
2026-04-29 02:43:05 +08:00
..