agentApplication.ts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  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/group-tools */
  97. export async function postAiAgentGroupTools(body: {}, options?: { [key: string]: any }) {
  98. return request<{
  99. isSuccess: boolean
  100. code: number
  101. result: { name: string; tools: { description: string; label: string; name: string }[] }[]
  102. isAuthorized: boolean
  103. }>('/api/ai/agent/group-tools', {
  104. method: 'POST',
  105. headers: {
  106. 'Content-Type': 'application/json'
  107. },
  108. data: body,
  109. ...(options || {})
  110. })
  111. }
  112. /** 详情 POST /api/ai/agent/info */
  113. export async function postAiAgentInfo(
  114. body: {
  115. id: string
  116. },
  117. options?: { [key: string]: any }
  118. ) {
  119. return request<{
  120. isSuccess: boolean
  121. code: number
  122. result: {
  123. avatar: string
  124. config: {
  125. advanced_config: {
  126. enable_query_expansion: boolean
  127. enable_rewrite: boolean
  128. fallback_prompt: string
  129. fallback_response: string
  130. fallback_strategy: string
  131. rewrite_prompt_system: string
  132. rewrite_prompt_user: string
  133. }
  134. basic_config: {
  135. agent_mode: string
  136. agent_type: string
  137. context_template: string
  138. suggested_prompts: string[]
  139. system_prompt: string
  140. }
  141. faq_config: {
  142. faq_direct_answer_threshold: number
  143. faq_priority_enabled: boolean
  144. faq_score_boost: number
  145. }
  146. img_vlm_config: {
  147. image_storage_provider: string
  148. image_upload_enabled: boolean
  149. vlm_model_id: string
  150. }
  151. kb_config: {
  152. kb_selection_mode: string
  153. knowledge_bases: string[]
  154. retrieve_kb_only_when_mentioned: boolean
  155. supported_file_types: string[]
  156. }
  157. model_config: {
  158. max_completion_tokens: number
  159. model_id: string
  160. rerank_model_id: string
  161. temperature: number
  162. thinking: boolean
  163. }
  164. multiple_config: { history_turns: number; multi_turn_enabled: boolean }
  165. search_config: {
  166. embedding_top_k: number
  167. keyword_threshold: number
  168. rerank_threshold: number
  169. rerank_top_k: number
  170. vector_threshold: number
  171. }
  172. setting_config: {
  173. allowed_tools: string[]
  174. max_iterations: number
  175. mcp_selection_mode: string
  176. mcp_services: string[]
  177. selected_skills: string[]
  178. skills_selection_mode: string
  179. }
  180. web_search_config: {
  181. web_fetch_enabled: boolean
  182. web_fetch_top_n: number
  183. web_search_enabled: boolean
  184. web_search_max_results: number
  185. }
  186. }
  187. creationTime: string
  188. creatorUserId: string
  189. description: string
  190. id: string
  191. isDeleted: boolean
  192. is_builtin: boolean
  193. mode: string
  194. name: string
  195. type: string
  196. updateTime: string
  197. }
  198. isAuthorized: boolean
  199. }>('/api/ai/agent/info', {
  200. method: 'POST',
  201. headers: {
  202. 'Content-Type': 'application/json'
  203. },
  204. data: body,
  205. ...(options || {})
  206. })
  207. }
  208. /** 获取分页列表 POST /api/ai/agent/pageList */
  209. export async function postAiAgentPageList(
  210. body: {
  211. keyword: string
  212. mode: string
  213. type: string
  214. pageIndex: number
  215. pageSize: number
  216. },
  217. options?: { [key: string]: any }
  218. ) {
  219. return request<{
  220. isSuccess: boolean
  221. code: number
  222. result: {
  223. currentPage: number
  224. hasNextPage: boolean
  225. hasPreviousPage: boolean
  226. model: {
  227. avatar?: string
  228. config: {
  229. advanced_config: {
  230. enable_query_expansion: boolean
  231. enable_rewrite: boolean
  232. fallback_prompt: string
  233. fallback_response: string
  234. fallback_strategy: string
  235. rewrite_prompt_system: string
  236. rewrite_prompt_user: string
  237. }
  238. basic_config: {
  239. agent_mode: string
  240. agent_type: string
  241. context_template: string
  242. suggested_prompts: string[]
  243. system_prompt: string
  244. }
  245. faq_config: {
  246. faq_direct_answer_threshold: number
  247. faq_priority_enabled: boolean
  248. faq_score_boost: number
  249. }
  250. img_vlm_config: {
  251. image_storage_provider: string
  252. image_upload_enabled: boolean
  253. vlm_model_id: string
  254. }
  255. kb_config: {
  256. kb_selection_mode: string
  257. knowledge_bases: string[]
  258. retrieve_kb_only_when_mentioned: boolean
  259. supported_file_types: string[]
  260. }
  261. model_config: {
  262. max_completion_tokens: number
  263. model_id: string
  264. rerank_model_id: string
  265. temperature: number
  266. thinking: boolean
  267. }
  268. multiple_config: { history_turns: number; multi_turn_enabled: boolean }
  269. search_config: {
  270. embedding_top_k: number
  271. keyword_threshold: number
  272. rerank_threshold: number
  273. rerank_top_k: number
  274. vector_threshold: number
  275. }
  276. setting_config: {
  277. allowed_tools: string[]
  278. max_iterations: number
  279. mcp_selection_mode: string
  280. mcp_services: string[]
  281. selected_skills: string[]
  282. skills_selection_mode: string
  283. }
  284. web_search_config: {
  285. web_fetch_enabled: boolean
  286. web_fetch_top_n: number
  287. web_search_enabled: boolean
  288. web_search_max_results: number
  289. }
  290. }
  291. creationTime?: string
  292. creatorUserId?: string
  293. description?: string
  294. id?: string
  295. isDeleted?: boolean
  296. is_builtin?: boolean
  297. mode?: string
  298. name?: string
  299. type?: string
  300. updateTime?: string
  301. }[]
  302. pageSize: number
  303. totalCount: number
  304. totalPages: number
  305. }
  306. isAuthorized: boolean
  307. }>('/api/ai/agent/pageList', {
  308. method: 'POST',
  309. headers: {
  310. 'Content-Type': 'application/json'
  311. },
  312. data: body,
  313. ...(options || {})
  314. })
  315. }
  316. /** 获取智能体选择列表 POST /api/ai/agent/selectList */
  317. export async function postAiAgentSelectList(
  318. body: {
  319. keyword?: string
  320. mode?: string
  321. type?: string
  322. },
  323. options?: { [key: string]: any }
  324. ) {
  325. return request<{
  326. isSuccess: boolean
  327. code: number
  328. result: {
  329. avatar?: string
  330. config: {
  331. advanced_config: {
  332. enable_query_expansion: boolean
  333. enable_rewrite: boolean
  334. fallback_prompt: string
  335. fallback_response: string
  336. fallback_strategy: string
  337. rewrite_prompt_system: string
  338. rewrite_prompt_user: string
  339. }
  340. basic_config: {
  341. agent_mode: string
  342. agent_type: string
  343. context_template: string
  344. suggested_prompts: string[]
  345. system_prompt: string
  346. }
  347. model_config: { max_completion_tokens: number; model_id: string; temperature: number }
  348. }
  349. creationTime?: string
  350. creatorUserId?: string
  351. description?: string
  352. id?: string
  353. isDeleted?: boolean
  354. is_builtin?: boolean
  355. mode?: string
  356. name?: string
  357. type?: string
  358. updateTime?: string
  359. }[]
  360. isAuthorized: boolean
  361. }>('/api/ai/agent/selectList', {
  362. method: 'POST',
  363. headers: {
  364. 'Content-Type': 'application/json'
  365. },
  366. data: body,
  367. ...(options || {})
  368. })
  369. }
  370. /** 获取智能体建议提问列表 POST /api/ai/agent/suggested-questions */
  371. export async function postAiAgentSuggestedQuestions(
  372. body: {
  373. id: string
  374. limit: number
  375. },
  376. options?: { [key: string]: any }
  377. ) {
  378. return request<{
  379. isSuccess: boolean
  380. code: number
  381. result: { knowledge_base_id: string; question: string; source: string }[]
  382. isAuthorized: boolean
  383. }>('/api/ai/agent/suggested-questions', {
  384. method: 'POST',
  385. headers: {
  386. 'Content-Type': 'application/json'
  387. },
  388. data: body,
  389. ...(options || {})
  390. })
  391. }
  392. /** 获取智能体可以使用的工具列表 POST /api/ai/agent/tools */
  393. export async function postAiAgentTools(body: {}, options?: { [key: string]: any }) {
  394. return request<{
  395. isSuccess: boolean
  396. code: number
  397. result: { description: string; label: string; name: string }[]
  398. isAuthorized: boolean
  399. }>('/api/ai/agent/tools', {
  400. method: 'POST',
  401. headers: {
  402. 'Content-Type': 'application/json'
  403. },
  404. data: body,
  405. ...(options || {})
  406. })
  407. }
  408. /** 修改智能体 POST /api/ai/agent/update */
  409. export async function postAiAgentUpdate(
  410. body: {
  411. id: string
  412. name: string
  413. description: string
  414. avatar: string
  415. mode: string
  416. config: {
  417. basic_config: { system_prompt: string }
  418. model_config: {
  419. model_id: string
  420. rerank_model_id: string
  421. temperature: number
  422. max_completion_tokens: number
  423. thinking: boolean
  424. }
  425. setting_config: { max_iterations: number; mcp_selection_mode: string; mcp_services: string[] }
  426. kb_config: {
  427. kb_selection_mode: string
  428. knowledge_bases: string[]
  429. retrieve_kb_only_when_mentioned: boolean
  430. supported_file_types: string[]
  431. }
  432. img_vlm_config: {
  433. image_upload_enabled: boolean
  434. vlm_model_id: string
  435. image_storage_provider: string
  436. }
  437. faq_config: {
  438. faq_priority_enabled: boolean
  439. faq_direct_answer_threshold: number
  440. faq_score_boost: number
  441. }
  442. web_search_config: {
  443. web_search_enabled: boolean
  444. web_search_max_results: number
  445. web_search_provider_id: string
  446. web_fetch_enabled: boolean
  447. web_fetch_top_n: number
  448. }
  449. multiple_config: { multi_turn_enabled: boolean; history_turns: number }
  450. search_config: {
  451. embedding_top_k: number
  452. keyword_threshold: number
  453. vector_threshold: number
  454. rerank_top_k: number
  455. rerank_threshold: number
  456. }
  457. advanced_config: {
  458. enable_query_expansion: boolean
  459. enable_rewrite: boolean
  460. rewrite_prompt_system: string
  461. rewrite_prompt_user: string
  462. fallback_strategy: string
  463. fallback_response: string
  464. fallback_prompt: string
  465. }
  466. }
  467. },
  468. options?: { [key: string]: any }
  469. ) {
  470. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  471. '/api/ai/agent/update',
  472. {
  473. method: 'POST',
  474. headers: {
  475. 'Content-Type': 'application/json'
  476. },
  477. data: body,
  478. ...(options || {})
  479. }
  480. )
  481. }