mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-10-19 01:08:07 +00:00
* fix: prevent Ask streaming loading from getting stuck on dangling connections Adds a safety-net timeout (5 min) to useAsk that forces the loading state to end even when the SSE stream's 'done' signal doesn't reach the browser — which happens in Docker/standalone deployments where the Next.js proxy connection is left open without proper termination. Changes: - use-ask.ts: AbortController per request, mountedRef for cleanup, STREAM_TIMEOUT_MS that resets isStreaming, stopStreaming() helper that centralizes cleanup + clears the timeout - search.ts: pass AbortSignal through to fetch() so the timeout can actually cancel the HTTP request The complete event now also carries final_answer content as a backup path in case the final_answer event is missed. Co-Authored-By: Claude <noreply@anthropic.com> * chore: reduce stream timeout from 5 min to 75s * fix(ask): make stream watchdog idle-based and abort dangling connections The Ask stream safety timeout was a fixed 75s wall-clock cap measured from stream start and never reset by incoming SSE events. A legitimately slow but healthy Ask (slow local models — Ollama, LM Studio) would have its loading state killed mid-stream, showing a partial/empty answer while the backend was still producing — the exact slow-hardware scenario in #777. - Re-arm the timeout on every received chunk so it fires only when the connection goes genuinely silent (idle timeout, not wall-clock). - Align the idle window to the API client budget (NEXT_PUBLIC_API_TIMEOUT_MS, default 10 min; 0 disables) so slow local models aren't cut off. Export API_TIMEOUT_MS from the client for this. - On fire, abort the in-flight request so a truly dangling connection frees the socket/reader instead of leaking it (the catch already swallows AbortError). --------- Co-authored-by: dyzur <dyzur@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Luis Novo <lfnovo@gmail.com> |
||
|---|---|---|
| .. | ||
| public | ||
| src | ||
| test-results | ||
| .gitignore | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| components.json | ||
| eslint.config.mjs | ||
| next.config.ts | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.mjs | ||
| start-server.js | ||
| tsconfig.json | ||
| vitest.config.ts | ||