-
Notifications
You must be signed in to change notification settings - Fork 60.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: baidu error_code 336006 #5194
Conversation
@HyiKi is attempting to deploy a commit to the NextChat Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe recent changes enhance the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- app/client/platforms/baidu.ts (1 hunks)
Additional comments not posted (1)
app/client/platforms/baidu.ts (1)
80-81
: Ensure message roles adhere to Baidu's requirements.The conditional check that changes the role from "system" to "assistant" ensures compliance with Baidu's error code 336006. This change is crucial for preventing errors related to message roles with odd indices.
Your build has completed! |
change the summary role from system to user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- app/client/platforms/baidu.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- app/client/platforms/baidu.ts
fix "Messages 中 system 角色必须位于列表的最开始"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- app/client/platforms/tencent.ts (1 hunks)
Additional comments not posted (1)
app/client/platforms/tencent.ts (1)
94-96
: LGTM! Ensure the new role assignment logic is correct.The code changes are approved.
However, verify that the new logic for role assignment doesn't introduce any unexpected behavior.
Verification successful
The new role assignment logic is correct and does not introduce any issues.
The logic ensures that the "system" role is always the first message in the list, and subsequent "system" roles are changed to "user". This is consistent with the intended behavior.
- The
chat
method correctly assigns roles to messages based on their position in the list.- The logic does not introduce any unexpected behavior.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the new role assignment logic in the `chat` method. # Test: Search for the method implementation. Expect: Only the new logic for role assignment. ast-grep --lang typescript --pattern $'class HunyuanApi { $$$ async chat($_) { $$$ const messages = $_.map((v, index) => ({ role: index !== 0 && v.role === "system" ? "user" : v.role, content: $_ ? v.content : $_, })); $$$ } $$$ }'Length of output: 268
Script:
#!/bin/bash # Description: Verify the new role assignment logic in the `chat` method. # Search for the `chat` method in the `app/client/platforms/tencent.ts` file and include context lines. rg 'async chat' -A 10 app/client/platforms/tencent.tsLength of output: 537
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
fix baidu error code 336006
the role of message with odd index in the messages must be assistant
, change the summary role from system to assistant修复百度错误代码 336006 “the role of message with odd index in the messages must be assistant”,将摘要角色从 system 更改为 assistant
📝 补充信息 | Additional Information
the role of summary is system, it leads to Baidu error code 336006
the role of message with odd index in the messages must be assistant
摘要的角色是 system,这会导致百度错误代码 336006:消息中奇数索引的消息的角色必须是 assistant
Summary by CodeRabbit