添加会话条目¶
向本地会话添加一条类型、角色和状态摘要。
POST https://token.moi.matrixorigin.cn/v1/conversations/{conversation_id}/items
调用前准备¶
请求示例¶
将示例中的 $GENESIS_ACCESS_TOKEN 和 $CONVERSATION_ID 分别替换为个人访问令牌和所选会话的 ID。
curl -X POST "https://token.moi.matrixorigin.cn/v1/conversations/$CONVERSATION_ID/items" \
-H "Authorization: Bearer $GENESIS_ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"type": "message",
"role": "user"
}'
路径参数¶
参数 |
类型 |
是否必填 |
说明 |
|---|---|---|---|
|
string |
是 |
创建会话响应中的 |
请求体¶
本地条目保存类型、角色和状态等摘要;消息正文需由应用自行保存。
参数 |
类型 |
是否必填 |
说明 |
|---|---|---|---|
|
string |
否 |
条目类型,例如 |
|
string |
否 |
条目角色,例如 |
|
string |
否 |
条目状态,省略时为 |
成功响应¶
成功时返回新增的条目摘要。
{
"id": "$ITEM_ID",
"object": "conversation.item",
"conversation_id": "$CONVERSATION_ID",
"type": "message",
"role": "user",
"status": "active",
"created_at": 1780000000
}
字段 |
类型 |
说明 |
|---|---|---|
|
string |
条目标识。 |
|
string |
固定为 |
|
string |
条目所属的会话标识。 |
|
string |
条目类型,例如 |
|
string |
条目角色,例如 |
|
string |
条目状态,省略时为 |
|
integer |
创建时间,Unix 秒级时间戳。 |
错误响应¶
资源不存在、已删除或当前凭据不可访问时,请求返回 404。
{
"error": {
"message": "conversation not found",
"type": "conversation_not_found",
"code": "conversation_not_found"
}
}
字段 |
类型 |
说明 |
|---|---|---|
|
object |
错误信息。 |
|
string |
错误原因。 |
|
string |
错误类别。 |
|
string |
错误代码。 |
后续操作¶
最后更新于