Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Responses Streaming SSE Keepalive

オープン
#11,076 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
go
領域
api, backend

調査の方向性

まず、POST /v1/responses のフォアグラウンドストリーミング用 handler と、既存の SSE writer を見つけます。リクエストのバリデーション、最初のイベントの前の待機、リクエストのキャンセル、通常のストリーム書き込みを追跡します。作業完了の条件は、オプトイン可能な sse_keepalive インターバルが、最初のイベント、キャンセル、または書き込み失敗までシリアライズされたコメントを送信し、これらのケースをテストでカバーすることです。

索引モデルが issue の本文から書いたものです。

説明

enhancement

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.

主要言語
Go
スター
49.2k
フォーク
4.5k
平均マージ
1日 7時間
マージ済み PR(30日)
357

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mudler/LocalAI のほかの issue

mudler/LocalAI の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。