chat_records.api 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. )
  46. @server(
  47. // jwt: Auth
  48. group: chatrecords
  49. // middleware: Miniprogram
  50. )
  51. service Wechat {
  52. // Create chat records information | 创建ChatRecords
  53. @handler submitApiChat
  54. post /api/chat/create (ChatRecordsInfo)
  55. // Get chat records list | 获取ChatRecords列表
  56. @handler getApiChatList
  57. post /api/chat/list (ChatRecordsListReq) returns (ChatRecordsListResp)
  58. // Get chat records list | 获取ChatRecords列表
  59. @handler saveApiChat
  60. post /api/chat/save (ChatRecordsInfo) returns (BaseMsgResp)
  61. }
  62. @server(
  63. jwt: Auth
  64. group: chatrecords
  65. middleware: Authority
  66. )
  67. service Wechat {
  68. // Create chat records information | 创建ChatRecords
  69. @handler createChatRecords
  70. post /chat_records/create (ChatRecordsInfo) returns (BaseMsgResp)
  71. // Update chat records information | 更新ChatRecords
  72. @handler updateChatRecords
  73. post /chat_records/update (ChatRecordsInfo) returns (BaseMsgResp)
  74. // Delete chat records information | 删除ChatRecords信息
  75. @handler deleteChatRecords
  76. post /chat_records/delete (IDsReq) returns (BaseMsgResp)
  77. // Get chat records list | 获取ChatRecords列表
  78. @handler getChatRecordsList
  79. post /chat_records/list (ChatRecordsListReq) returns (ChatRecordsListResp)
  80. // Get chat records by ID | 通过ID获取ChatRecords
  81. @handler getChatRecordsById
  82. post /chat_records (IDReq) returns (ChatRecordsInfoResp)
  83. }