[Bugfix][Frontend] Support Responses text types in DeepSeek V4.1 (#56299)
Signed-off-by: CedricHuang <38417461+CedricHwong@users.noreply.github.com> Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
co-authored by
OpenAI Codex
parent
dfa1984e58
commit
eb42686a30
@@ -99,6 +99,24 @@ def test_raw_text_parts_preserve_reference_separator():
|
|||||||
assert messages == original
|
assert messages == original
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
("role", "responses_type"),
|
||||||
|
[("user", "input_text"), ("assistant", "output_text")],
|
||||||
|
)
|
||||||
|
def test_responses_text_parts_match_chat_text_parts(role, responses_type):
|
||||||
|
responses_message = {
|
||||||
|
"role": role,
|
||||||
|
"content": [{"type": responses_type, "text": "hello"}],
|
||||||
|
}
|
||||||
|
chat_message = {
|
||||||
|
"role": role,
|
||||||
|
"content": [{"type": "text", "text": "hello"}],
|
||||||
|
}
|
||||||
|
assert render([responses_message], thinking=False) == render(
|
||||||
|
[chat_message], thinking=False
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_mid_system_gets_its_own_marker_and_generation_header():
|
def test_mid_system_gets_its_own_marker_and_generation_header():
|
||||||
assert render(
|
assert render(
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ def _normalize_messages(
|
|||||||
parts = []
|
parts = []
|
||||||
for block in content:
|
for block in content:
|
||||||
part_type = block.get("type")
|
part_type = block.get("type")
|
||||||
if part_type == "text":
|
if part_type in ("text", "input_text", "output_text"):
|
||||||
parts.append(block.get("text", ""))
|
parts.append(block.get("text", ""))
|
||||||
elif part_type in ("image_url", "input_image", "image_pil"):
|
elif part_type in ("image_url", "input_image", "image_pil"):
|
||||||
parts.append(IMAGE_PLACEHOLDER)
|
parts.append(IMAGE_PLACEHOLDER)
|
||||||
|
|||||||
Reference in New Issue
Block a user