agent.api 7.8 KB

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