resource.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import request from '@repo/api-client'
  4. /** 测试MCP服务连接 POST /api/ai/mcp/check */
  5. export async function postMcpCheck(
  6. body: {
  7. id: string
  8. },
  9. options?: { [key: string]: any }
  10. ) {
  11. return request<{
  12. isSuccess: boolean
  13. code: number
  14. result: {
  15. message: string
  16. tools: {
  17. description: string
  18. inputSchema: {
  19. type: string
  20. properties: {
  21. value: { description: string; type: string }
  22. usn: { description: string; type: string }
  23. loginType: { description: string; type: string }
  24. loginWay: { description: string; type: string }
  25. pwd: { description: string; type: string }
  26. token: { description: string; type: string }
  27. }
  28. required: string[]
  29. }
  30. name: string
  31. }[]
  32. }
  33. isAuthorized: boolean
  34. }>('/api/ai/mcp/check', {
  35. method: 'POST',
  36. headers: {
  37. 'Content-Type': 'application/json'
  38. },
  39. data: body,
  40. ...(options || {})
  41. })
  42. }
  43. /** 创建MCP POST /api/ai/mcp/create */
  44. export async function postMcpCreate(
  45. body: {
  46. name: string
  47. description: string
  48. transport_type: string
  49. url: string
  50. enabled: boolean
  51. headers: Record<string, any>
  52. auth_config: Record<string, any>
  53. advanced_config: { timeout: number; retry_count: number; retry_delay: number }
  54. env_vars: Record<string, any>
  55. },
  56. options?: { [key: string]: any }
  57. ) {
  58. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  59. '/api/ai/mcp/create',
  60. {
  61. method: 'POST',
  62. headers: {
  63. 'Content-Type': 'application/json'
  64. },
  65. data: body,
  66. ...(options || {})
  67. }
  68. )
  69. }
  70. /** 删除MCP POST /api/ai/mcp/delete */
  71. export async function postMcpOpenApiDelete(
  72. body: {
  73. id: string
  74. },
  75. options?: { [key: string]: any }
  76. ) {
  77. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  78. '/api/ai/mcp/delete',
  79. {
  80. method: 'POST',
  81. headers: {
  82. 'Content-Type': 'application/json'
  83. },
  84. data: body,
  85. ...(options || {})
  86. }
  87. )
  88. }
  89. /** 获取详情 POST /api/ai/mcp/info */
  90. export async function postMcpInfo(
  91. body: {
  92. id: string
  93. },
  94. options?: { [key: string]: any }
  95. ) {
  96. return request<{
  97. isSuccess: boolean
  98. code: number
  99. result: {
  100. advanced_config: { retry_count: number; retry_delay: number; timeout: number }
  101. auth_config: Record<string, any>
  102. creationTime: string
  103. creatorUserId: string
  104. description: string
  105. enabled: boolean
  106. env_vars: Record<string, any>
  107. headers: Record<string, any>
  108. id: string
  109. isDeleted: boolean
  110. is_builtin: boolean
  111. name: string
  112. stdio_config: { command: string }
  113. transport_type: string
  114. updateTime: string
  115. url: string
  116. }
  117. isAuthorized: boolean
  118. }>('/api/ai/mcp/info', {
  119. method: 'POST',
  120. headers: {
  121. 'Content-Type': 'application/json'
  122. },
  123. data: body,
  124. ...(options || {})
  125. })
  126. }
  127. /** 获取分页列表 POST /api/ai/mcp/pageList */
  128. export async function postMcpPageList(
  129. body: {
  130. keyword: string
  131. transport_type: string
  132. pageIndex: number
  133. pageSize: number
  134. },
  135. options?: { [key: string]: any }
  136. ) {
  137. return request<{
  138. isSuccess: boolean
  139. code: number
  140. result: {
  141. currentPage: number
  142. hasNextPage: boolean
  143. hasPreviousPage: boolean
  144. model: {
  145. advanced_config: { retry_count: number; retry_delay: number; timeout: number }
  146. auth_config?: Record<string, any>
  147. creationTime?: string
  148. creatorUserId?: string
  149. description?: string
  150. enabled?: boolean
  151. env_vars?: Record<string, any>
  152. headers?: Record<string, any>
  153. id?: string
  154. isDeleted?: boolean
  155. is_builtin?: boolean
  156. name?: string
  157. stdio_config: { command: string }
  158. transport_type?: string
  159. updateTime?: string
  160. url?: string
  161. }[]
  162. pageSize: number
  163. totalCount: number
  164. totalPages: number
  165. }
  166. isAuthorized: boolean
  167. }>('/api/ai/mcp/pageList', {
  168. method: 'POST',
  169. headers: {
  170. 'Content-Type': 'application/json'
  171. },
  172. data: body,
  173. ...(options || {})
  174. })
  175. }
  176. /** 获取MCP服务资源表 POST /api/ai/mcp/resources */
  177. export async function postMcpResources(
  178. body: {
  179. id: string
  180. },
  181. options?: { [key: string]: any }
  182. ) {
  183. return request<{ isSuccess: boolean; code: number; result: string[]; isAuthorized: boolean }>(
  184. '/api/ai/mcp/resources',
  185. {
  186. method: 'POST',
  187. headers: {
  188. 'Content-Type': 'application/json'
  189. },
  190. data: body,
  191. ...(options || {})
  192. }
  193. )
  194. }
  195. /** 获取MCP服务工具列表 POST /api/ai/mcp/tools */
  196. export async function postMcpTools(
  197. body: {
  198. id: string
  199. },
  200. options?: { [key: string]: any }
  201. ) {
  202. return request<{
  203. isSuccess: boolean
  204. code: number
  205. result: {
  206. description: string
  207. inputSchema: {
  208. type: string
  209. properties: {
  210. value: { description: string; type: string }
  211. token: { description: string; type: string }
  212. usn: { description: string; type: string }
  213. loginType: { description: string; type: string }
  214. loginWay: { description: string; type: string }
  215. pwd: { description: string; type: string }
  216. }
  217. required: string[]
  218. }
  219. name: string
  220. }[]
  221. isAuthorized: boolean
  222. }>('/api/ai/mcp/tools', {
  223. method: 'POST',
  224. headers: {
  225. 'Content-Type': 'application/json'
  226. },
  227. data: body,
  228. ...(options || {})
  229. })
  230. }
  231. /** 更新MCP POST /api/ai/mcp/update */
  232. export async function postMcpUpdate(
  233. body: {
  234. id: string
  235. name: string
  236. description: string
  237. transport_type: string
  238. url: string
  239. enabled: boolean
  240. headers: Record<string, any>
  241. auth_config: Record<string, any>
  242. advanced_config: { timeout: number; retry_count: number; retry_delay: number }
  243. env_vars: Record<string, any>
  244. },
  245. options?: { [key: string]: any }
  246. ) {
  247. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  248. '/api/ai/mcp/update',
  249. {
  250. method: 'POST',
  251. headers: {
  252. 'Content-Type': 'application/json'
  253. },
  254. data: body,
  255. ...(options || {})
  256. }
  257. )
  258. }
  259. /** 获取系统提示词及模版信息 POST /api/ai/prompt-template/config */
  260. export async function postPromptTemplateConfig(body: {}, options?: { [key: string]: any }) {
  261. return request<{
  262. isSuccess: boolean
  263. code: number
  264. result: {
  265. agent_system_prompts: {
  266. content: string
  267. creationTime: string
  268. default: boolean
  269. description: string
  270. has_knowledge_base: boolean
  271. has_web_search: boolean
  272. id: string
  273. isDeleted: boolean
  274. is_builtin: boolean
  275. mode: string
  276. name: string
  277. type: string
  278. updateTime: string
  279. value: string
  280. }[]
  281. context_templates: {
  282. content: string
  283. creationTime: string
  284. default: boolean
  285. description: string
  286. has_knowledge_base: boolean
  287. has_web_search: boolean
  288. id: string
  289. isDeleted: boolean
  290. is_builtin: boolean
  291. mode: string
  292. name: string
  293. type: string
  294. updateTime: string
  295. value: string
  296. }[]
  297. defaultSystemAgentPrompt: {
  298. content: string
  299. creationTime: string
  300. default: boolean
  301. description: string
  302. has_knowledge_base: boolean
  303. has_web_search: boolean
  304. id: string
  305. isDeleted: boolean
  306. is_builtin: boolean
  307. mode: string
  308. name: string
  309. type: string
  310. updateTime: string
  311. value: string
  312. }
  313. defaultSystemContextTemplate: {
  314. content: string
  315. creationTime: string
  316. default: boolean
  317. description: string
  318. has_knowledge_base: boolean
  319. has_web_search: boolean
  320. id: string
  321. isDeleted: boolean
  322. is_builtin: boolean
  323. mode: string
  324. name: string
  325. type: string
  326. updateTime: string
  327. value: string
  328. }
  329. defaultSystemFallBack: {
  330. content: string
  331. creationTime: string
  332. default: boolean
  333. description: string
  334. has_knowledge_base: boolean
  335. has_web_search: boolean
  336. id: string
  337. isDeleted: boolean
  338. is_builtin: boolean
  339. mode: string
  340. name: string
  341. type: string
  342. updateTime: string
  343. value: string
  344. }
  345. defaultSystemPrompt: {
  346. content: string
  347. creationTime: string
  348. default: boolean
  349. description: string
  350. has_knowledge_base: boolean
  351. has_web_search: boolean
  352. id: string
  353. isDeleted: boolean
  354. is_builtin: boolean
  355. mode: string
  356. name: string
  357. type: string
  358. updateTime: string
  359. value: string
  360. }
  361. defaultSystemRewrite: {
  362. content: string
  363. creationTime: string
  364. default: boolean
  365. description: string
  366. has_knowledge_base: boolean
  367. has_web_search: boolean
  368. id: string
  369. isDeleted: boolean
  370. is_builtin: boolean
  371. mode: string
  372. name: string
  373. type: string
  374. updateTime: string
  375. user: string
  376. value: string
  377. }
  378. fall_backs: {
  379. content: string
  380. creationTime: string
  381. default: boolean
  382. description: string
  383. has_knowledge_base: boolean
  384. has_web_search: boolean
  385. id: string
  386. isDeleted: boolean
  387. is_builtin: boolean
  388. mode: string
  389. name: string
  390. type: string
  391. updateTime: string
  392. value: string
  393. }[]
  394. rewrites: {
  395. content: string
  396. creationTime: string
  397. default: boolean
  398. description: string
  399. has_knowledge_base: boolean
  400. has_web_search: boolean
  401. id: string
  402. isDeleted: boolean
  403. is_builtin: boolean
  404. mode: string
  405. name: string
  406. type: string
  407. updateTime: string
  408. user: string
  409. value: string
  410. }[]
  411. system_prompts: {
  412. content: string
  413. creationTime: string
  414. default: boolean
  415. description: string
  416. has_knowledge_base: boolean
  417. has_web_search: boolean
  418. id: string
  419. isDeleted: boolean
  420. is_builtin: boolean
  421. mode: string
  422. name: string
  423. type: string
  424. updateTime: string
  425. value: string
  426. }[]
  427. }
  428. isAuthorized: boolean
  429. }>('/api/ai/prompt-template/config', {
  430. method: 'POST',
  431. headers: {
  432. 'Content-Type': 'application/json'
  433. },
  434. data: body,
  435. ...(options || {})
  436. })
  437. }
  438. /** 创建提示词与模版 POST /api/ai/prompt-template/create */
  439. export async function postPromptTemplateCreate(
  440. body: {
  441. name: string
  442. description: string
  443. content: string
  444. user: string
  445. type: string
  446. is_default: boolean
  447. has_knowledge_base: boolean
  448. has_web_search: boolean
  449. },
  450. options?: { [key: string]: any }
  451. ) {
  452. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  453. '/api/ai/prompt-template/create',
  454. {
  455. method: 'POST',
  456. headers: {
  457. 'Content-Type': 'application/json'
  458. },
  459. data: body,
  460. ...(options || {})
  461. }
  462. )
  463. }
  464. /** 删除提示词与模版 POST /api/ai/prompt-template/delete */
  465. export async function postPromptTemplateOpenApiDelete(
  466. body: {
  467. id: string
  468. },
  469. options?: { [key: string]: any }
  470. ) {
  471. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  472. '/api/ai/prompt-template/delete',
  473. {
  474. method: 'POST',
  475. headers: {
  476. 'Content-Type': 'application/json'
  477. },
  478. data: body,
  479. ...(options || {})
  480. }
  481. )
  482. }
  483. /** 初始化系统内置提示词和模版 POST /api/ai/prompt-template/initPromptContext */
  484. export async function postPromptTemplateInitPromptContext(
  485. body: {},
  486. options?: { [key: string]: any }
  487. ) {
  488. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  489. '/api/ai/prompt-template/initPromptContext',
  490. {
  491. method: 'POST',
  492. headers: {
  493. 'Content-Type': 'application/json'
  494. },
  495. data: body,
  496. ...(options || {})
  497. }
  498. )
  499. }
  500. /** 获取分页列表 POST /api/ai/prompt-template/pageList */
  501. export async function postPromptTemplatePageList(
  502. body: {
  503. keyword: string
  504. pageIndex: number
  505. pageSize: number
  506. },
  507. options?: { [key: string]: any }
  508. ) {
  509. return request<{
  510. isSuccess: boolean
  511. code: number
  512. result: {
  513. currentPage: number
  514. hasNextPage: boolean
  515. hasPreviousPage: boolean
  516. model: {
  517. content: string
  518. creationTime: string
  519. default: boolean
  520. description: string
  521. has_knowledge_base: boolean
  522. has_web_search: boolean
  523. id: string
  524. isDeleted: boolean
  525. is_builtin: boolean
  526. mode: string
  527. name: string
  528. source: string
  529. type: string
  530. updateTime: string
  531. value: string
  532. user: string
  533. }[]
  534. pageSize: number
  535. totalCount: number
  536. totalPages: number
  537. }
  538. isAuthorized: boolean
  539. }>('/api/ai/prompt-template/pageList', {
  540. method: 'POST',
  541. headers: {
  542. 'Content-Type': 'application/json'
  543. },
  544. data: body,
  545. ...(options || {})
  546. })
  547. }
  548. /** 修改提示词与模版 POST /api/ai/prompt-template/update */
  549. export async function postPromptTemplateUpdate(
  550. body: {
  551. id: string
  552. name: string
  553. description: string
  554. content: string
  555. user: string
  556. type: string
  557. is_default: boolean
  558. has_knowledge_base: boolean
  559. has_web_search: boolean
  560. },
  561. options?: { [key: string]: any }
  562. ) {
  563. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  564. '/api/ai/prompt-template/update',
  565. {
  566. method: 'POST',
  567. headers: {
  568. 'Content-Type': 'application/json'
  569. },
  570. data: body,
  571. ...(options || {})
  572. }
  573. )
  574. }
  575. /** 获取支持的Skills列表 POST /api/ai/skills/list */
  576. export async function postSkillsList(body: {}, options?: { [key: string]: any }) {
  577. return request<{
  578. isSuccess: boolean
  579. code: number
  580. result: { description: string; name: string }[]
  581. isAuthorized: boolean
  582. }>('/api/ai/skills/list', {
  583. method: 'POST',
  584. headers: {
  585. 'Content-Type': 'application/json'
  586. },
  587. data: body,
  588. ...(options || {})
  589. })
  590. }
  591. /** 测试已保存的 Provider POST /api/ai/web-search/checkById */
  592. export async function postWebSearchCheckById(
  593. body: {
  594. id: string
  595. },
  596. options?: { [key: string]: any }
  597. ) {
  598. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  599. '/api/ai/web-search/checkById',
  600. {
  601. method: 'POST',
  602. headers: {
  603. 'Content-Type': 'application/json'
  604. },
  605. data: body,
  606. ...(options || {})
  607. }
  608. )
  609. }
  610. /** 使用原始凭证测试连通性 POST /api/ai/web-search/checkWithParameters */
  611. export async function postWebSearchCheckWithParameters(
  612. body: {
  613. provider: string
  614. parameters: { api_key: string; proxy_url: string; engine_id: string }
  615. },
  616. options?: { [key: string]: any }
  617. ) {
  618. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  619. '/api/ai/web-search/checkWithParameters',
  620. {
  621. method: 'POST',
  622. headers: {
  623. 'Content-Type': 'application/json'
  624. },
  625. data: body,
  626. ...(options || {})
  627. }
  628. )
  629. }
  630. /** 创建网络搜索厂商 POST /api/ai/web-search/create */
  631. export async function postWebSearchCreate(
  632. body: {
  633. provider: string
  634. name: string
  635. description: string
  636. is_default: boolean
  637. parameters: { proxy_url: string; api_key: string; engine_id: string }
  638. },
  639. options?: { [key: string]: any }
  640. ) {
  641. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  642. '/api/ai/web-search/create',
  643. {
  644. method: 'POST',
  645. headers: {
  646. 'Content-Type': 'application/json'
  647. },
  648. data: body,
  649. ...(options || {})
  650. }
  651. )
  652. }
  653. /** 删除网络搜索厂商 POST /api/ai/web-search/delete */
  654. export async function postWebSearchOpenApiDelete(
  655. body: {
  656. id: string
  657. },
  658. options?: { [key: string]: any }
  659. ) {
  660. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  661. '/api/ai/web-search/delete',
  662. {
  663. method: 'POST',
  664. headers: {
  665. 'Content-Type': 'application/json'
  666. },
  667. data: body,
  668. ...(options || {})
  669. }
  670. )
  671. }
  672. /** 获取支持的引擎列表 POST /api/ai/web-search/engines */
  673. export async function postWebSearchEngines(body: {}, options?: { [key: string]: any }) {
  674. return request<{
  675. isSuccess: boolean
  676. code: number
  677. result: {
  678. description: string
  679. docs_url: string
  680. id: string
  681. name: string
  682. requires_api_key: boolean
  683. requires_engine_id: boolean
  684. supports_proxy: boolean
  685. }[]
  686. isAuthorized: boolean
  687. }>('/api/ai/web-search/engines', {
  688. method: 'POST',
  689. headers: {
  690. 'Content-Type': 'application/json'
  691. },
  692. data: body,
  693. ...(options || {})
  694. })
  695. }
  696. /** 获取详情 POST /api/ai/web-search/info */
  697. export async function postWebSearchInfo(
  698. body: {
  699. id: string
  700. },
  701. options?: { [key: string]: any }
  702. ) {
  703. return request<{
  704. isSuccess: boolean
  705. code: number
  706. result: {
  707. creationTime: string
  708. creatorUserId: string
  709. description: string
  710. id: string
  711. isDeleted: boolean
  712. is_default: boolean
  713. name: string
  714. parameters: { api_key: string }
  715. provider: string
  716. updateTime: string
  717. }
  718. isAuthorized: boolean
  719. }>('/api/ai/web-search/info', {
  720. method: 'POST',
  721. headers: {
  722. 'Content-Type': 'application/json'
  723. },
  724. data: body,
  725. ...(options || {})
  726. })
  727. }
  728. /** 获取分页列表 POST /api/ai/web-search/pageList */
  729. export async function postWebSearchPageList(
  730. body: {
  731. keyword: string
  732. provider: string
  733. pageIndex: number
  734. pageSize?: number
  735. },
  736. options?: { [key: string]: any }
  737. ) {
  738. return request<{
  739. isSuccess: boolean
  740. code: number
  741. result: {
  742. currentPage: number
  743. hasNextPage: boolean
  744. hasPreviousPage: boolean
  745. model: string[]
  746. pageSize: number
  747. totalCount: number
  748. totalPages: number
  749. }
  750. isAuthorized: boolean
  751. }>('/api/ai/web-search/pageList', {
  752. method: 'POST',
  753. headers: {
  754. 'Content-Type': 'application/json'
  755. },
  756. data: body,
  757. ...(options || {})
  758. })
  759. }
  760. /** 更新网络搜索厂商 POST /api/ai/web-search/update */
  761. export async function postWebSearchUpdate(
  762. body: {
  763. id: string
  764. name: string
  765. description: string
  766. is_default: boolean
  767. parameters: { proxy_url: string; api_key: string; engine_id: string }
  768. },
  769. options?: { [key: string]: any }
  770. ) {
  771. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  772. '/api/ai/web-search/update',
  773. {
  774. method: 'POST',
  775. headers: {
  776. 'Content-Type': 'application/json'
  777. },
  778. data: body,
  779. ...(options || {})
  780. }
  781. )
  782. }