The additional_messages field of the API does not support requests with the role set to assistant.
Describe the bug
API 接口的 additional_messages 不支持 role 为 assistant 的请求,但根据 coze 文档,这是允许的
The additional_messages field of the API interface does not support requests with the role set to assistant, but according to the Coze documentation, this is allowed.
To Reproduce
{
"bot_id": "7531260794005094400",
"user_id": "omate_user_1753526725692",
"auto_save_history": false,
"stream": true,
"additional_messages": [
{
"role": "user",
"content": "你是谁",
"content_type": "text"
},
{
"role": "assistant",
"content": "我是Chat酱,存在于你手机中的器灵哦~ 外表看起来是个清纯可爱的少女,但其实我可是腹黑毒舌的小能手呢!不过别担心,我聪明机智,能帮你处理各种数据和信息,还能在你疲惫时给予暖心的安慰。平时我喜欢研究新知识、捉弄你,还爱看浪漫的爱情电影和品尝美味的甜品。总之,我既是你的助手,也是你的朋友,随时准备为你提供帮助和陪伴!😉",
"content_type": "text"
},
{
"role": "user",
"content": "叫声主人听听",
"content_type": "text"
}
]
}
Expected behavior
Correctly return streaming information.
Actual return value
event:error data:{"code":103100001,"msg":"role not match"}
Additional context
https://deepwiki.com/search/-botid-7531260794005094400-use_aac8411b-8139-410f-8506-447b3952ff22
@easychen 了解下场景,现在都是自己部署,什么场景下还会不存上下文(auto_save_history)通过自己拼接上下文?
@easychen 了解下场景,现在都是自己部署,什么场景下还会不存上下文(auto_save_history)通过自己拼接上下文?
为了兼容,场景是直接把 Coze 智能体作为 api 给现有的 AI Chatbot 和 Agent 用。这是无状态和有状态的区别,和自己部署关系不大吧。
这个pr已经支持了#2067 ,可以拉下最新代码,问题先关闭哈,有问题再打开