Skip to content

Conversation

@liyonghua0910
Copy link
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
Copy link

paddle-bot bot commented Aug 21, 2025

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