Deeptrain-Community / chatnio

🚀 Next Generation AI One-Stop Internationalization Solution. 🚀 下一代 AI 一站式 B/C 端解决方案,支持 OpenAI,Midjourney,Claude,讯飞星火,Stable Diffusion,DALL·E,ChatGLM,通义千问,腾讯混元,360 智脑,百川 AI,火山方舟,新必应,Gemini,Moonshot 等模型,支持对话分享,自定义预设,云端同步,模型市场,支持弹性计费和订阅计划模式,支持图片解析,支持联网搜索,支持模型缓存,丰富美观的后台管理与仪表盘数据统计。
https://chatnio.com
Apache License 2.0
2.71k stars 446 forks source link

偶发性无规律报错messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row (type: invalid_request_error) #209

Closed ViperGash closed 1 week ago

ViperGash commented 2 weeks ago

image 最近总是遇到这个提示。claude和gpt都会遇到。api渠道都是自己走官方的。没有中转。

messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row (type: invalid_request_error)

这个是当时的日志。

{"role":"assistant","content":"这张图片展示了一个知识图谱(Knowledge Graph)。它包含了多个相互连接的节点,每个节点代表一个概念或实体。主要内容如下:\n\n1. 中心节点是\"Tesla Model 3\",与多个其他节点相连。\n\n2. 地理位置相关的节点:\n - Fremont\n - Palo Alto\n - California\n - Hollywood\n - Paris\n - France\n\n3. 公司和品牌:\n - Tesla\n - Renault\n\n4. 人物:\n - Isabelle Adjani\n - Macron\n - Matthew McConaughey\n\n这些节点通过线条相互连接,表示它们之间存在某种关系。例如,Tesla Model 3与Fremont、Palo Alto和California相连,可能表示这款车的生产或设计地点。\n\n图的右上角标注了\"Knowledge Graph\"(知识图谱)字样,说明这是一个知识图谱的示例。\n\n这种图谱结构可以直观地展示不同概念之间的关联,有助于理解复杂的信息网络和关系。"},{"role":"user","content":[{"type":"text","text":"你能推荐一个通过代码自动生成知识图谱的方式/平台吗,并在该种方式/平台中复现我给你的知识图谱"}]},{"role":"assistant","content":"messages: roles must alternate between \"user\" and \"assistant\", but found multiple \"user\" roles in a row (type: invalid_request_error)"},{"role":"user","content":[{"type":"text","text":"你能推荐一个通过代码自动生成知识图谱的方式/平台吗,并在该种方式/平台中复现我给你的知识图谱"}]}],"max_tokens":2000,"model":"claude-3-5-sonnet-20240620","stream":true,"temperature":0.6,"top_p":1,"top_k":5} [DEBUG] - [2024-06-21 10:50:58] - [sse] request failed with status: 400 Bad Request response: {"type":"error","error":{"type":"invalid_request_error","message":"messages: roles must alternate between \"user\" and \"assistant\", but found multiple \"user\" roles in a row"}} [WARNING] - [2024-06-21 10:50:58] - [channel] caught error messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row (type: invalid_request_error) for model claude-3-5-sonnet-20240620 at channel claude [INFO] - [2024-06-21 10:50:58] - [channel] channels are exhausted for model claude-3-5-sonnet-20240620 [WARNING] - [2024-06-21 10:50:58] - messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row (type: invalid_request_error) (model: claude-3-5-sonnet-20240620, client: xxxxx)

ViperGash commented 2 weeks ago

4o的错误发生的时候还没开启调试模式。所以等下次出现再补充。目前只有claude的。

Issues-translate-bot commented 2 weeks ago

Bot detected the issue body's language is not English, translate it automatically.


The debugging mode was not turned on when the 4o error occurred. So I’ll add it next time. Currently only claude's.

AnnaStreeter commented 1 week ago

chatnio 什么版本

Issues-translate-bot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically.


What version of chatnio

zmh-program commented 1 week ago

latest 无法复现,请更新版本

Issues-translate-bot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically.


latest cannot be reproduced, please update the version

zmh-program commented 1 week ago

TIP: 如果你更新至最新版后仍然通过对接官方接口报错,请 Reopen 此 issue

Issues-translate-bot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically.


TIP: If you still report an error through the official interface after updating to the latest version, please Reopen this issue