agent.ts 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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/doEditAgent */
  24. export async function postAgentDoEditAgent(options?: { [key: string]: any }) {
  25. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  26. '/api/agent/doEditAgent',
  27. {
  28. method: 'POST',
  29. ...(options || {})
  30. }
  31. )
  32. }
  33. /** 智能体添加节点 POST /api/agent/doNewAgentNode */
  34. export async function postAgentDoNewAgentNode(
  35. body: {
  36. appAgentId: string
  37. position: { x: number; y: number }
  38. width: number
  39. height: number
  40. selected: boolean
  41. nodeType: string
  42. zIndex: number
  43. parentId: string
  44. },
  45. options?: { [key: string]: any }
  46. ) {
  47. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  48. '/api/agent/doNewAgentNode',
  49. {
  50. method: 'POST',
  51. headers: {
  52. 'Content-Type': 'application/json'
  53. },
  54. data: body,
  55. ...(options || {})
  56. }
  57. )
  58. }
  59. /** 新增智能体边缘信息 POST /api/agent/doNewEdge */
  60. export async function postAgentDoNewEdge(
  61. body: {
  62. appAgentId: string
  63. source: string
  64. sourceHandle?: string
  65. target: string
  66. zIndex: number
  67. },
  68. options?: { [key: string]: any }
  69. ) {
  70. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  71. '/api/agent/doNewEdge',
  72. {
  73. method: 'POST',
  74. headers: {
  75. 'Content-Type': 'application/json'
  76. },
  77. data: body,
  78. ...(options || {})
  79. }
  80. )
  81. }
  82. /** 保存智能体变量 POST /api/agent/doSaveAgentVariables */
  83. export async function postAgentDoSaveAgentVariables(
  84. body: {
  85. appAgentId: string
  86. conversation_variables: string[]
  87. env_variables: {
  88. name: string
  89. value: string
  90. type: 'string' | 'number' | 'boolean' | 'object' | 'array'
  91. }[]
  92. },
  93. options?: { [key: string]: any }
  94. ) {
  95. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  96. '/api/agent/doSaveAgentVariables',
  97. {
  98. method: 'POST',
  99. headers: {
  100. 'Content-Type': 'application/json'
  101. },
  102. data: body,
  103. ...(options || {})
  104. }
  105. )
  106. }
  107. /** 选中智能体边缘 POST /api/agent/doSelectedEdge */
  108. export async function postAgentDoSelectedEdge(
  109. body: {
  110. id: string
  111. },
  112. options?: { [key: string]: any }
  113. ) {
  114. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  115. '/api/agent/doSelectedEdge',
  116. {
  117. method: 'POST',
  118. headers: {
  119. 'Content-Type': 'application/json'
  120. },
  121. data: body,
  122. ...(options || {})
  123. }
  124. )
  125. }
  126. /** 测试运行智能体节点 POST /api/agent/doTestNodeRunner */
  127. export async function postAgentDoTestNodeRunner(
  128. body: {
  129. id: string
  130. appAgentId: string
  131. },
  132. options?: { [key: string]: any }
  133. ) {
  134. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  135. '/api/agent/doTestNodeRunner',
  136. {
  137. method: 'POST',
  138. headers: {
  139. 'Content-Type': 'application/json'
  140. },
  141. data: body,
  142. ...(options || {})
  143. }
  144. )
  145. }
  146. /** 更新智能体节点 POST /api/agent/doUpdateAgentNode */
  147. export async function postAgentDoUpdateAgentNode(
  148. body: {
  149. id: string
  150. appAgentId: string
  151. parentId: string
  152. position: { x: number; y: number }
  153. width: number
  154. height: number
  155. selected: boolean
  156. nodeType: 'custom' | 'start' | 'end' | 'condition' | 'task' | 'http-request'
  157. zIndex: number
  158. data: Record<string, any>
  159. },
  160. options?: { [key: string]: any }
  161. ) {
  162. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  163. '/api/agent/doUpdateAgentNode',
  164. {
  165. method: 'POST',
  166. headers: {
  167. 'Content-Type': 'application/json'
  168. },
  169. data: body,
  170. ...(options || {})
  171. }
  172. )
  173. }
  174. /** 获取智能体信息 POST /api/agent/getAgentInfo */
  175. export async function postAgentGetAgentInfo(
  176. body: {
  177. id: string
  178. },
  179. options?: { [key: string]: any }
  180. ) {
  181. return request<{
  182. isSuccess: boolean
  183. code: number
  184. result: {
  185. conversation_variables: string[]
  186. edges: string[]
  187. env_variables: {
  188. is_require?: boolean
  189. name: string
  190. type: 'string' | 'number' | 'boolean' | 'object' | 'array'
  191. value: string
  192. }[]
  193. id: string
  194. name: string
  195. nodes: API.AgentNode[]
  196. profilePhoto: string
  197. viewPort: { x: number; y: number; zoom: number }
  198. }
  199. isAuthorized: boolean
  200. }>('/api/agent/getAgentInfo', {
  201. method: 'POST',
  202. headers: {
  203. 'Content-Type': 'application/json'
  204. },
  205. data: body,
  206. ...(options || {})
  207. })
  208. }