Responses Streaming SSE Keepalive
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Bắt đầu bằng cách xác định handler streaming foreground của POST /v1/responses và SSE writer hiện có của nó. Theo dõi việc xác thực request, thời gian chờ trước event đầu tiên, việc hủy request và các thao tác ghi stream thông thường; công việc được hoàn tất khi một khoảng thời gian sse_keepalive tùy chọn gửi các comment đã được serialize cho đến event đầu tiên, khi hủy hoặc khi ghi thất bại, với các test bao quát những trường hợp đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Go
- Star
- 49.2k
- Fork
- 4.5k
- Merge trung bình
- 19 giờ 42 phút
- Pull request đã merge (30 ngày)
- 299
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của mudler/LocalAI
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
mudler/LocalAI#12264 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug unconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
mudler/LocalAI#11995 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mudler/LocalAI#11991 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
mudler/LocalAI#11973 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của mudler/LocalAI
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
siderolabs/terraform-provider-talos#414 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
JuliaComputing/jh#63 · 1 bình luận ·
-
area/proxy kind/bug priority/backlog triage/accepted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
lexfrei/cloudflare-tunnel-gateway-controller#840 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Priority: Normal Type: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
cloudflare/cloudflared#1747 ·