agent.ts 9.8 KB

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