chat_records.api 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import "../base.api"
  2. type (
  3. // The data of chat records information | ChatRecords信息
  4. ChatRecordsInfo {
  5. BaseIDInfo
  6. // 内容
  7. Content *string `json:"content,optional"`
  8. // 内容类型:1-提问 2-回答
  9. ContentType *uint8 `json:"contentType,optional"`
  10. // 会话ID
  11. SessionId *uint64 `json:"sessionId,optional"`
  12. // 用户ID
  13. UserId *uint64 `json:"userId,optional"`
  14. // 聊天ID
  15. BotId *uint64 `json:"botId,optional"`
  16. // 类型:1-微信 2-小程序card 3-智能体
  17. BotType *uint8 `json:"botType,optional,options=1|2|3"`
  18. Finish bool `json:"finish,optional"`
  19. }
  20. // The response data of chat records list | ChatRecords列表数据
  21. ChatRecordsListResp {
  22. BaseDataInfo
  23. // ChatRecords list data | ChatRecords列表数据
  24. Data ChatRecordsListInfo `json:"data"`
  25. }
  26. // ChatRecords list data | ChatRecords列表数据
  27. ChatRecordsListInfo {
  28. BaseListInfo
  29. // The API list data | ChatRecords列表数据
  30. Data []ChatRecordsInfo `json:"data"`
  31. }
  32. // Get chat records list request params | ChatRecords列表请求参数
  33. ChatRecordsListReq {
  34. PageInfo
  35. SessionId *uint64 `json:"sessionId,optional"`
  36. BotId *uint64 `json:"botId,optional"`
  37. BotType *uint8 `json:"botType,optional"`
  38. }
  39. // ChatRecords information response | ChatRecords信息返回体
  40. ChatRecordsInfoResp {
  41. BaseDataInfo
  42. // ChatRecords information | ChatRecords数据
  43. Data ChatRecordsInfo `json:"data"`
  44. }
  45. ChatRecommendReq {
  46. SessionId *uint64 `json:"sessionId"`
  47. }
  48. ChatRecommendResp {
  49. BaseDataInfo
  50. // The API list data | ChatRecords列表数据
  51. Data ChatRecommend `json:"data"`
  52. }
  53. ChatRecommend {
  54. Data []string `json:"data"`
  55. SessionId uint64 `json:"sessionId"`
  56. }
  57. )
  58. @server(
  59. jwt: Auth
  60. group: chatrecords
  61. middleware: Miniprogram
  62. )
  63. service Wechat {
  64. // Create chat records information | 创建ChatRecords
  65. @handler submitApiChat
  66. post /api/chat/create (ChatRecordsInfo)
  67. // Get chat records list | 获取ChatRecords列表
  68. @handler getApiChatList
  69. post /api/chat/list (ChatRecordsListReq) returns (ChatRecordsListResp)
  70. // Get chat records list | 获取ChatRecords列表
  71. @handler getApiRecommendChat
  72. post /api/chat/recommmend (ChatRecommendReq) returns (ChatRecommendResp)
  73. }
  74. @server(
  75. jwt: Auth
  76. group: chatrecords
  77. middleware: Authority
  78. )
  79. service Wechat {
  80. // Create chat records information | 创建ChatRecords
  81. @handler createChatRecords
  82. post /chat_records/create (ChatRecordsInfo) returns (BaseMsgResp)
  83. // Update chat records information | 更新ChatRecords
  84. @handler updateChatRecords
  85. post /chat_records/update (ChatRecordsInfo) returns (BaseMsgResp)
  86. // Delete chat records information | 删除ChatRecords信息
  87. @handler deleteChatRecords
  88. post /chat_records/delete (IDsReq) returns (BaseMsgResp)
  89. // Get chat records list | 获取ChatRecords列表
  90. @handler getChatRecordsList
  91. post /chat_records/list (ChatRecordsListReq) returns (ChatRecordsListResp)
  92. // Get chat records by ID | 通过ID获取ChatRecords
  93. @handler getChatRecordsById
  94. post /chat_records (IDReq) returns (ChatRecordsInfoResp)
  95. }