Skip to content

混元模型,错误:messages 中 user(tool) 和 assistant 角色需交替出现 (一问一答),以 user 提问开始 #7173

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

Open
martin666888 opened this issue Mar 26, 2025 · 2 comments
Labels
🐛 Bug Something isn't working | 缺陷 unconfirm 未被维护者确认的问题

Comments

@martin666888
Copy link

📦 部署环境

Official Cloud

📦 部署模式

客户端模式(lobe-chat 镜像)

📌 软件版本

1.75.2

💻 系统环境

Windows

🌐 浏览器

Chrome

🐛 问题描述

Image
如题,如果之前有模型使用了tool,再改为混元模型就会报错,关闭或打开网络连接都无法解决,只能重开一个换题,这是一个bug吗?还是我哪里配置不对?

📷 复现步骤

No response

🚦 期望结果

No response

📝 补充信息

No response

@martin666888 martin666888 added the unconfirm 未被维护者确认的问题 label Mar 26, 2025
@lobehubbot
Copy link
Member

👀 @martin666888

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@dosubot dosubot bot added the 🐛 Bug Something isn't working | 缺陷 label Mar 26, 2025
@github-project-automation github-project-automation bot moved this to Roadmap - Chat 1.x in Lobe Chat Routine Mar 26, 2025
Copy link

dosubot bot commented Mar 26, 2025

I found a similar open issue related to role alternation in messages when using different models. The solution suggested in that issue is to ensure that the roles "user" and "assistant" alternate correctly in the message sequence, starting with a "user" role. This involves checking your code to ensure that the initial message is set with the correct role and that the roles alternate as required [1].

In the lobe-chat codebase, role assignment is handled by filtering and adjusting the roles of messages. If the first message has the role "assistant," a message with an empty content and the role "user" is prepended. Additionally, consecutive messages with the same role are separated by inserting a message with the opposite role [2].

You might want to review the part of your code where messages are constructed and ensure that the roles are correctly assigned and alternated, especially when switching from a tool model to the Hunyuan model.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷 unconfirm 未被维护者确认的问题
Projects
Status: Roadmap - Chat 1.x
Development

No branches or pull requests

2 participants