agent.ts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  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<{
  234. isSuccess: boolean
  235. code: number
  236. isAuthorized: boolean
  237. result?: Record<string, any>
  238. }>('/api/agent/doUpdateAgentNode', {
  239. method: 'POST',
  240. headers: {
  241. 'Content-Type': 'application/json'
  242. },
  243. data: body,
  244. ...(options || {})
  245. })
  246. }
  247. /** 获取智能体信息 POST /api/agent/getAgentInfo */
  248. export async function postAgentGetAgentInfo(
  249. body: {
  250. id: string
  251. },
  252. options?: { [key: string]: any }
  253. ) {
  254. return request<{
  255. isSuccess: boolean
  256. code: number
  257. result: {
  258. conversation_variables: string[]
  259. edges: {
  260. appAgentId: string
  261. creationTime: string
  262. data: { isInLoop: boolean; sourceType: string; targetType: string }
  263. id: string
  264. isDeleted: boolean
  265. selected: boolean
  266. source: string
  267. sourceHandle: string
  268. target: string
  269. targetHandle: string
  270. type: string
  271. updateTime: string
  272. zIndex: number
  273. }[]
  274. env_variables: { is_require?: boolean; name?: string; type?: string; value?: string }[]
  275. id: string
  276. name: string
  277. nodes: {
  278. appAgentId: string
  279. creationTime: string
  280. creatorUserId: string
  281. data: {
  282. outputs: { name: string; describe: string; is_require: boolean; type: string }[]
  283. bodyType: string
  284. exception: string
  285. ssl_verify: boolean
  286. body: { data: { type: string; value: string; key: string }[]; type: string }
  287. title: string
  288. type: string
  289. error_strategy: string
  290. retry_config: { max_retries: number; retry_enabled: boolean; retry_interval: number }
  291. authorization: { type: string; config: { api_key: string; header: string; type: string } }
  292. output: { headers: string[]; status_code: number; files: string[]; body: string }
  293. timeout_config: {
  294. max_write_timeout: number
  295. max_read_timeout: number
  296. max_connect_timeout: number
  297. }
  298. exceptionDefaultValue: { headers: string; status_code: number; body: string }
  299. id: string
  300. selected: boolean
  301. height: number
  302. errorConfig: { retry_delay: number; retry: boolean; max_retry: number }
  303. output_can_alter: boolean
  304. timeoutConfig: { read: number; write: number; connect: number }
  305. variables: { name: string; type: string; value: string }[]
  306. method: string
  307. isInIteration: boolean
  308. default_value: string[]
  309. params: string[]
  310. nodeType: string
  311. url: string
  312. width: number
  313. verifySSL: boolean
  314. heads: string[]
  315. position: { x: number; y: number }
  316. desc: string
  317. isInLoop: boolean
  318. filter_by: {
  319. conditions: { varType?: string; comparison_operator?: string; right_value?: string }[]
  320. enabled: boolean
  321. }
  322. limit: { size: number; enabled: boolean }
  323. order_by: { value: string; enabled: boolean; key: string }
  324. extract_by: { serial: string; enabled: boolean }
  325. code?: string
  326. code_language?: string
  327. cases?: {
  328. logical_operator: string
  329. id: string
  330. conditions: {
  331. varType: string
  332. left_value: string
  333. comparison_operator: string
  334. right_value: string
  335. }[]
  336. }[]
  337. }
  338. height: number
  339. id: string
  340. isDeleted: boolean
  341. position: { x: number; y: number }
  342. selected: boolean
  343. type: string
  344. updateTime: string
  345. width: number
  346. zIndex: number
  347. deleterUserId?: string
  348. deletionTime?: string
  349. }[]
  350. profilePhoto: string
  351. viewPort: { x: number; y: number; zoom: number }
  352. }
  353. isAuthorized: boolean
  354. }>('/api/agent/getAgentInfo', {
  355. method: 'POST',
  356. headers: {
  357. 'Content-Type': 'application/json'
  358. },
  359. data: body,
  360. ...(options || {})
  361. })
  362. }
  363. /** 获取智能体列表 POST /api/agent/getAgentList */
  364. export async function postAgentGetAgentList(
  365. // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  366. params: API.postAgentGetAgentListParams,
  367. options?: { [key: string]: any }
  368. ) {
  369. return request<{
  370. isSuccess: boolean
  371. code: number
  372. result: {
  373. currentPage: number
  374. hasNextPage: boolean
  375. hasPreviousPage: boolean
  376. model: {
  377. conversation_variables: string[]
  378. env_variables: { name: string; type: string; value: string }[]
  379. id: string
  380. name: string
  381. profilePhoto: string
  382. viewPort: { x: number; y: number; zoom: number }
  383. }[]
  384. pageSize: number
  385. totalCount: number
  386. totalPages: number
  387. }
  388. isAuthorized: boolean
  389. }>('/api/agent/getAgentList', {
  390. method: 'POST',
  391. params: {
  392. ...params
  393. },
  394. ...(options || {})
  395. })
  396. }
  397. /** 获取智能体MonacoEditor提示器配置对象 POST /api/agent/getAgentMonacoEditorCompletions */
  398. export async function postAgentGetAgentMonacoEditorCompletions(
  399. body: {},
  400. options?: { [key: string]: any }
  401. ) {
  402. return request<{
  403. isSuccess: boolean
  404. code: number
  405. result: {
  406. javascript: {
  407. methods: string[]
  408. object: string
  409. properties: {
  410. detail: string
  411. documentation: string
  412. insertText: string
  413. kind: string
  414. label: string
  415. snippet: boolean
  416. }[]
  417. triggerCharacters: string[]
  418. }[]
  419. }
  420. isAuthorized: boolean
  421. }>('/api/agent/getAgentMonacoEditorCompletions', {
  422. method: 'POST',
  423. headers: {
  424. 'Content-Type': 'application/json'
  425. },
  426. data: body,
  427. ...(options || {})
  428. })
  429. }
  430. /** 获取智能体节点的最后一次运行日志 POST /api/agent/getAgentNodeLastRunnerLogs */
  431. export async function postAgentGetAgentNodeLastRunnerLogs(
  432. body: {
  433. node_id: string
  434. },
  435. options?: { [key: string]: any }
  436. ) {
  437. return request<{
  438. isSuccess: boolean
  439. code: number
  440. result: {
  441. appAgentId: string
  442. appAgentNodeId: string
  443. appAgentRunnerId: string
  444. creationTime: string
  445. errorMsg: string
  446. id: string
  447. isDeleted: boolean
  448. raw: {
  449. agent_node_id: string
  450. children: string[]
  451. end_time: number
  452. input_variable: { str: string }
  453. is_success: boolean
  454. node_name: string
  455. node_type: string
  456. output_variable: { result: string[] }
  457. start_time: number
  458. use_time: number
  459. }
  460. status: string
  461. updateTime: string
  462. useTime: number
  463. }
  464. isAuthorized: boolean
  465. }>('/api/agent/getAgentNodeLastRunnerLogs', {
  466. method: 'POST',
  467. headers: {
  468. 'Content-Type': 'application/json'
  469. },
  470. data: body,
  471. ...(options || {})
  472. })
  473. }
  474. /** 根据节点id,获取节点之前的所有变量列表 POST /api/agent/getPrevNodeOutVariableList */
  475. export async function postAgentGetPrevNodeOutVariableList(
  476. body: {
  477. node_id: string
  478. varTypeList: string[]
  479. },
  480. options?: { [key: string]: any }
  481. ) {
  482. return request<{
  483. isSuccess: boolean
  484. code: number
  485. result: {
  486. id: string
  487. name: string
  488. variableList: { expression: string; name: string; type: string }[]
  489. }[]
  490. isAuthorized: boolean
  491. }>('/api/agent/getPrevNodeOutVariableList', {
  492. method: 'POST',
  493. headers: {
  494. 'Content-Type': 'application/json'
  495. },
  496. data: body,
  497. ...(options || {})
  498. })
  499. }
  500. /** 获取支持的自定义智能体节点yaml列表 POST /api/agent/getSupportCustomAgentNodeYamlList */
  501. export async function postAgentGetSupportCustomAgentNodeYamlList(
  502. body: {},
  503. options?: { [key: string]: any }
  504. ) {
  505. return request<{ isSuccess: boolean; code: number; result: string[]; isAuthorized: boolean }>(
  506. '/api/agent/getSupportCustomAgentNodeYamlList',
  507. {
  508. method: 'POST',
  509. headers: {
  510. 'Content-Type': 'application/json'
  511. },
  512. data: body,
  513. ...(options || {})
  514. }
  515. )
  516. }