ai.proto 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. syntax = "proto3";
  2. package api.ai;
  3. import "google/api/annotations.proto";
  4. import "google/protobuf/struct.proto";
  5. import "google/protobuf/empty.proto";
  6. option go_package = "git.ikuban.com/server/pw-protobuf/api/ai;ai";
  7. option java_multiple_files = true;
  8. option java_package = "api.ai";
  9. service Ai {
  10. // 查询AI模板
  11. rpc FindAITemplate (FindAITemplateRequest) returns (FindAITemplateReply){
  12. option (google.api.http) = {
  13. post: "/api/ai/template/list",
  14. body:"*"
  15. };
  16. };
  17. // 创建AI
  18. rpc CreateAIRobot (CreateAIRobotRequest) returns (AIRobotIDReply){
  19. option (google.api.http) = {
  20. post: "/api/ai/create",
  21. body:"*"
  22. };
  23. };
  24. // 销毁AI
  25. rpc DeleteAIRobot (AIRobotIDRequest) returns (google.protobuf.Empty){
  26. option (google.api.http) = {
  27. post: "/api/ai/delete",
  28. body:"*"
  29. };
  30. };
  31. // 更新AI
  32. rpc UpdateAIRobot (UpdateAIRobotRequest) returns (AIRobotIDReply){
  33. option (google.api.http) = {
  34. post: "/api/ai/update",
  35. body:"*"
  36. };
  37. };
  38. // 查询AI机器人列表
  39. rpc FindAIRobotList (FindAIRobotListRequest) returns (AIRobotList){
  40. option (google.api.http) = {
  41. post: "/api/ai/find/list",
  42. body:"*"
  43. };
  44. };
  45. // 查询AI机器人
  46. rpc GetAIRobot (AIRobotIDRequest) returns (AIRobotInfo){
  47. option (google.api.http) = {
  48. post: "/api/ai/find/info",
  49. body:"*"
  50. };
  51. };
  52. // 查询AI聊天记录
  53. rpc FindAIChatRecordList (FindAIChatRecordListRequest) returns (AIRecordListReply){
  54. option (google.api.http) = {
  55. post: "/api/ai/chat/record",
  56. body:"*"
  57. };
  58. };
  59. // 发送消息给ai
  60. rpc SendAIChat (SendAIChatRequest) returns (google.protobuf.Empty){
  61. option (google.api.http) = {
  62. post: "/api/ai/send",
  63. body:"*"
  64. };
  65. };
  66. // 查询额外服务列表
  67. rpc FindAdditionalServiceTemplateList (google.protobuf.Empty) returns (FindAdditionalServiceTemplateListReply){
  68. option (google.api.http) = {
  69. post: "/api/ai/service/list",
  70. body:"*"
  71. };
  72. };
  73. // 获取额外服务
  74. rpc GetAdditionalService (GetAdditionalServiceRequest) returns (GetAdditionalServiceReply){
  75. option (google.api.http) = {
  76. post: "/api/ai/service/get",
  77. body:"*"
  78. };
  79. };
  80. // 更新并创建额外服务
  81. rpc UpdateAdditionalService (UpdateAdditionalServiceRequest) returns (google.protobuf.Empty){
  82. option (google.api.http) = {
  83. post: "/api/ai/service/update",
  84. body:"*"
  85. };
  86. };
  87. // 查询用户的ai信息
  88. rpc FindUserAIMessage (google.protobuf.Empty) returns (FindUserAIMessageReply){
  89. option (google.api.http) = {
  90. post: "/api/ai/message",
  91. body:"*"
  92. };
  93. };
  94. // 定时执行服务
  95. rpc CronAdditionalService (google.protobuf.Empty) returns (google.protobuf.Empty){};
  96. // 用户已读
  97. rpc GetIsRead (GetIsReadRequest) returns (google.protobuf.Empty){};
  98. // 获取AI升级信息
  99. rpc GetAIShareMessage (GetAIShareMessageRequest) returns (GetAIShareMessageReply){
  100. option (google.api.http) = {
  101. post: "/api/share/ai/message",
  102. body:"*"
  103. };
  104. };
  105. // 获取二维码
  106. rpc GetShareQrcode (GetAIShareMessageRequest) returns (GetShareQrcodeReply){
  107. option (google.api.http) = {
  108. post: "/api/share/ai/qrcode",
  109. body:"*"
  110. };
  111. };
  112. // 保存视频链接
  113. rpc SetVideoLink (SetVideoLinkRequest) returns (google.protobuf.Empty){
  114. option (google.api.http) = {
  115. post: "/api/share/ai/link",
  116. body:"*"
  117. };
  118. };
  119. // vip直接升级
  120. rpc VipUpAI (GetAIShareMessageRequest) returns (google.protobuf.Empty){
  121. option (google.api.http) = {
  122. post: "/api/share/ai/vip",
  123. body:"*"
  124. };
  125. };
  126. // 用户受到邀请
  127. rpc ShareUserInto (ShareUserIntoRequest) returns (google.protobuf.Empty){};
  128. // vip直接升级
  129. rpc GetMiniProgramConf (google.protobuf.Empty) returns (GetMiniProgramConfReply){
  130. option (google.api.http) = {
  131. post: "/api/ai/share/conf",
  132. body:"*"
  133. };
  134. };
  135. // 获取ai订阅消息模板
  136. rpc GetAISubscribeMessage (google.protobuf.Empty) returns (GetAISubscribeMessageReply){
  137. option (google.api.http) = {
  138. post: "/api/ai/subscribe/id",
  139. body:"*"
  140. };
  141. };
  142. rpc CronSendAIMessage (google.protobuf.Empty) returns (google.protobuf.Empty){};
  143. }
  144. message GetAISubscribeMessageReply{
  145. repeated string linkSubscribeTemplateIds = 2;// 点击【提交链接】按钮收集
  146. repeated string shareSubscribeTemplateIds = 3;// 点击【立即邀请】按钮收集
  147. }
  148. message GetMiniProgramConfReply{
  149. string appid = 1;
  150. string path = 2;
  151. }
  152. message ShareUserIntoRequest{
  153. string openId = 1;// 用户openID
  154. int64 shareId = 2;// 分享ID
  155. }
  156. message SetVideoLinkRequest{
  157. string videoUrl = 1;
  158. string pictureUrl = 2;
  159. int64 robotId = 3;
  160. }
  161. message GetShareQrcodeReply{
  162. repeated string qrcodeUrl = 1;
  163. }
  164. message GetAIShareMessageRequest{
  165. string userId = 1;// 用户ID
  166. int64 robotId = 2;// 机器人ID
  167. }
  168. message GetAIShareMessageReply{
  169. int64 expirationTime = 1;// 过期时间
  170. repeated AIShareInfo list = 2;
  171. }
  172. message AIShareInfo{
  173. string title = 1;// 标题
  174. int64 price = 2;// 价格
  175. int64 originPrice = 3;// 原价
  176. string description = 4;// 描述
  177. string topLabel = 5;// 上面的标签 (例:限时免费)
  178. string underShowLabel = 6;// 下面的标签 (例:发短视频)
  179. string underHideLabel = 7;// 下面的标签 (例:点赞两次)
  180. bool isVip = 8;// 是否是vip
  181. int64 num = 9; // 分享数、点赞数
  182. int64 allNum = 10;// 总数
  183. string numDescription = 11;// num的描述
  184. bool isFinish = 12;// 是否完成
  185. int64 id = 13;
  186. string type = 14;
  187. bool isStart = 15;// 是否开启任务
  188. }
  189. message FindUserAIMessageReply{
  190. bool isFree = 1;// 创建是否免费
  191. int64 unreadNum = 2;// 未读数
  192. }
  193. message GetIsReadRequest{
  194. string userId = 1;
  195. int64 robotId = 2;
  196. }
  197. message UpdateAdditionalServiceRequest{
  198. int64 robotId = 1;// 机器人ID
  199. int64 templateId = 2;
  200. string word = 3;// 关键词
  201. bool isOpen = 4;// 是否开启
  202. repeated int64 day = 5;// 定时的天
  203. int64 hour = 6;// 定时小时
  204. }
  205. message GetAdditionalServiceRequest{
  206. int64 templateId = 1;// 对应列表的ID
  207. int64 robotId = 2;// 机器人ID
  208. }
  209. message GetAdditionalServiceReply{
  210. int64 id = 1;
  211. int64 robotId = 2;// 机器人ID
  212. string word = 3;// 关键词
  213. bool isOpen = 4;// 是否开启
  214. repeated int64 day = 5;// 定时的天
  215. int64 hour = 6;// 定时小时
  216. int64 templateId = 7;
  217. }
  218. message FindAdditionalServiceTemplateListReply{
  219. repeated AdditionalServiceTemplate list = 1;
  220. }
  221. message AdditionalServiceTemplate{
  222. int64 id = 1;// id
  223. string title = 2;// 名称
  224. string pictureUrl = 3;// 图片链接
  225. }
  226. message AIRobotIDReply{
  227. int64 id = 1;
  228. }
  229. message AIRecordListReply{
  230. repeated AIRecordInfo list = 1;
  231. int64 nextId = 2;
  232. }
  233. message AIRecordInfo{
  234. int64 messageId = 1; // 消息的ID
  235. string msgType = 2; // 消息类型
  236. Message message = 3; // 消息的结构
  237. int64 robotId = 4; // 机器人ID
  238. bool isSelf = 5; // 是否是自己
  239. int64 sendTime = 6; // 发送时间
  240. string status = 7; // 消息状态
  241. string statusMsg = 8;// 状态说明
  242. }
  243. message Message{
  244. string content = 1; // 文本内容
  245. }
  246. message SendAIChatRequest{
  247. int64 robotId = 1;
  248. Message message = 2; // 消息
  249. string msgType = 3;// 消息类型
  250. string websocketTag = 4;
  251. }
  252. message FindAIChatRecordListRequest{
  253. int64 nextId = 1;
  254. int64 offset = 2;
  255. int64 id = 3;
  256. }
  257. message AIRobotList{
  258. int64 nextId = 1;
  259. repeated AIRobotInfo list = 2;
  260. }
  261. message AIRobotInfo{
  262. int64 id = 1;
  263. string name = 2;// ai名称
  264. string avatarUrl = 3;// ai头像
  265. int64 sex = 4;// ai性别
  266. int64 age = 5;// ai年龄
  267. string constellation = 6;// ai星座
  268. int64 lastTime = 7;// 上次发送时间
  269. string lastContent = 8;// 上次发送的内容
  270. int64 unreadNum = 9;// 未读
  271. string status = 10;// 状态
  272. int64 createTime = 11;// 创建时间
  273. string userName = 12;// 用户名
  274. int64 expirationTime = 13;// 过期时间
  275. }
  276. message FindAIRobotListRequest{
  277. int64 nextId = 1;
  278. int64 offset = 2;
  279. }
  280. message UpdateAIRobotRequest{
  281. int64 id = 1;
  282. string aiName = 2;// 自定义ai名称
  283. string userName = 3;// ai对我的称呼
  284. }
  285. message AIRobotIDRequest{
  286. int64 id = 1;
  287. }
  288. message FindAITemplateRequest{
  289. int64 nextId = 1;
  290. int64 offset = 2;
  291. int64 sex = 3;// 性别
  292. }
  293. message FindAITemplateReply{
  294. int64 nextId = 1;
  295. repeated AITemplateInfo list= 2;
  296. }
  297. message AITemplateInfo{
  298. int64 id = 1;// ai模板ID
  299. string name = 2;// ai名称
  300. string avatarUrl = 3;// ai头像
  301. int64 sex = 4;// ai性别
  302. int64 age = 5;// ai年龄
  303. repeated string label = 6;// ai标签
  304. string description = 7;// ai描述
  305. string constellation = 8;// ai星座
  306. repeated Relation relationList = 9;// ai关系列表
  307. string introduceVoice = 10; // 介绍语音
  308. }
  309. message Relation{
  310. int64 id = 1;// 关系ID
  311. string picture = 2;// 图片
  312. string relation = 3;// 关系
  313. }
  314. message CreateAIRobotRequest{
  315. int64 templateId = 1;// ai模板ID
  316. string aiName = 2;// 自定义ai名称
  317. string userName = 3;// ai对我的称呼
  318. int64 relationId = 4;// 关系ID
  319. }
  320. message SendNextNeedPayMessage{
  321. int64 robotId = 2;// 机器人ID
  322. }