agent.api 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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. // Get collection list request params | Collection列表请求参数
  140. CollectionListReq {
  141. PageNum *int `json:"pageNum" validate:"required,number,gt=0"`
  142. PageSize *int `json:"pageSize" validate:"required,number,lt=100000"`
  143. DatasetId *string `json:"datasetId" validate:"required"`
  144. }
  145. // Collection list response | Collection List信息返回体
  146. CollectionListResp {
  147. BaseDataInfo
  148. // Agent information | Agent数据
  149. Data []CollectionSimpleInfo `json:"data"`
  150. PageNum *int `json:"pageNum" validate:"required,number,gt=0"`
  151. PageSize *int `json:"pageSize" validate:"required,number,lt=100000"`
  152. Total *int `json:"total"`
  153. }
  154. // Get collection list request params | Collection列表请求参数
  155. DataListReq {
  156. PageNum *int `json:"pageNum" validate:"required,number,gt=0"`
  157. PageSize *int `json:"pageSize" validate:"required,number,lt=100000"`
  158. CollectionId *string `json:"collectionId" validate:"required"`
  159. }
  160. // Data list response | Data List信息返回体
  161. DataListResp {
  162. BaseDataInfo
  163. // Agent information | Agent数据
  164. Data []DataInfo `json:"data"`
  165. PageNum *int `json:"pageNum" validate:"required,number,gt=0"`
  166. PageSize *int `json:"pageSize" validate:"required,number,lt=100000"`
  167. Total *int `json:"total"`
  168. }
  169. // Data create request | 信息请求体
  170. CreateDataInfoReq {
  171. CollectionId *string `json:"collectionId" validate:"required"`
  172. // Q
  173. Q *string `json:"q"`
  174. // A
  175. A *string `json:"a"`
  176. // Indexes | 索引
  177. //Indexes []IndexSingle `json:"indexes,optional"`
  178. }
  179. // IndexSingle {
  180. // Text A *string `json:"text"`
  181. // }
  182. // Data create request | 信息返回体
  183. UpdateDataInfoReq {
  184. CollectionId *string `json:"collectionId" validate:"required"`
  185. // ID
  186. ID *string `json:"id"`
  187. // Q
  188. Q *string `json:"q"`
  189. // A
  190. A *string `json:"a"`
  191. // Indexes | 索引
  192. //Indexes []IndexSingle `json:"indexes,optional"`
  193. }
  194. )
  195. @server(
  196. jwt: Auth
  197. group: agent
  198. middleware: Authority
  199. )
  200. service Wechat {
  201. // Create agent information | 创建Agent
  202. @handler createAgent
  203. post /agent/create (AgentInfo) returns (BaseMsgResp)
  204. // Update agent information | 更新Agent
  205. @handler updateAgent
  206. post /agent/update (AgentInfo) returns (BaseMsgResp)
  207. // Delete agent information | 删除Agent信息
  208. @handler deleteAgent
  209. post /agent/delete (IDsReq) returns (BaseMsgResp)
  210. // Get agent list | 获取Agent列表
  211. @handler getAgentList
  212. post /agent/list (AgentListReq) returns (AgentListResp)
  213. // Get agent by ID | 通过ID获取Agent
  214. @handler getAgentById
  215. post /agent (IDReq) returns (AgentInfoResp)
  216. // Get collect list | 获取collection列表
  217. @handler getAgentCollectionList
  218. post /agent/collection/list (CollectionListReq) returns (CollectionListResp)
  219. // Get data list | 获取data列表
  220. @handler getAgentDataList
  221. post /agent/data/list (DataListReq) returns (DataListResp)
  222. // Create data | 添加data
  223. @handler createAgentData
  224. post /agent/data/create (CreateDataInfoReq) returns (BaseDataInfo)
  225. // Update data | 修改data
  226. @handler updateAgentData
  227. post /agent/data/update (UpdateDataInfoReq) returns (BaseDataInfo)
  228. }