Skip to content

[fix] setting disable_chat_template while passing prompt_token_ids led to response error - #3511

Merged
Jiang-Jia-Jun merged 5 commits into
PaddlePaddle:release/2.1from
liyonghua0910:release/2.1_fix-disable-chat-template
Aug 21, 2025
Merged

Jiang-Jia-Jun merged 5 commits into
PaddlePaddle:release/2.1from
liyonghua0910:release/2.1_fix-disable-chat-template

Conversation

@liyonghua0910

Copy link
Copy Markdown
Collaborator

问题描述
修复在传入 prompt_token_ids 且 messages 设为空列表时,设置 disable_chat_template 为 true 将导致 400 Bad Request 的问题

原因排查
当设置 disable_chat_template 为 true 时,会取出 messages 的第一条消息作为 prompt;但在传入 prompt_token_ids 时,messages 可能是空列表,导致列表索引越界。

解决方法
将 disable_chat_template 取首条 messages 的逻辑移到 prompt_token_ids 为空的分支,避免冲突

@paddle-bot

paddle-bot Bot commented Aug 21, 2025

Copy link
Copy Markdown

Thanks for your contribution!

@paddle-bot paddle-bot Bot added the contributor External developers label Aug 21, 2025
@Jiang-Jia-Jun
Jiang-Jia-Jun merged commit 1b399b9 into PaddlePaddle:release/2.1 Aug 21, 2025
15 of 18 checks passed
@liyonghua0910
liyonghua0910 deleted the release/2.1_fix-disable-chat-template branch September 17, 2025 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants