agent.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import request from '@repo/api-client'
  4. /** 智能体编辑 POST /api/agent/doEditAgent */
  5. export async function postDoEditAgent(options?: { [key: string]: any }) {
  6. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  7. '/api/agent/doEditAgent',
  8. {
  9. method: 'POST',
  10. ...(options || {})
  11. }
  12. )
  13. }
  14. /** 智能体添加节点 POST /api/agent/doNewAgentNode */
  15. export async function postDoNewAgentNode(
  16. body: {
  17. appAgentId: string
  18. position: { x: number; y: number }
  19. width: number
  20. height: number
  21. selected: boolean
  22. nodeType: 'custom' | 'start' | 'end' | 'condition' | 'task' | 'http-request'
  23. zIndex: number
  24. parentId: string
  25. },
  26. options?: { [key: string]: any }
  27. ) {
  28. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  29. '/api/agent/doNewAgentNode',
  30. {
  31. method: 'POST',
  32. headers: {
  33. 'Content-Type': 'application/json'
  34. },
  35. data: body,
  36. ...(options || {})
  37. }
  38. )
  39. }
  40. /** 保存智能体变量 POST /api/agent/doSaveAgentVariables */
  41. export async function postDoSaveAgentVariables(
  42. body: {
  43. appAgentId: string
  44. conversation_variables: string[]
  45. env_variables: {
  46. name: string
  47. value: string
  48. type: 'string' | 'number' | 'boolean' | 'object' | 'array'
  49. }[]
  50. },
  51. options?: { [key: string]: any }
  52. ) {
  53. return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
  54. '/api/agent/doSaveAgentVariables',
  55. {
  56. method: 'POST',
  57. headers: {
  58. 'Content-Type': 'application/json'
  59. },
  60. data: body,
  61. ...(options || {})
  62. }
  63. )
  64. }
  65. /** 测试运行智能体节点 POST /api/agent/doTestNodeRunner */
  66. export async function postDoTestNodeRunner(
  67. body: {
  68. id: string
  69. appAgentId: string
  70. },
  71. options?: { [key: string]: any }
  72. ) {
  73. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  74. '/api/agent/doTestNodeRunner',
  75. {
  76. method: 'POST',
  77. headers: {
  78. 'Content-Type': 'application/json'
  79. },
  80. data: body,
  81. ...(options || {})
  82. }
  83. )
  84. }
  85. /** 更新智能体节点 POST /api/agent/doUpdateAgentNode */
  86. export async function postDoUpdateAgentNode(
  87. body: {
  88. id: string
  89. appAgentId: string
  90. parentId: string
  91. position: { x: number; y: number }
  92. width: number
  93. height: number
  94. selected: boolean
  95. nodeType: 'custom' | 'start' | 'end' | 'condition' | 'task' | 'http-request'
  96. zIndex: number
  97. data: Record<string, any>
  98. },
  99. options?: { [key: string]: any }
  100. ) {
  101. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  102. '/api/agent/doUpdateAgentNode',
  103. {
  104. method: 'POST',
  105. headers: {
  106. 'Content-Type': 'application/json'
  107. },
  108. data: body,
  109. ...(options || {})
  110. }
  111. )
  112. }
  113. /** 获取智能体信息 POST /api/agent/getAgentInfo */
  114. export async function postGetAgentInfo(
  115. body: {
  116. id: string
  117. },
  118. options?: { [key: string]: any }
  119. ) {
  120. return request<{
  121. isSuccess: boolean
  122. code: number
  123. result: {
  124. conversation_variables: string[]
  125. edges: string[]
  126. env_variables: {
  127. is_require?: boolean
  128. name: string
  129. type: 'string' | 'number' | 'boolean' | 'object' | 'array'
  130. value: string
  131. }[]
  132. id: string
  133. name: string
  134. nodes: API.AgentNode[]
  135. profilePhoto: string
  136. viewPort: { x: number; y: number; zoom: number }
  137. }
  138. isAuthorized: boolean
  139. }>('/api/agent/getAgentInfo', {
  140. method: 'POST',
  141. headers: {
  142. 'Content-Type': 'application/json'
  143. },
  144. data: body,
  145. ...(options || {})
  146. })
  147. }