[Bugfix][Frontend] Preserve duplex chat audio format and duration (#7316)
Signed-off-by: Nolen Liang <nliang@nvidia.com>
This commit is contained in:
1 parent
1b6cd282f0
commit
e0c4f97f32
13 files changed
+684
-40
No files matched your search
@@ -34,7 +34,11 @@ from vllm_omni.entrypoints.openai.diffusion_request_utils import (
|
||||
apply_normalized_diffusion_request_extra_args,
|
||||
normalize_diffusion_request_args,
|
||||
)
|
||||
from vllm_omni.entrypoints.openai.protocol.chat_completion import OmniChatCompletionResponse
|
||||
from vllm_omni.entrypoints.openai.protocol.chat_completion import (
|
||||
OmniChatCompletionResponse,
|
||||
OmniChatCompletionResponseChoice,
|
||||
OmniChatCompletionResponseStreamChoice,
|
||||
)
|
||||
from vllm_omni.entrypoints.utils import coerce_param_message_types
|
||||
from vllm_omni.inputs.data import OmniDiffusionSamplingParams, OmniTextPrompt
|
||||
from vllm_omni.metrics import definitions as _metric_defs
|
||||
@@ -2860,18 +2864,20 @@ class OmniOpenAIServingChat(OpenAIServingChat, AudioMixin):
|
||||
|
||||
for output in final_res.outputs:
|
||||
if stream:
|
||||
choice_data = ChatCompletionResponseStreamChoice(
|
||||
choice_data = OmniChatCompletionResponseStreamChoice(
|
||||
index=output.index,
|
||||
delta=DeltaMessage(role=role, content=audio_base64),
|
||||
audio_metadata=audio_response.audio_metadata,
|
||||
logprobs=None,
|
||||
finish_reason=output.finish_reason,
|
||||
stop_reason=output.stop_reason,
|
||||
token_ids=(as_list(output.token_ids) if request.return_token_ids else None),
|
||||
)
|
||||
else:
|
||||
choice_data = ChatCompletionResponseChoice(
|
||||
choice_data = OmniChatCompletionResponseChoice(
|
||||
index=output.index,
|
||||
message=ChatMessage(role=role, audio=audio_obj),
|
||||
audio_metadata=audio_response.audio_metadata,
|
||||
logprobs=None,
|
||||
finish_reason="stop",
|
||||
stop_reason=output.stop_reason,
|
||||
|
||||
Reference in new issue
Block a user