agent.ts 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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. },
  59. options?: { [key: string]: any }
  60. ) {
  61. return request<{
  62. isSuccess: boolean
  63. code: number
  64. result: {
  65. agent: {
  66. conversation_variables: string[]
  67. creationTime: string
  68. creatorUserId: string
  69. env_variables: { is_require?: boolean; name?: string; type?: string; value?: string }[]
  70. id: string
  71. isDeleted: boolean
  72. name: string
  73. profilePhoto: string
  74. remark: string
  75. updateTime: string
  76. viewPort: { x: number; y: number; zoom: number }
  77. }
  78. runVariable: {
  79. session: Record<string, any>
  80. '492048da-6f33-4a36-adc5-cff4b973b053': {
  81. headers: {
  82. 'transfer-Encoding': string
  83. 'access-Control-Expose-Headers': string
  84. server: string
  85. 'access-Control-Allow-Credentials': string
  86. connection: string
  87. 'access-Control-Max-Age': string
  88. date: string
  89. 'x-proxy-pass': string
  90. 'content-Type': string
  91. }
  92. status_code: number
  93. body: string
  94. $execute_result: {
  95. code: number
  96. data: {
  97. cookieList: string[]
  98. error: boolean
  99. statusCode: number
  100. success: boolean
  101. throwableMsg: string
  102. }
  103. error: boolean
  104. isSelected: boolean
  105. msg: string
  106. success: boolean
  107. ts: string
  108. }
  109. }
  110. env: { api_address: string }
  111. }
  112. run_nodes: string[]
  113. }
  114. isAuthorized: boolean
  115. }>('/api/agent/doExecute', {
  116. method: 'POST',
  117. headers: {
  118. 'Content-Type': 'application/json'
  119. },
  120. data: body,
  121. ...(options || {})
  122. })
  123. }
  124. /** 智能体添加节点 POST /api/agent/doNewAgentNode */
  125. export async function postAgentDoNewAgentNode(
  126. body: {
  127. appAgentId: string
  128. position: { x: number; y: number }
  129. width: number
  130. height: number
  131. selected: boolean
  132. nodeType: 'custom' | 'start' | 'end' | 'condition' | 'task' | 'http-request'
  133. zIndex: number
  134. parentId: string
  135. },
  136. options?: { [key: string]: any }
  137. ) {
  138. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  139. '/api/agent/doNewAgentNode',
  140. {
  141. method: 'POST',
  142. headers: {
  143. 'Content-Type': 'application/json'
  144. },
  145. data: body,
  146. ...(options || {})
  147. }
  148. )
  149. }
  150. /** 新增智能体边缘信息 POST /api/agent/doNewEdge */
  151. export async function postAgentDoNewEdge(
  152. body: {
  153. appAgentId: string
  154. source: string
  155. sourceHandle?: string
  156. target: string
  157. zIndex: number
  158. },
  159. options?: { [key: string]: any }
  160. ) {
  161. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  162. '/api/agent/doNewEdge',
  163. {
  164. method: 'POST',
  165. headers: {
  166. 'Content-Type': 'application/json'
  167. },
  168. data: body,
  169. ...(options || {})
  170. }
  171. )
  172. }
  173. /** 保存智能体变量 POST /api/agent/doSaveAgentVariables */
  174. export async function postAgentDoSaveAgentVariables(
  175. body: {
  176. appAgentId: string
  177. conversation_variables: string[]
  178. env_variables: {
  179. name: string
  180. value: string
  181. type: 'string' | 'number' | 'boolean' | 'object' | 'array'
  182. }[]
  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: 'custom' | 'start' | 'end' | 'condition' | 'task' | 'http-request'
  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: string[]
  258. env_variables: {
  259. is_require?: boolean
  260. name: string
  261. type: 'string' | 'number' | 'boolean' | 'object' | 'array'
  262. value: string
  263. }[]
  264. id: string
  265. name: string
  266. nodes: API.AgentNode[]
  267. profilePhoto: string
  268. viewPort: { x: number; y: number; zoom: number }
  269. }
  270. isAuthorized: boolean
  271. }>('/api/agent/getAgentInfo', {
  272. method: 'POST',
  273. headers: {
  274. 'Content-Type': 'application/json'
  275. },
  276. data: body,
  277. ...(options || {})
  278. })
  279. }