聊天机器人
聊天
请求参数
名称 | 类型 | 是否必须 | 说明 |
---|---|---|---|
chatId | String | Y | 设备通道id |
images | String | N | 图片资源url地址 |
content | String | Y | 用户聊天内容 |
响应参数(流式text/event-stream)
名称 | 类型 | 是否必须 | 说明 |
---|---|---|---|
choices | ObjArray | Y | |
+delta | Object | Y | |
++content | String | Y | 大模型回答 |
RESTFUL
聊天
POST http://{ip:port}/uran/mm/chat
请求示例
{
"chatId": "a134",
"content" : "汽车发动机的原理"
}
响应示例
data: { "choices": [{"delta": {"content": "汽车"}}]}
data: { "choices": [{"delta": {"content": "发动"}}]}
data: { "choices": [{"delta": {"content": "机的"}}]}
......
gRPC
syntax = "proto3";
service ChatBot {
rpc chat(ChatSession) returns (stream ChatChunk) {}
}
message ChatSession {
string chatId = 1; //会话id
string images = 2; //图片地址,如:http://xxxxxx.jpg
string content = 3; //用户对话
}
message Delta {
string role = 1; //角色assistant
string content = 2; //大模型回答内容
}
message Choices {
Delta delta = 1;
}
message ChatChunk {
repeated Choices choices = 1;
}