chat_records.api 3.6 KB

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