agent.api 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. import "../base.api"
  2. type (
  3. // The data of agent information | Agent信息
  4. AgentInfo {
  5. BaseIDInfo
  6. // name | 角色名称
  7. Name *string `json:"name,optional"`
  8. // role | 角色设定
  9. Role *string `json:"role,optional"`
  10. // status | 状态 1-正常 2-禁用
  11. Status *int `json:"status,optional"`
  12. // background | 背景介绍
  13. Background *string `json:"background,optional"`
  14. // examples | 对话案例
  15. Examples *string `json:"examples,optional"`
  16. DatasetId *string `json:"dataset_id,optional"`
  17. CollectionId *string `json:"collection_id,optional"`
  18. }
  19. // The response data of agent list | Agent列表数据
  20. AgentListResp {
  21. BaseDataInfo
  22. // Agent list data | Agent列表数据
  23. Data AgentListInfo `json:"data"`
  24. }
  25. // Agent list data | Agent列表数据
  26. AgentListInfo {
  27. BaseListInfo
  28. // The API list data | Agent列表数据
  29. Data []AgentInfo `json:"data"`
  30. }
  31. // Get agent list request params | Agent列表请求参数
  32. AgentListReq {
  33. PageInfo
  34. // name | 角色名称
  35. Name *string `json:"name,optional"`
  36. // role | 角色设定
  37. Role *string `json:"role,optional"`
  38. // background | 背景介绍
  39. Background *string `json:"background,optional"`
  40. // status | 状态 1-可用 2-不可用
  41. Status *int `json:"status,optional"`
  42. }
  43. // Agent information response | Agent信息返回体
  44. AgentInfoResp {
  45. BaseDataInfo
  46. // Agent information | Agent数据
  47. Data AgentInfo `json:"data"`
  48. }
  49. VectorModel {
  50. Model *string `json:"model"`
  51. Name *string `json:"name"`
  52. CharsPointsPrice *uint64 `json:"charsPointsPrice"`
  53. DefaultToken *uint64 `json:"defaultToken"`
  54. MaxToken *uint64 `json:"maxToken"`
  55. Weight *uint64 `json:"weight"`
  56. }
  57. AgentModel {
  58. Model *string `json:"model"`
  59. Name *string `json:"name"`
  60. MaxContext *uint64 `json:"maxContext"`
  61. MaxResponse *uint64 `json:"maxResponse"`
  62. CharsPointsPrice *uint64 `json:"charsPointsPrice"`
  63. }
  64. DatasetId {
  65. ID *string `json:"id"`
  66. ParentID *string `json:"parentId"`
  67. TeamId *string `json:"teamId"`
  68. TmbId *string `json:"tmbId"`
  69. Type *string `json:"type"`
  70. Status *string `json:"status"`
  71. Avatar *string `json:"avatar"`
  72. Name *string `json:"name"`
  73. VectorModel *string `json:"vectorModel"`
  74. AgentModel *string `json:"agentModel"`
  75. Intro *string `json:"intro"`
  76. }
  77. // Dataset info | 知识库详情
  78. DatasetInfo {
  79. ID *string `json:"id"`
  80. ParentID *string `json:"parentId"`
  81. TeamId *string `json:"teamId"`
  82. TmbId *string `json:"tmbId"`
  83. Type *string `json:"type"`
  84. Name *string `json:"name"`
  85. Intro *string `json:"intro"`
  86. Status *string `json:"status"`
  87. Avatar *string `json:"avatar"`
  88. VectorModel VectorModel `json:"vectorModel"`
  89. AgentModel AgentModel `json:"agentModel"`
  90. Permission *string `json:"permission"`
  91. CanWrite *bool `json:"canWrite"`
  92. IsOwner *bool `json:"isOwner"`
  93. }
  94. Index {
  95. DefaultIndex *bool `json:"defaultIndex"`
  96. Type *string `json:"type"`
  97. DataId *string `json:"dataId"`
  98. Text *string `json:"text"`
  99. ID *string `json:"id"`
  100. }
  101. // Collection Info | 集合详情
  102. CollectionInfo {
  103. ID *string `json:"id"`
  104. ParentID *string `json:"parentId"`
  105. TmbId *string `json:"tmbId,optional"`
  106. Type *string `json:"type"`
  107. Name *string `json:"name"`
  108. DataAmount *uint64 `json:"dataAmount,optional"`
  109. TrainingAmount *uint64 `json:"trainingAmount,optional"`
  110. TrainingType *string `json:"trainingType,optional"`
  111. ChunkSize *uint64 `json:"chunkSize,optional"`
  112. ChunkSplitter *string `json:"chunkSplitter,optional"`
  113. QaPrompt *string `json:"qaPrompt,optional"`
  114. RawTextLength *uint64 `json:"rawTextLength,optional"`
  115. CanWrite *bool `json:"canWrite,optional"`
  116. SourceName *string `json:"sourceName,optional"`
  117. DatasetId DatasetId `json:"datasetId,optional"`
  118. }
  119. CollectionDetailReq {
  120. ID *string `json:"id"`
  121. }
  122. CollectionInfoResp {
  123. BaseDataInfo
  124. Data CollectionInfo `json:"data"`
  125. }
  126. DataDetailReq {
  127. ID *string `json:"id"`
  128. }
  129. DataDetailResp {
  130. BaseDataInfo
  131. Data DataInfo `json:"data"`
  132. }
  133. CollectionSimpleInfo {
  134. ID *string `json:"id"`
  135. ParentID *string `json:"parentId"`
  136. TmbId *string `json:"tmbId,optional"`
  137. Type *string `json:"type"`
  138. Name *string `json:"name"`
  139. DataAmount *uint64 `json:"dataAmount,optional"`
  140. TrainingAmount *uint64 `json:"trainingAmount,optional"`
  141. }
  142. DataInfo {
  143. ID *string `json:"id"`
  144. Q *string `json:"q"`
  145. A *string `json:"a"`
  146. ChunkIndex *uint64 `json:"chunkIndex"`
  147. Indexes []Index `json:"indexes"`
  148. DatasetId *string `json:"datasetId"`
  149. CollectionId *string `json:"collectionId"`
  150. SourceName *string `json:"sourceName"`
  151. CanWrite *bool `json:"canWrite"`
  152. IsOwner *bool `json:"isOwner"`
  153. }
  154. DataSimpleInfo {
  155. ID *string `json:"id"`
  156. Q *string `json:"q"`
  157. A *string `json:"a"`
  158. ChunkIndex *uint64 `json:"chunkIndex"`
  159. DatasetId *string `json:"datasetId"`
  160. CollectionId *string `json:"collectionId"`
  161. }
  162. // Get collection list request params | Collection列表请求参数
  163. CollectionListReq {
  164. PageNum *int `json:"pageNum" validate:"required,number,gt=0"`
  165. PageSize *int `json:"pageSize" validate:"required,number,lt=100000"`
  166. DatasetId *string `json:"datasetId" validate:"required"`
  167. }
  168. // Collection list response | Collection List信息返回体
  169. CollectionListResp {
  170. BaseDataInfo
  171. // Agent information | Agent数据
  172. Data []CollectionSimpleInfo `json:"data"`
  173. PageNum *int `json:"pageNum" validate:"required,number,gt=0"`
  174. PageSize *int `json:"pageSize" validate:"required,number,lt=100000"`
  175. Total *int `json:"total"`
  176. }
  177. // Get collection list request params | Collection列表请求参数
  178. DataListReq {
  179. PageNum *int `json:"pageNum" validate:"required,number,gt=0"`
  180. PageSize *int `json:"pageSize" validate:"required,number,lt=100000"`
  181. CollectionId *string `json:"collectionId" validate:"required"`
  182. }
  183. // Data list response | Data List信息返回体
  184. DataListResp {
  185. BaseDataInfo
  186. // Agent information | Agent数据
  187. Data []DataSimpleInfo `json:"data"`
  188. PageNum *int `json:"pageNum" validate:"required,number,gt=0"`
  189. PageSize *int `json:"pageSize" validate:"required,number,lt=100000"`
  190. Total *int `json:"total"`
  191. }
  192. // Data create request | 信息请求体
  193. CreateDataInfoReq {
  194. CollectionId *string `json:"collectionId" validate:"required"`
  195. // Q
  196. Q *string `json:"q" validate:"required"`
  197. // A
  198. A *string `json:"a" validate:"required"`
  199. // Indexes | 索引
  200. //Indexes []IndexSingle `json:"indexes,optional"`
  201. }
  202. // IndexSingle {
  203. // Text A *string `json:"text"`
  204. // }
  205. // Data create request | 信息返回体
  206. UpdateDataInfoReq {
  207. // ID
  208. DataId *string `json:"dataId" validate:"required"`
  209. // Q
  210. Q *string `json:"q" validate:"required"`
  211. // A
  212. A *string `json:"a" validate:"required"`
  213. // Indexes | 索引
  214. //Indexes []IndexSingle `json:"indexes,optional"`
  215. }
  216. DeleteDataReq {
  217. ID *string `json:"id" validate:"required"`
  218. }
  219. )
  220. @server(
  221. jwt: Auth
  222. group: agent
  223. middleware: Authority
  224. )
  225. service Wechat {
  226. // Create agent information | 创建Agent
  227. @handler createAgent
  228. post /agent/create (AgentInfo) returns (BaseMsgResp)
  229. // Update agent information | 更新Agent
  230. @handler updateAgent
  231. post /agent/update (AgentInfo) returns (BaseMsgResp)
  232. // Delete agent information | 删除Agent信息
  233. @handler deleteAgent
  234. post /agent/delete (IDsReq) returns (BaseMsgResp)
  235. // Get agent list | 获取Agent列表
  236. @handler getAgentList
  237. post /agent/list (AgentListReq) returns (AgentListResp)
  238. // Get agent by ID | 通过ID获取Agent
  239. @handler getAgentById
  240. post /agent (IDReq) returns (AgentInfoResp)
  241. // Get collect list | 获取collection列表
  242. @handler getAgentCollectionList
  243. post /agent/collection/list (CollectionListReq) returns (CollectionListResp)
  244. // Get collect detail | 获取collection详情
  245. @handler getAgentCollectionInfo
  246. post /agent/collection/detail (CollectionDetailReq) returns (CollectionInfoResp)
  247. // Get data list | 获取data列表
  248. @handler getAgentDataList
  249. post /agent/data/list (DataListReq) returns (DataListResp)
  250. // Get data detail | 获取data详情
  251. @handler getAgentDataDetail
  252. post /agent/data/detail (DataDetailReq) returns (DataDetailResp)
  253. // Create data | 添加data
  254. @handler createAgentData
  255. post /agent/data/create (CreateDataInfoReq) returns (BaseDataInfo)
  256. // Update data | 修改data
  257. @handler updateAgentData
  258. post /agent/data/update (UpdateDataInfoReq) returns (BaseDataInfo)
  259. // Delete data | 删除data
  260. @handler deleteAgentData
  261. post /agent/data/delete (DeleteDataReq) returns (BaseDataInfo)
  262. }