fix: audio streaming
This commit is contained in:
@@ -16,6 +16,14 @@ from .slot_tracker import SlotTracker
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
_STREAM_CHUNK = 8192
|
||||
_STREAMING_CONTENT_TYPES = (
|
||||
"text/event-stream",
|
||||
"audio/mpeg",
|
||||
"audio/ogg",
|
||||
"audio/wav",
|
||||
"audio/webm",
|
||||
"audio/aac",
|
||||
)
|
||||
_HOP_BY_HOP = frozenset(
|
||||
[
|
||||
"connection",
|
||||
@@ -74,7 +82,7 @@ async def forward_request(
|
||||
resp = await resp_ctx.__aenter__()
|
||||
|
||||
content_type = resp.headers.get("Content-Type", "")
|
||||
is_streaming = "text/event-stream" in content_type
|
||||
is_streaming = any(ct in content_type for ct in _STREAMING_CONTENT_TYPES)
|
||||
|
||||
response_headers = {
|
||||
k: v
|
||||
|
||||
Reference in New Issue
Block a user