agentApplication.ts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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/suggested-questions */
  317. export async function postAiAgentSuggestedQuestions(
  318. body: {
  319. id: string
  320. limit: number
  321. },
  322. options?: { [key: string]: any }
  323. ) {
  324. return request<{
  325. isSuccess: boolean
  326. code: number
  327. result: { knowledge_base_id: string; question: string; source: string }[]
  328. isAuthorized: boolean
  329. }>('/api/ai/agent/suggested-questions', {
  330. method: 'POST',
  331. headers: {
  332. 'Content-Type': 'application/json'
  333. },
  334. data: body,
  335. ...(options || {})
  336. })
  337. }
  338. /** 获取智能体可以使用的工具列表 POST /api/ai/agent/tools */
  339. export async function postAiAgentTools(body: {}, options?: { [key: string]: any }) {
  340. return request<{
  341. isSuccess: boolean
  342. code: number
  343. result: { description: string; label: string; name: string }[]
  344. isAuthorized: boolean
  345. }>('/api/ai/agent/tools', {
  346. method: 'POST',
  347. headers: {
  348. 'Content-Type': 'application/json'
  349. },
  350. data: body,
  351. ...(options || {})
  352. })
  353. }
  354. /** 修改智能体 POST /api/ai/agent/update */
  355. export async function postAiAgentUpdate(
  356. body: {
  357. id: string
  358. name: string
  359. description: string
  360. avatar: string
  361. mode: string
  362. config: {
  363. basic_config: { system_prompt: string }
  364. model_config: {
  365. model_id: string
  366. rerank_model_id: string
  367. temperature: number
  368. max_completion_tokens: number
  369. thinking: boolean
  370. }
  371. setting_config: { max_iterations: number; mcp_selection_mode: string; mcp_services: string[] }
  372. kb_config: {
  373. kb_selection_mode: string
  374. knowledge_bases: string[]
  375. retrieve_kb_only_when_mentioned: boolean
  376. supported_file_types: string[]
  377. }
  378. img_vlm_config: {
  379. image_upload_enabled: boolean
  380. vlm_model_id: string
  381. image_storage_provider: string
  382. }
  383. faq_config: {
  384. faq_priority_enabled: boolean
  385. faq_direct_answer_threshold: number
  386. faq_score_boost: number
  387. }
  388. web_search_config: {
  389. web_search_enabled: boolean
  390. web_search_max_results: number
  391. web_search_provider_id: string
  392. web_fetch_enabled: boolean
  393. web_fetch_top_n: number
  394. }
  395. multiple_config: { multi_turn_enabled: boolean; history_turns: number }
  396. search_config: {
  397. embedding_top_k: number
  398. keyword_threshold: number
  399. vector_threshold: number
  400. rerank_top_k: number
  401. rerank_threshold: number
  402. }
  403. advanced_config: {
  404. enable_query_expansion: boolean
  405. enable_rewrite: boolean
  406. rewrite_prompt_system: string
  407. rewrite_prompt_user: string
  408. fallback_strategy: string
  409. fallback_response: string
  410. fallback_prompt: string
  411. }
  412. }
  413. },
  414. options?: { [key: string]: any }
  415. ) {
  416. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  417. '/api/ai/agent/update',
  418. {
  419. method: 'POST',
  420. headers: {
  421. 'Content-Type': 'application/json'
  422. },
  423. data: body,
  424. ...(options || {})
  425. }
  426. )
  427. }