[bugfix] /chat/completion doesn't read extra_body for diffusion model (#2042)
Signed-off-by: Huang, Zeyu <11222265+fhfuih@users.noreply.github.com> Signed-off-by: Samit <285365963@qq.com> Co-authored-by: Samit <285365963@qq.com>
This commit is contained in:
1 parent
a978c60163
commit
da21e991cc
2 files changed
+15
-3
No files matched your search
@@ -185,7 +185,7 @@ steps:
|
||||
- label: ":email: Nightly Collection & Email"
|
||||
key: nightly-perf-distribution
|
||||
depends_on:
|
||||
- nightly-performance
|
||||
- nightly-performance
|
||||
if: build.env("NIGHTLY") == "1"
|
||||
commands:
|
||||
- pip install openpyxl
|
||||
|
||||
@@ -297,7 +297,13 @@ class OmniOpenAIServingChat(OpenAIServingChat, AudioMixin):
|
||||
if not extracted_prompt:
|
||||
return self.create_error_response("No text prompt found in messages")
|
||||
|
||||
extra_body = getattr(request, "extra_body", None) or {}
|
||||
# [NOTE] When sending request via openai client Python library,
|
||||
# `extra_body` is flattented and merged into the payload's root.
|
||||
# These extra fields are accessible via `model_extra` property (from Pydantic base class).
|
||||
# When sending raw request with curl, no flattening happens. Directly read the `extra_body` dict.
|
||||
extra_body = getattr(request, "extra_body", None)
|
||||
if not extra_body:
|
||||
extra_body = request.model_extra or {}
|
||||
height = extra_body.get("height")
|
||||
width = extra_body.get("width")
|
||||
if "size" in extra_body:
|
||||
@@ -2036,7 +2042,13 @@ class OmniOpenAIServingChat(OpenAIServingChat, AudioMixin):
|
||||
|
||||
# Extract generation parameters from extra_body (preferred)
|
||||
# Reference: text_to_image.py and text_to_video.py for supported parameters
|
||||
extra_body = getattr(request, "extra_body", None) or {}
|
||||
# [NOTE] When sending request via openai client Python library,
|
||||
# `extra_body` is flattented and merged into the payload's root.
|
||||
# These extra fields are accessible via `model_extra` property (from Pydantic base class).
|
||||
# When sending raw request with curl, no flattening happens. Directly read the `extra_body` dict.
|
||||
extra_body = getattr(request, "extra_body", None)
|
||||
if not extra_body:
|
||||
extra_body = request.model_extra or {}
|
||||
|
||||
# Parse size if provided (supports "1024x1024" format)
|
||||
height = extra_body.get("height")
|
||||
|
||||
Reference in new issue
Block a user