[passthrough] engine: zstd request-body decompression + header overrides (#29684)
This commit is contained in:
@@ -104,6 +104,7 @@ from sglang.srt.entrypoints.openai.serving_tokenize import (
|
||||
from sglang.srt.entrypoints.openai.serving_transcription import (
|
||||
OpenAIServingTranscription,
|
||||
)
|
||||
from sglang.srt.entrypoints.request_headers import apply_header_overrides
|
||||
from sglang.srt.entrypoints.warmup import execute_warmups
|
||||
from sglang.srt.environ import envs
|
||||
from sglang.srt.function_call.function_call_parser import FunctionCallParser
|
||||
@@ -403,6 +404,13 @@ app.add_middleware(
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
if envs.SGLANG_ENABLE_REQUEST_DECOMPRESSION.get():
|
||||
from sglang.srt.entrypoints.http_request_decompression import (
|
||||
RequestDecompressionMiddleware,
|
||||
)
|
||||
|
||||
app.add_middleware(RequestDecompressionMiddleware)
|
||||
|
||||
# Include routers
|
||||
from sglang.srt.entrypoints.v1_loads import router as v1_loads_router
|
||||
|
||||
@@ -781,6 +789,8 @@ if os.environ.get("DUMPER_SERVER_PORT") == "reuse":
|
||||
)
|
||||
async def generate_request(obj: GenerateReqInput, request: Request):
|
||||
"""Handle a generate request."""
|
||||
if envs.SGLANG_ENABLE_REQUEST_HEADER_OVERRIDES.get():
|
||||
apply_header_overrides(obj, request.headers)
|
||||
if obj.stream:
|
||||
|
||||
async def stream_results() -> AsyncIterator[bytes]:
|
||||
|
||||
Reference in New Issue
Block a user