agent.ts 14 KB

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