agent.ts 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import request from '@repo/api-client'
  4. /** 删除智能体节点 POST /api/agent/doDeleteAgentNode */
  5. export async function postAgentDoDeleteAgentNode(
  6. body: {
  7. id: string
  8. },
  9. options?: { [key: string]: any }
  10. ) {
  11. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  12. '/api/agent/doDeleteAgentNode',
  13. {
  14. method: 'POST',
  15. headers: {
  16. 'Content-Type': 'application/json'
  17. },
  18. data: body,
  19. ...(options || {})
  20. }
  21. )
  22. }
  23. /** 删除智能体边缘信息 POST /api/agent/doDeleteEdge */
  24. export async function postAgentDoDeleteEdge(
  25. body: {
  26. id: string
  27. },
  28. options?: { [key: string]: any }
  29. ) {
  30. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  31. '/api/agent/doDeleteEdge',
  32. {
  33. method: 'POST',
  34. headers: {
  35. 'Content-Type': 'application/json'
  36. },
  37. data: body,
  38. ...(options || {})
  39. }
  40. )
  41. }
  42. /** 智能体编辑 POST /api/agent/doEditAgent */
  43. export async function postAgentDoEditAgent(options?: { [key: string]: any }) {
  44. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  45. '/api/agent/doEditAgent',
  46. {
  47. method: 'POST',
  48. ...(options || {})
  49. }
  50. )
  51. }
  52. /** 运行智能体 POST /api/agent/doExecute */
  53. export async function postAgentDoExecute(
  54. body: {
  55. appAgentId: string
  56. start_node_id: string
  57. is_debugger: boolean
  58. params: Record<string, any>
  59. },
  60. options?: { [key: string]: any }
  61. ) {
  62. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  63. '/api/agent/doExecute',
  64. {
  65. method: 'POST',
  66. headers: {
  67. 'Content-Type': 'application/json'
  68. },
  69. data: body,
  70. ...(options || {})
  71. }
  72. )
  73. }
  74. /** 智能体添加节点 POST /api/agent/doNewAgentNode */
  75. export async function postAgentDoNewAgentNode(
  76. body: {
  77. appAgentId: string
  78. position: { x: number; y: number }
  79. width: number
  80. height: number
  81. selected: boolean
  82. nodeType: string
  83. zIndex: number
  84. parentId: string
  85. },
  86. options?: { [key: string]: any }
  87. ) {
  88. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  89. '/api/agent/doNewAgentNode',
  90. {
  91. method: 'POST',
  92. headers: {
  93. 'Content-Type': 'application/json'
  94. },
  95. data: body,
  96. ...(options || {})
  97. }
  98. )
  99. }
  100. /** 新增智能体边缘信息 POST /api/agent/doNewEdge */
  101. export async function postAgentDoNewEdge(
  102. body: {
  103. appAgentId: string
  104. source: string
  105. sourceHandle: string
  106. target: string
  107. zIndex: number
  108. },
  109. options?: { [key: string]: any }
  110. ) {
  111. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  112. '/api/agent/doNewEdge',
  113. {
  114. method: 'POST',
  115. headers: {
  116. 'Content-Type': 'application/json'
  117. },
  118. data: body,
  119. ...(options || {})
  120. }
  121. )
  122. }
  123. /** 保存智能体变量 POST /api/agent/doSaveAgentVariables */
  124. export async function postAgentDoSaveAgentVariables(
  125. body: {
  126. appAgentId: string
  127. conversation_variables: string[]
  128. env_variables: { name?: string; value?: string; type?: string }[]
  129. },
  130. options?: { [key: string]: any }
  131. ) {
  132. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  133. '/api/agent/doSaveAgentVariables',
  134. {
  135. method: 'POST',
  136. headers: {
  137. 'Content-Type': 'application/json'
  138. },
  139. data: body,
  140. ...(options || {})
  141. }
  142. )
  143. }
  144. /** 选中智能体边缘 POST /api/agent/doSelectedEdge */
  145. export async function postAgentDoSelectedEdge(
  146. body: {
  147. id: string
  148. },
  149. options?: { [key: string]: any }
  150. ) {
  151. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  152. '/api/agent/doSelectedEdge',
  153. {
  154. method: 'POST',
  155. headers: {
  156. 'Content-Type': 'application/json'
  157. },
  158. data: body,
  159. ...(options || {})
  160. }
  161. )
  162. }
  163. /** 更新智能体节点 POST /api/agent/doUpdateAgentNode */
  164. export async function postAgentDoUpdateAgentNode(
  165. body: {
  166. id: string
  167. appAgentId: string
  168. parentId: string
  169. position: { x: number; y: number }
  170. width: number
  171. height: number
  172. selected: boolean
  173. nodeType: string
  174. zIndex: number
  175. data: Record<string, any>
  176. },
  177. options?: { [key: string]: any }
  178. ) {
  179. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  180. '/api/agent/doUpdateAgentNode',
  181. {
  182. method: 'POST',
  183. headers: {
  184. 'Content-Type': 'application/json'
  185. },
  186. data: body,
  187. ...(options || {})
  188. }
  189. )
  190. }
  191. /** 获取智能体信息 POST /api/agent/getAgentInfo */
  192. export async function postAgentGetAgentInfo(
  193. body: {
  194. id: string
  195. },
  196. options?: { [key: string]: any }
  197. ) {
  198. return request<{
  199. isSuccess: boolean
  200. code: number
  201. result: {
  202. conversation_variables: string[]
  203. edges: {
  204. appAgentId: string
  205. creationTime: string
  206. data: { isInLoop: boolean; sourceType: string; targetType: string }
  207. id: string
  208. isDeleted: boolean
  209. selected: boolean
  210. source: string
  211. sourceHandle: string
  212. target: string
  213. targetHandle: string
  214. type: string
  215. updateTime: string
  216. zIndex: number
  217. }[]
  218. env_variables: { is_require?: boolean; name?: string; type?: string; value?: string }[]
  219. id: string
  220. name: string
  221. nodes: {
  222. appAgentId: string
  223. creationTime: string
  224. creatorUserId: string
  225. data: {
  226. outputs: { name: string; describe: string; is_require: boolean; type: string }[]
  227. bodyType: string
  228. exception: string
  229. ssl_verify: boolean
  230. body: { data: { type: string; value: string; key: string }[]; type: string }
  231. title: string
  232. type: string
  233. error_strategy: string
  234. retry_config: { max_retries: number; retry_enabled: boolean; retry_interval: number }
  235. authorization: { type: string; config: { api_key: string; header: string; type: string } }
  236. output: { headers: string[]; status_code: number; files: string[]; body: string }
  237. timeout_config: {
  238. max_write_timeout: number
  239. max_read_timeout: number
  240. max_connect_timeout: number
  241. }
  242. exceptionDefaultValue: { headers: string; status_code: number; body: string }
  243. id: string
  244. selected: boolean
  245. height: number
  246. errorConfig: { retry_delay: number; retry: boolean; max_retry: number }
  247. output_can_alter: boolean
  248. timeoutConfig: { read: number; write: number; connect: number }
  249. variables: { name: string; type: string; value: string }[]
  250. method: string
  251. isInIteration: boolean
  252. default_value: string[]
  253. params: string[]
  254. nodeType: string
  255. url: string
  256. width: number
  257. verifySSL: boolean
  258. heads: string[]
  259. position: { x: number; y: number }
  260. desc: string
  261. isInLoop: boolean
  262. filter_by: {
  263. conditions: { varType?: string; comparison_operator?: string; right_value?: string }[]
  264. enabled: boolean
  265. }
  266. limit: { size: number; enabled: boolean }
  267. order_by: { value: string; enabled: boolean; key: string }
  268. extract_by: { serial: string; enabled: boolean }
  269. code?: string
  270. code_language?: string
  271. cases?: {
  272. logical_operator: string
  273. id: string
  274. conditions: {
  275. varType: string
  276. left_value: string
  277. comparison_operator: string
  278. right_value: string
  279. }[]
  280. }[]
  281. }
  282. height: number
  283. id: string
  284. isDeleted: boolean
  285. position: { x: number; y: number }
  286. selected: boolean
  287. type: string
  288. updateTime: string
  289. width: number
  290. zIndex: number
  291. deleterUserId?: string
  292. deletionTime?: string
  293. }[]
  294. profilePhoto: string
  295. viewPort: { x: number; y: number; zoom: number }
  296. }
  297. isAuthorized: boolean
  298. }>('/api/agent/getAgentInfo', {
  299. method: 'POST',
  300. headers: {
  301. 'Content-Type': 'application/json'
  302. },
  303. data: body,
  304. ...(options || {})
  305. })
  306. }
  307. /** 获取智能体列表 POST /api/agent/getAgentList */
  308. export async function postAgentGetAgentList(
  309. // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  310. params: API.postAgentGetAgentListParams,
  311. options?: { [key: string]: any }
  312. ) {
  313. return request<{
  314. isSuccess: boolean
  315. code: number
  316. result: {
  317. currentPage: number
  318. hasNextPage: boolean
  319. hasPreviousPage: boolean
  320. model: {
  321. conversation_variables: string[]
  322. env_variables: { name: string; type: string; value: string }[]
  323. id: string
  324. name: string
  325. profilePhoto: string
  326. viewPort: { x: number; y: number; zoom: number }
  327. }[]
  328. pageSize: number
  329. totalCount: number
  330. totalPages: number
  331. }
  332. isAuthorized: boolean
  333. }>('/api/agent/getAgentList', {
  334. method: 'POST',
  335. params: {
  336. ...params
  337. },
  338. ...(options || {})
  339. })
  340. }
  341. /** 根据节点id,获取节点之前的所有变量列表 POST /api/agent/getPrevNodeOutVariableList */
  342. export async function postAgentGetPrevNodeOutVariableList(
  343. body: {
  344. node_id: string
  345. varTypeList: string[]
  346. },
  347. options?: { [key: string]: any }
  348. ) {
  349. return request<{
  350. isSuccess: boolean
  351. code: number
  352. result: {
  353. id: string
  354. name: string
  355. variableList: { expression: string; name: string; type: string }[]
  356. }[]
  357. isAuthorized: boolean
  358. }>('/api/agent/getPrevNodeOutVariableList', {
  359. method: 'POST',
  360. headers: {
  361. 'Content-Type': 'application/json'
  362. },
  363. data: body,
  364. ...(options || {})
  365. })
  366. }