agent.ts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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. responseType: string
  59. params: Record<string, any>
  60. },
  61. options?: { [key: string]: any }
  62. ) {
  63. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  64. '/api/agent/doExecute',
  65. {
  66. method: 'POST',
  67. headers: {
  68. 'Content-Type': 'application/json'
  69. },
  70. data: body,
  71. ...(options || {})
  72. }
  73. )
  74. }
  75. /** 智能体添加节点 POST /api/agent/doNewAgentNode */
  76. export async function postAgentDoNewAgentNode(
  77. body: {
  78. appAgentId: string
  79. parentId?: string
  80. position: { x: number; y: number }
  81. width: number
  82. height: number
  83. selected: boolean
  84. nodeType: string
  85. zIndex: number
  86. prevNodeId?: string
  87. nodeHandleId?: string
  88. },
  89. options?: { [key: string]: any }
  90. ) {
  91. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  92. '/api/agent/doNewAgentNode',
  93. {
  94. method: 'POST',
  95. headers: {
  96. 'Content-Type': 'application/json'
  97. },
  98. data: body,
  99. ...(options || {})
  100. }
  101. )
  102. }
  103. /** 根据边缘线,创建新的智能体节点 POST /api/agent/doNewAgentNodeWithEdge */
  104. export async function postAgentDoNewAgentNodeWithEdge(
  105. body: {
  106. edgeId: string
  107. newNode: {
  108. appAgentId: string
  109. parentId: string
  110. position: { x: number; y: number }
  111. width: number
  112. height: number
  113. selected: boolean
  114. nodeType: string
  115. zIndex: number
  116. prevNodeId: string
  117. nodeHandleId: string
  118. }
  119. },
  120. options?: { [key: string]: any }
  121. ) {
  122. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  123. '/api/agent/doNewAgentNodeWithEdge',
  124. {
  125. method: 'POST',
  126. headers: {
  127. 'Content-Type': 'application/json'
  128. },
  129. data: body,
  130. ...(options || {})
  131. }
  132. )
  133. }
  134. /** 新增智能体边缘信息 POST /api/agent/doNewEdge */
  135. export async function postAgentDoNewEdge(
  136. body: {
  137. appAgentId: string
  138. source: string
  139. sourceHandle?: string
  140. target: string
  141. zIndex: number
  142. },
  143. options?: { [key: string]: any }
  144. ) {
  145. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  146. '/api/agent/doNewEdge',
  147. {
  148. method: 'POST',
  149. headers: {
  150. 'Content-Type': 'application/json'
  151. },
  152. data: body,
  153. ...(options || {})
  154. }
  155. )
  156. }
  157. /** 保存智能体变量 POST /api/agent/doSaveAgentVariables */
  158. export async function postAgentDoSaveAgentVariables(
  159. body: {
  160. appAgentId: string
  161. conversation_variables: string[]
  162. env_variables: { name?: string; value?: string; type?: string }[]
  163. },
  164. options?: { [key: string]: any }
  165. ) {
  166. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  167. '/api/agent/doSaveAgentVariables',
  168. {
  169. method: 'POST',
  170. headers: {
  171. 'Content-Type': 'application/json'
  172. },
  173. data: body,
  174. ...(options || {})
  175. }
  176. )
  177. }
  178. /** 选中智能体边缘 POST /api/agent/doSelectedEdge */
  179. export async function postAgentDoSelectedEdge(
  180. body: {
  181. id: string
  182. },
  183. options?: { [key: string]: any }
  184. ) {
  185. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  186. '/api/agent/doSelectedEdge',
  187. {
  188. method: 'POST',
  189. headers: {
  190. 'Content-Type': 'application/json'
  191. },
  192. data: body,
  193. ...(options || {})
  194. }
  195. )
  196. }
  197. /** 更新智能体节点 POST /api/agent/doUpdateAgentNode */
  198. export async function postAgentDoUpdateAgentNode(
  199. body: {
  200. id: string
  201. appAgentId: string
  202. parentId: string
  203. position: { x: number; y: number }
  204. width: number
  205. height: number
  206. selected: boolean
  207. nodeType: string
  208. zIndex: number
  209. data: Record<string, any>
  210. },
  211. options?: { [key: string]: any }
  212. ) {
  213. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  214. '/api/agent/doUpdateAgentNode',
  215. {
  216. method: 'POST',
  217. headers: {
  218. 'Content-Type': 'application/json'
  219. },
  220. data: body,
  221. ...(options || {})
  222. }
  223. )
  224. }
  225. /** 获取智能体信息 POST /api/agent/getAgentInfo */
  226. export async function postAgentGetAgentInfo(
  227. body: {
  228. id: string
  229. },
  230. options?: { [key: string]: any }
  231. ) {
  232. return request<{
  233. isSuccess: boolean
  234. code: number
  235. result: {
  236. conversation_variables: string[]
  237. edges: {
  238. appAgentId: string
  239. creationTime: string
  240. data: { isInLoop: boolean; sourceType: string; targetType: string }
  241. id: string
  242. isDeleted: boolean
  243. selected: boolean
  244. source: string
  245. sourceHandle: string
  246. target: string
  247. targetHandle: string
  248. type: string
  249. updateTime: string
  250. zIndex: number
  251. }[]
  252. env_variables: { is_require?: boolean; name?: string; type?: string; value?: string }[]
  253. id: string
  254. name: string
  255. nodes: {
  256. appAgentId: string
  257. creationTime: string
  258. creatorUserId: string
  259. data: {
  260. outputs: { name: string; describe: string; is_require: boolean; type: string }[]
  261. bodyType: string
  262. exception: string
  263. ssl_verify: boolean
  264. body: { data: { type: string; value: string; key: string }[]; type: string }
  265. title: string
  266. type: string
  267. error_strategy: string
  268. retry_config: { max_retries: number; retry_enabled: boolean; retry_interval: number }
  269. authorization: { type: string; config: { api_key: string; header: string; type: string } }
  270. output: { headers: string[]; status_code: number; files: string[]; body: string }
  271. timeout_config: {
  272. max_write_timeout: number
  273. max_read_timeout: number
  274. max_connect_timeout: number
  275. }
  276. exceptionDefaultValue: { headers: string; status_code: number; body: string }
  277. id: string
  278. selected: boolean
  279. height: number
  280. errorConfig: { retry_delay: number; retry: boolean; max_retry: number }
  281. output_can_alter: boolean
  282. timeoutConfig: { read: number; write: number; connect: number }
  283. variables: { name: string; type: string; value: string }[]
  284. method: string
  285. isInIteration: boolean
  286. default_value: string[]
  287. params: string[]
  288. nodeType: string
  289. url: string
  290. width: number
  291. verifySSL: boolean
  292. heads: string[]
  293. position: { x: number; y: number }
  294. desc: string
  295. isInLoop: boolean
  296. filter_by: {
  297. conditions: { varType?: string; comparison_operator?: string; right_value?: string }[]
  298. enabled: boolean
  299. }
  300. limit: { size: number; enabled: boolean }
  301. order_by: { value: string; enabled: boolean; key: string }
  302. extract_by: { serial: string; enabled: boolean }
  303. code?: string
  304. code_language?: string
  305. cases?: {
  306. logical_operator: string
  307. id: string
  308. conditions: {
  309. varType: string
  310. left_value: string
  311. comparison_operator: string
  312. right_value: string
  313. }[]
  314. }[]
  315. }
  316. height: number
  317. id: string
  318. isDeleted: boolean
  319. position: { x: number; y: number }
  320. selected: boolean
  321. type: string
  322. updateTime: string
  323. width: number
  324. zIndex: number
  325. deleterUserId?: string
  326. deletionTime?: string
  327. }[]
  328. profilePhoto: string
  329. viewPort: { x: number; y: number; zoom: number }
  330. }
  331. isAuthorized: boolean
  332. }>('/api/agent/getAgentInfo', {
  333. method: 'POST',
  334. headers: {
  335. 'Content-Type': 'application/json'
  336. },
  337. data: body,
  338. ...(options || {})
  339. })
  340. }
  341. /** 获取智能体列表 POST /api/agent/getAgentList */
  342. export async function postAgentGetAgentList(
  343. // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  344. params: API.postAgentGetAgentListParams,
  345. options?: { [key: string]: any }
  346. ) {
  347. return request<{
  348. isSuccess: boolean
  349. code: number
  350. result: {
  351. currentPage: number
  352. hasNextPage: boolean
  353. hasPreviousPage: boolean
  354. model: {
  355. conversation_variables: string[]
  356. env_variables: { name: string; type: string; value: string }[]
  357. id: string
  358. name: string
  359. profilePhoto: string
  360. viewPort: { x: number; y: number; zoom: number }
  361. }[]
  362. pageSize: number
  363. totalCount: number
  364. totalPages: number
  365. }
  366. isAuthorized: boolean
  367. }>('/api/agent/getAgentList', {
  368. method: 'POST',
  369. params: {
  370. ...params
  371. },
  372. ...(options || {})
  373. })
  374. }
  375. /** 获取智能体节点的最后一次运行日志 POST /api/agent/getAgentNodeLastRunnerLogs */
  376. export async function postAgentGetAgentNodeLastRunnerLogs(
  377. body: {
  378. node_id: string
  379. },
  380. options?: { [key: string]: any }
  381. ) {
  382. return request<{
  383. isSuccess: boolean
  384. code: number
  385. result: {
  386. appAgentId: string
  387. appAgentNodeId: string
  388. appAgentRunnerId: string
  389. creationTime: string
  390. errorMsg: string
  391. id: string
  392. isDeleted: boolean
  393. raw: {
  394. agent_node_id: string
  395. children: string[]
  396. end_time: number
  397. input_variable: { str: string }
  398. is_success: boolean
  399. node_name: string
  400. node_type: string
  401. output_variable: { result: string[] }
  402. start_time: number
  403. use_time: number
  404. }
  405. status: string
  406. updateTime: string
  407. useTime: number
  408. }
  409. isAuthorized: boolean
  410. }>('/api/agent/getAgentNodeLastRunnerLogs', {
  411. method: 'POST',
  412. headers: {
  413. 'Content-Type': 'application/json'
  414. },
  415. data: body,
  416. ...(options || {})
  417. })
  418. }
  419. /** 根据节点id,获取节点之前的所有变量列表 POST /api/agent/getPrevNodeOutVariableList */
  420. export async function postAgentGetPrevNodeOutVariableList(
  421. body: {
  422. node_id: string
  423. varTypeList: string[]
  424. },
  425. options?: { [key: string]: any }
  426. ) {
  427. return request<{
  428. isSuccess: boolean
  429. code: number
  430. result: {
  431. id: string
  432. name: string
  433. variableList: { expression: string; name: string; type: string }[]
  434. }[]
  435. isAuthorized: boolean
  436. }>('/api/agent/getPrevNodeOutVariableList', {
  437. method: 'POST',
  438. headers: {
  439. 'Content-Type': 'application/json'
  440. },
  441. data: body,
  442. ...(options || {})
  443. })
  444. }