Responses Streaming SSE Keepalive
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Inizia individuando l’handler di POST /v1/responses per lo streaming in primo piano e il relativo writer SSE esistente. Traccia la validazione della request, l’attesa prima del primo evento, la cancellazione della request e le normali scritture nello stream; il lavoro è completo quando un intervallo sse_keepalive attivabile opzionalmente invia commenti serializzati fino al primo evento, alla cancellazione o a un errore di scrittura, con test che coprano questi casi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
With POST /v1/responses using foreground streaming, queueing and prompt prefill can take a very long time before LocalAI sends response headers or SSE data. Reverse proxies may time out during this silent period.
Foreground streaming is otherwise desirable because disconnecting the client cancels the LocalAI request. Using background: true avoids the timeout, but can leave stale jobs running when a client disconnects or restarts.
Describe the solution you'd like
Add optional SSE keepalive comments for foreground streaming Responses requests, for example:
POST /v1/responses?sse_keepalive=15s
LocalAI would flush an initial SSE comment after synchronous request validation, then periodically send comments while waiting for the first real event:
: keepalive
These should probably remain transport-level comments, not synthetic Responses events. The inference request should remain attached to the HTTP request context so disconnects continue to cancel it.
Describe alternatives you've considered
- Increasing reverse-proxy timeouts to an hour or more, but this can get ridiculous, complicate reverse proxy config, and won't necessarily work across all network scenarios.
- Using background Responses and explicitly canceling them, but this can leave a mess if clients are stateless and have no way to know a response needs to be canceled after a restart.
- Adding a separate proxy that sends heartbeats while holding the foreground LocalAI request open, but it adds significant complexity and risk, and at this point it's silly not to try to upstream the fix first.
Additional context
SSE comments are intended for connection keepalives and should be ignored by conforming clients. Making the feature opt-in would avoid compatibility problems with clients that parse SSE imperfectly.
The heartbeat writer should be serialized with normal stream writes, stop on cancellation or write failure, and preferably stop once the first real event is emitted.
- Lingua principale
- Go
- Stelle
- 49.2k
- Fork
- 4.5k
- Merge medio
- 19h 42m
- PR unite (30g)
- 299
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di mudler/LocalAI
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
mudler/LocalAI#12264 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
bug unconfirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
mudler/LocalAI#11995 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mudler/LocalAI#11991 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
mudler/LocalAI#11973 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di mudler/LocalAI
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
[开源推荐] FCaptcha:可自行部署的开源验证码Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
521xueweihan/HelloGitHub#3789 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 12 giorni
-
stage-fail
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
siyuan-note/bazaar#2282 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openshift/kube-compare#307 ·
I maintainer di solito rispondono entro 1 giorno