agent.api 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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. // 租户id
  43. OrganizationId *uint64 `json:"organizationId,optional"`
  44. }
  45. // Agent information response | Agent信息返回体
  46. AgentInfoResp {
  47. BaseDataInfo
  48. // Agent information | Agent数据
  49. Data AgentInfo `json:"data"`
  50. }
  51. VectorModel {
  52. Model *string `json:"model"`
  53. Name *string `json:"name"`
  54. CharsPointsPrice *uint64 `json:"charsPointsPrice"`
  55. DefaultToken *uint64 `json:"defaultToken"`
  56. MaxToken *uint64 `json:"maxToken"`
  57. Weight *uint64 `json:"weight"`
  58. }
  59. AgentModel {
  60. Model *string `json:"model"`
  61. Name *string `json:"name"`
  62. MaxContext *uint64 `json:"maxContext"`
  63. MaxResponse *uint64 `json:"maxResponse"`
  64. CharsPointsPrice *uint64 `json:"charsPointsPrice"`
  65. }
  66. DatasetId {
  67. ID *string `json:"id"`
  68. ParentID *string `json:"parentId"`
  69. TeamId *string `json:"teamId"`
  70. TmbId *string `json:"tmbId"`
  71. Type *string `json:"type"`
  72. Status *string `json:"status"`
  73. Avatar *string `json:"avatar"`
  74. Name *string `json:"name"`
  75. VectorModel *string `json:"vectorModel"`
  76. AgentModel *string `json:"agentModel"`
  77. Intro *string `json:"intro"`
  78. }
  79. // Dataset info | 知识库详情
  80. DatasetInfo {
  81. ID *string `json:"id"`
  82. ParentID *string `json:"parentId"`
  83. TeamId *string `json:"teamId"`
  84. TmbId *string `json:"tmbId"`
  85. Type *string `json:"type"`
  86. Name *string `json:"name"`
  87. Intro *string `json:"intro"`
  88. Status *string `json:"status"`
  89. Avatar *string `json:"avatar"`
  90. VectorModel VectorModel `json:"vectorModel"`
  91. AgentModel AgentModel `json:"agentModel"`
  92. Permission *string `json:"permission"`
  93. CanWrite *bool `json:"canWrite"`
  94. IsOwner *bool `json:"isOwner"`
  95. }
  96. Index {
  97. DefaultIndex *bool `json:"defaultIndex"`
  98. Type *string `json:"type"`
  99. DataId *string `json:"dataId"`
  100. Text *string `json:"text"`
  101. ID *string `json:"id"`
  102. }
  103. // Collection Info | 集合详情
  104. CollectionInfo {
  105. ID *string `json:"id"`
  106. ParentID *string `json:"parentId"`
  107. TmbId *string `json:"tmbId,optional"`
  108. Type *string `json:"type"`
  109. Name *string `json:"name"`
  110. DataAmount *uint64 `json:"dataAmount,optional"`
  111. TrainingAmount *uint64 `json:"trainingAmount,optional"`
  112. TrainingType *string `json:"trainingType,optional"`
  113. ChunkSize *uint64 `json:"chunkSize,optional"`
  114. ChunkSplitter *string `json:"chunkSplitter,optional"`
  115. QaPrompt *string `json:"qaPrompt,optional"`
  116. RawTextLength *uint64 `json:"rawTextLength,optional"`
  117. CanWrite *bool `json:"canWrite,optional"`
  118. SourceName *string `json:"sourceName,optional"`
  119. DatasetId DatasetId `json:"datasetId,optional"`
  120. }
  121. CollectionDetailReq {
  122. ID *string `json:"id"`
  123. }
  124. CollectionInfoResp {
  125. BaseDataInfo
  126. Data CollectionInfo `json:"data"`
  127. }
  128. DataDetailReq {
  129. ID *string `json:"id"`
  130. }
  131. DataDetailResp {
  132. BaseDataInfo
  133. Data DataInfo `json:"data"`
  134. }
  135. CollectionSimpleInfo {
  136. ID *string `json:"id"`
  137. ParentID *string `json:"parentId"`
  138. TmbId *string `json:"tmbId,optional"`
  139. Type *string `json:"type"`
  140. Name *string `json:"name"`
  141. DataAmount *uint64 `json:"dataAmount,optional"`
  142. TrainingAmount *uint64 `json:"trainingAmount,optional"`
  143. }
  144. DataInfo {
  145. ID *string `json:"id"`
  146. Q *string `json:"q"`
  147. A *string `json:"a"`
  148. ChunkIndex *uint64 `json:"chunkIndex"`
  149. Indexes []Index `json:"indexes"`
  150. DatasetId *string `json:"datasetId"`
  151. CollectionId *string `json:"collectionId"`
  152. SourceName *string `json:"sourceName"`
  153. CanWrite *bool `json:"canWrite"`
  154. IsOwner *bool `json:"isOwner"`
  155. }
  156. DataSimpleInfo {
  157. ID *string `json:"id"`
  158. Q *string `json:"q"`
  159. A *string `json:"a"`
  160. ChunkIndex *uint64 `json:"chunkIndex"`
  161. DatasetId *string `json:"datasetId"`
  162. CollectionId *string `json:"collectionId"`
  163. }
  164. // Get collection list request params | Collection列表请求参数
  165. CollectionListReq {
  166. PageNum *int `json:"pageNum" validate:"required,number,gt=0"`
  167. PageSize *int `json:"pageSize" validate:"required,number,lt=100000"`
  168. DatasetId *string `json:"datasetId" validate:"required"`
  169. }
  170. // Collection list response | Collection List信息返回体
  171. CollectionListResp {
  172. BaseDataInfo
  173. // Agent information | Agent数据
  174. Data []CollectionSimpleInfo `json:"data"`
  175. PageNum *int `json:"pageNum" validate:"required,number,gt=0"`
  176. PageSize *int `json:"pageSize" validate:"required,number,lt=100000"`
  177. Total *int `json:"total"`
  178. }
  179. // Get collection list request params | Collection列表请求参数
  180. DataListReq {
  181. Page *int `json:"page" validate:"required,number,gt=0"`
  182. PageSize *int `json:"pageSize" validate:"required,number,lt=100000"`
  183. CollectionId *string `json:"collectionId" validate:"required"`
  184. }
  185. // Data list response | Data List信息返回体
  186. DataListResp {
  187. BaseDataInfo
  188. // Agent information | Agent数据
  189. Data BatchSimpleInfo `json:"data"`
  190. }
  191. BatchSimpleInfo {
  192. BaseListInfo
  193. // The API list data | BatchMsg列表数据
  194. Data []DataSimpleInfo `json:"data"`
  195. }
  196. // Data create request | 信息请求体
  197. CreateDataInfoReq {
  198. CollectionId *string `json:"collectionId" validate:"required"`
  199. // Q
  200. Q *string `json:"q" validate:"required"`
  201. // A
  202. A *string `json:"a" validate:"required"`
  203. // Indexes | 索引
  204. //Indexes []IndexSingle `json:"indexes,optional"`
  205. }
  206. // IndexSingle {
  207. // Text A *string `json:"text"`
  208. // }
  209. // Data create request | 信息返回体
  210. UpdateDataInfoReq {
  211. // ID
  212. DataId *string `json:"id" validate:"required"`
  213. // Q
  214. Q *string `json:"q" validate:"required"`
  215. // A
  216. A *string `json:"a" validate:"required"`
  217. // Indexes | 索引
  218. //Indexes []IndexSingle `json:"indexes,optional"`
  219. }
  220. DeleteDataReq {
  221. ID *string `json:"id" validate:"required"`
  222. }
  223. UploadDataReq {
  224. AgentId *string `form:"agentId"`
  225. }
  226. BatchDeleteIds {
  227. Ids []string `json:"ids"`
  228. }
  229. )
  230. @server(
  231. jwt: Auth
  232. group: agent
  233. middleware: Authority
  234. )
  235. service Wechat {
  236. // 批量删除fastgpt中数据
  237. @handler batchDeleteAgentData
  238. post /agent/data/batchDelete (BatchDeleteIds) returns (BaseDataInfo)
  239. // upload agent data | 上传data
  240. @handler uploadAgentData
  241. post /agent/data/upload () returns (BaseDataInfo)
  242. // Create agent information | 创建Agent
  243. @handler createAgent
  244. post /agent/create (AgentInfo) returns (BaseMsgResp)
  245. // Update agent information | 更新Agent
  246. @handler updateAgent
  247. post /agent/update (AgentInfo) returns (BaseMsgResp)
  248. // Delete agent information | 删除Agent信息
  249. @handler deleteAgent
  250. post /agent/delete (IDsReq) returns (BaseMsgResp)
  251. // Get agent list | 获取Agent列表
  252. @handler getAgentList
  253. post /agent/list (AgentListReq) returns (AgentListResp)
  254. // Get agent by ID | 通过ID获取Agent
  255. @handler getAgentById
  256. post /agent (IDReq) returns (AgentInfoResp)
  257. // Get collect list | 获取collection列表
  258. @handler getAgentCollectionList
  259. post /agent/collection/list (CollectionListReq) returns (CollectionListResp)
  260. // Get collect detail | 获取collection详情
  261. @handler getAgentCollectionInfo
  262. post /agent/collection/detail (CollectionDetailReq) returns (CollectionInfoResp)
  263. // Get data list | 获取data列表
  264. @handler getAgentDataList
  265. post /agent/data/list (DataListReq) returns (DataListResp)
  266. // Get data detail | 获取data详情
  267. @handler getAgentDataDetail
  268. post /agent/data/detail (DataDetailReq) returns (DataDetailResp)
  269. // Create data | 添加data
  270. @handler createAgentData
  271. post /agent/data/create (CreateDataInfoReq) returns (BaseDataInfo)
  272. // Update data | 修改data
  273. @handler updateAgentData
  274. post /agent/data/update (UpdateDataInfoReq) returns (BaseDataInfo)
  275. // Delete data | 删除data
  276. @handler deleteAgentData
  277. post /agent/data/delete (DeleteDataReq) returns (BaseDataInfo)
  278. }