agent.ts 12 KB

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