agent.api 9.6 KB

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