agent.ts 14 KB

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