agentApplication.ts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import request from '@repo/api-client'
  4. /** 创建智能体 POST /api/ai/agent/create */
  5. export async function postAiAgentCreate(
  6. body: {
  7. name: string
  8. description: string
  9. avatar: string
  10. mode: string
  11. config: {
  12. basic_config: { system_prompt: string }
  13. model_config: {
  14. model_id: string
  15. rerank_model_id: string
  16. temperature: number
  17. max_completion_tokens: number
  18. thinking: boolean
  19. }
  20. setting_config: { max_iterations: number; mcp_selection_mode: string; mcp_services: string[] }
  21. kb_config: {
  22. kb_selection_mode: string
  23. knowledge_bases: string[]
  24. retrieve_kb_only_when_mentioned: boolean
  25. supported_file_types: string[]
  26. }
  27. img_vlm_config: {
  28. image_upload_enabled: boolean
  29. vlm_model_id: string
  30. image_storage_provider: string
  31. }
  32. faq_config: {
  33. faq_priority_enabled: boolean
  34. faq_direct_answer_threshold: number
  35. faq_score_boost: number
  36. }
  37. web_search_config: {
  38. web_search_enabled: boolean
  39. web_search_max_results: number
  40. web_search_provider_id: string
  41. web_fetch_enabled: boolean
  42. web_fetch_top_n: number
  43. }
  44. multiple_config: { multi_turn_enabled: boolean; history_turns: number }
  45. search_config: {
  46. embedding_top_k: number
  47. keyword_threshold: number
  48. vector_threshold: number
  49. rerank_top_k: number
  50. rerank_threshold: number
  51. }
  52. advanced_config: {
  53. enable_query_expansion: boolean
  54. enable_rewrite: boolean
  55. rewrite_prompt_system: string
  56. rewrite_prompt_user: string
  57. fallback_strategy: string
  58. fallback_response: string
  59. fallback_prompt: string
  60. }
  61. }
  62. },
  63. options?: { [key: string]: any }
  64. ) {
  65. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  66. '/api/ai/agent/create',
  67. {
  68. method: 'POST',
  69. headers: {
  70. 'Content-Type': 'application/json'
  71. },
  72. data: body,
  73. ...(options || {})
  74. }
  75. )
  76. }
  77. /** 删除智能体 POST /api/ai/agent/delete */
  78. export async function postAiAgentOpenApiDelete(
  79. body: {
  80. id: string
  81. },
  82. options?: { [key: string]: any }
  83. ) {
  84. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  85. '/api/ai/agent/delete',
  86. {
  87. method: 'POST',
  88. headers: {
  89. 'Content-Type': 'application/json'
  90. },
  91. data: body,
  92. ...(options || {})
  93. }
  94. )
  95. }
  96. /** 详情 POST /api/ai/agent/info */
  97. export async function postAiAgentInfo(
  98. body: {
  99. id: string
  100. },
  101. options?: { [key: string]: any }
  102. ) {
  103. return request<{
  104. isSuccess: boolean
  105. code: number
  106. result: {
  107. avatar: string
  108. config: {
  109. advanced_config: {
  110. enable_query_expansion: boolean
  111. enable_rewrite: boolean
  112. fallback_prompt: string
  113. fallback_response: string
  114. fallback_strategy: string
  115. rewrite_prompt_system: string
  116. rewrite_prompt_user: string
  117. }
  118. basic_config: {
  119. agent_mode: string
  120. agent_type: string
  121. context_template: string
  122. suggested_prompts: string[]
  123. system_prompt: string
  124. }
  125. faq_config: {
  126. faq_direct_answer_threshold: number
  127. faq_priority_enabled: boolean
  128. faq_score_boost: number
  129. }
  130. img_vlm_config: {
  131. image_storage_provider: string
  132. image_upload_enabled: boolean
  133. vlm_model_id: string
  134. }
  135. kb_config: {
  136. kb_selection_mode: string
  137. knowledge_bases: string[]
  138. retrieve_kb_only_when_mentioned: boolean
  139. supported_file_types: string[]
  140. }
  141. model_config: {
  142. max_completion_tokens: number
  143. model_id: string
  144. rerank_model_id: string
  145. temperature: number
  146. thinking: boolean
  147. }
  148. multiple_config: { history_turns: number; multi_turn_enabled: boolean }
  149. search_config: {
  150. embedding_top_k: number
  151. keyword_threshold: number
  152. rerank_threshold: number
  153. rerank_top_k: number
  154. vector_threshold: number
  155. }
  156. setting_config: {
  157. allowed_tools: string[]
  158. max_iterations: number
  159. mcp_selection_mode: string
  160. mcp_services: string[]
  161. selected_skills: string[]
  162. skills_selection_mode: string
  163. }
  164. web_search_config: {
  165. web_fetch_enabled: boolean
  166. web_fetch_top_n: number
  167. web_search_enabled: boolean
  168. web_search_max_results: number
  169. }
  170. }
  171. creationTime: string
  172. creatorUserId: string
  173. description: string
  174. id: string
  175. isDeleted: boolean
  176. is_builtin: boolean
  177. mode: string
  178. name: string
  179. type: string
  180. updateTime: string
  181. }
  182. isAuthorized: boolean
  183. }>('/api/ai/agent/info', {
  184. method: 'POST',
  185. headers: {
  186. 'Content-Type': 'application/json'
  187. },
  188. data: body,
  189. ...(options || {})
  190. })
  191. }
  192. /** 获取分页列表 POST /api/ai/agent/pageList */
  193. export async function postAiAgentPageList(
  194. body: {
  195. keyword: string
  196. mode: string
  197. type: string
  198. pageIndex: number
  199. pageSize: number
  200. },
  201. options?: { [key: string]: any }
  202. ) {
  203. return request<{
  204. isSuccess: boolean
  205. code: number
  206. result: {
  207. currentPage: number
  208. hasNextPage: boolean
  209. hasPreviousPage: boolean
  210. model: {
  211. avatar?: string
  212. config: {
  213. advanced_config: {
  214. enable_query_expansion: boolean
  215. enable_rewrite: boolean
  216. fallback_prompt: string
  217. fallback_response: string
  218. fallback_strategy: string
  219. rewrite_prompt_system: string
  220. rewrite_prompt_user: string
  221. }
  222. basic_config: {
  223. agent_mode: string
  224. agent_type: string
  225. context_template: string
  226. suggested_prompts: string[]
  227. system_prompt: string
  228. }
  229. faq_config: {
  230. faq_direct_answer_threshold: number
  231. faq_priority_enabled: boolean
  232. faq_score_boost: number
  233. }
  234. img_vlm_config: {
  235. image_storage_provider: string
  236. image_upload_enabled: boolean
  237. vlm_model_id: string
  238. }
  239. kb_config: {
  240. kb_selection_mode: string
  241. knowledge_bases: string[]
  242. retrieve_kb_only_when_mentioned: boolean
  243. supported_file_types: string[]
  244. }
  245. model_config: {
  246. max_completion_tokens: number
  247. model_id: string
  248. rerank_model_id: string
  249. temperature: number
  250. thinking: boolean
  251. }
  252. multiple_config: { history_turns: number; multi_turn_enabled: boolean }
  253. search_config: {
  254. embedding_top_k: number
  255. keyword_threshold: number
  256. rerank_threshold: number
  257. rerank_top_k: number
  258. vector_threshold: number
  259. }
  260. setting_config: {
  261. allowed_tools: string[]
  262. max_iterations: number
  263. mcp_selection_mode: string
  264. mcp_services: string[]
  265. selected_skills: string[]
  266. skills_selection_mode: string
  267. }
  268. web_search_config: {
  269. web_fetch_enabled: boolean
  270. web_fetch_top_n: number
  271. web_search_enabled: boolean
  272. web_search_max_results: number
  273. }
  274. }
  275. creationTime?: string
  276. creatorUserId?: string
  277. description?: string
  278. id?: string
  279. isDeleted?: boolean
  280. is_builtin?: boolean
  281. mode?: string
  282. name?: string
  283. type?: string
  284. updateTime?: string
  285. }[]
  286. pageSize: number
  287. totalCount: number
  288. totalPages: number
  289. }
  290. isAuthorized: boolean
  291. }>('/api/ai/agent/pageList', {
  292. method: 'POST',
  293. headers: {
  294. 'Content-Type': 'application/json'
  295. },
  296. data: body,
  297. ...(options || {})
  298. })
  299. }
  300. /** 获取智能体可以使用的工具列表 POST /api/ai/agent/tools */
  301. export async function postAiAgentTools(body: {}, options?: { [key: string]: any }) {
  302. return request<{
  303. isSuccess: boolean
  304. code: number
  305. result: { description: string; label: string; name: string }[]
  306. isAuthorized: boolean
  307. }>('/api/ai/agent/tools', {
  308. method: 'POST',
  309. headers: {
  310. 'Content-Type': 'application/json'
  311. },
  312. data: body,
  313. ...(options || {})
  314. })
  315. }
  316. /** 修改智能体 POST /api/ai/agent/update */
  317. export async function postAiAgentUpdate(
  318. body: {
  319. id: string
  320. name: string
  321. description: string
  322. avatar: string
  323. mode: string
  324. config: {
  325. basic_config: { system_prompt: string }
  326. model_config: {
  327. model_id: string
  328. rerank_model_id: string
  329. temperature: number
  330. max_completion_tokens: number
  331. thinking: boolean
  332. }
  333. setting_config: { max_iterations: number; mcp_selection_mode: string; mcp_services: string[] }
  334. kb_config: {
  335. kb_selection_mode: string
  336. knowledge_bases: string[]
  337. retrieve_kb_only_when_mentioned: boolean
  338. supported_file_types: string[]
  339. }
  340. img_vlm_config: {
  341. image_upload_enabled: boolean
  342. vlm_model_id: string
  343. image_storage_provider: string
  344. }
  345. faq_config: {
  346. faq_priority_enabled: boolean
  347. faq_direct_answer_threshold: number
  348. faq_score_boost: number
  349. }
  350. web_search_config: {
  351. web_search_enabled: boolean
  352. web_search_max_results: number
  353. web_search_provider_id: string
  354. web_fetch_enabled: boolean
  355. web_fetch_top_n: number
  356. }
  357. multiple_config: { multi_turn_enabled: boolean; history_turns: number }
  358. search_config: {
  359. embedding_top_k: number
  360. keyword_threshold: number
  361. vector_threshold: number
  362. rerank_top_k: number
  363. rerank_threshold: number
  364. }
  365. advanced_config: {
  366. enable_query_expansion: boolean
  367. enable_rewrite: boolean
  368. rewrite_prompt_system: string
  369. rewrite_prompt_user: string
  370. fallback_strategy: string
  371. fallback_response: string
  372. fallback_prompt: string
  373. }
  374. }
  375. },
  376. options?: { [key: string]: any }
  377. ) {
  378. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  379. '/api/ai/agent/update',
  380. {
  381. method: 'POST',
  382. headers: {
  383. 'Content-Type': 'application/json'
  384. },
  385. data: body,
  386. ...(options || {})
  387. }
  388. )
  389. }