resource.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807
  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. type?: string
  507. },
  508. options?: { [key: string]: any }
  509. ) {
  510. return request<{
  511. isSuccess: boolean
  512. code: number
  513. result: {
  514. currentPage: number
  515. hasNextPage: boolean
  516. hasPreviousPage: boolean
  517. model: {
  518. content: string
  519. creationTime: string
  520. default: boolean
  521. description: string
  522. has_knowledge_base: boolean
  523. has_web_search: boolean
  524. id: string
  525. isDeleted: boolean
  526. is_builtin: boolean
  527. mode: string
  528. name: string
  529. source: string
  530. type: string
  531. updateTime: string
  532. value: string
  533. user: string
  534. }[]
  535. pageSize: number
  536. totalCount: number
  537. totalPages: number
  538. }
  539. isAuthorized: boolean
  540. }>('/api/ai/prompt-template/pageList', {
  541. method: 'POST',
  542. headers: {
  543. 'Content-Type': 'application/json'
  544. },
  545. data: body,
  546. ...(options || {})
  547. })
  548. }
  549. /** 修改提示词与模版 POST /api/ai/prompt-template/update */
  550. export async function postPromptTemplateUpdate(
  551. body: {
  552. id: string
  553. name: string
  554. description: string
  555. content: string
  556. user: string
  557. type: string
  558. is_default: boolean
  559. has_knowledge_base: boolean
  560. has_web_search: boolean
  561. },
  562. options?: { [key: string]: any }
  563. ) {
  564. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  565. '/api/ai/prompt-template/update',
  566. {
  567. method: 'POST',
  568. headers: {
  569. 'Content-Type': 'application/json'
  570. },
  571. data: body,
  572. ...(options || {})
  573. }
  574. )
  575. }
  576. /** 获取支持的Skills列表 POST /api/ai/skills/list */
  577. export async function postSkillsList(body: {}, options?: { [key: string]: any }) {
  578. return request<{
  579. isSuccess: boolean
  580. code: number
  581. result: { description: string; name: string }[]
  582. isAuthorized: boolean
  583. }>('/api/ai/skills/list', {
  584. method: 'POST',
  585. headers: {
  586. 'Content-Type': 'application/json'
  587. },
  588. data: body,
  589. ...(options || {})
  590. })
  591. }
  592. /** 测试已保存的 Provider POST /api/ai/web-search/checkById */
  593. export async function postWebSearchCheckById(
  594. body: {
  595. id: string
  596. },
  597. options?: { [key: string]: any }
  598. ) {
  599. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  600. '/api/ai/web-search/checkById',
  601. {
  602. method: 'POST',
  603. headers: {
  604. 'Content-Type': 'application/json'
  605. },
  606. data: body,
  607. ...(options || {})
  608. }
  609. )
  610. }
  611. /** 使用原始凭证测试连通性 POST /api/ai/web-search/checkWithParameters */
  612. export async function postWebSearchCheckWithParameters(
  613. body: {
  614. provider: string
  615. parameters: { api_key: string; proxy_url: string; engine_id: string }
  616. },
  617. options?: { [key: string]: any }
  618. ) {
  619. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  620. '/api/ai/web-search/checkWithParameters',
  621. {
  622. method: 'POST',
  623. headers: {
  624. 'Content-Type': 'application/json'
  625. },
  626. data: body,
  627. ...(options || {})
  628. }
  629. )
  630. }
  631. /** 创建网络搜索厂商 POST /api/ai/web-search/create */
  632. export async function postWebSearchCreate(
  633. body: {
  634. provider: string
  635. name: string
  636. description: string
  637. is_default: boolean
  638. parameters: { proxy_url: string; api_key: string; engine_id: string }
  639. },
  640. options?: { [key: string]: any }
  641. ) {
  642. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  643. '/api/ai/web-search/create',
  644. {
  645. method: 'POST',
  646. headers: {
  647. 'Content-Type': 'application/json'
  648. },
  649. data: body,
  650. ...(options || {})
  651. }
  652. )
  653. }
  654. /** 删除网络搜索厂商 POST /api/ai/web-search/delete */
  655. export async function postWebSearchOpenApiDelete(
  656. body: {
  657. id: string
  658. },
  659. options?: { [key: string]: any }
  660. ) {
  661. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  662. '/api/ai/web-search/delete',
  663. {
  664. method: 'POST',
  665. headers: {
  666. 'Content-Type': 'application/json'
  667. },
  668. data: body,
  669. ...(options || {})
  670. }
  671. )
  672. }
  673. /** 获取支持的引擎列表 POST /api/ai/web-search/engines */
  674. export async function postWebSearchEngines(body: {}, options?: { [key: string]: any }) {
  675. return request<{
  676. isSuccess: boolean
  677. code: number
  678. result: {
  679. description: string
  680. docs_url: string
  681. id: string
  682. name: string
  683. requires_api_key: boolean
  684. requires_engine_id: boolean
  685. supports_proxy: boolean
  686. }[]
  687. isAuthorized: boolean
  688. }>('/api/ai/web-search/engines', {
  689. method: 'POST',
  690. headers: {
  691. 'Content-Type': 'application/json'
  692. },
  693. data: body,
  694. ...(options || {})
  695. })
  696. }
  697. /** 获取详情 POST /api/ai/web-search/info */
  698. export async function postWebSearchInfo(
  699. body: {
  700. id: string
  701. },
  702. options?: { [key: string]: any }
  703. ) {
  704. return request<{
  705. isSuccess: boolean
  706. code: number
  707. result: {
  708. creationTime: string
  709. creatorUserId: string
  710. description: string
  711. id: string
  712. isDeleted: boolean
  713. is_default: boolean
  714. name: string
  715. parameters: { api_key: string }
  716. provider: string
  717. updateTime: string
  718. }
  719. isAuthorized: boolean
  720. }>('/api/ai/web-search/info', {
  721. method: 'POST',
  722. headers: {
  723. 'Content-Type': 'application/json'
  724. },
  725. data: body,
  726. ...(options || {})
  727. })
  728. }
  729. /** 获取分页列表 POST /api/ai/web-search/pageList */
  730. export async function postWebSearchPageList(
  731. body: {
  732. keyword: string
  733. provider: string
  734. pageIndex: number
  735. pageSize?: number
  736. },
  737. options?: { [key: string]: any }
  738. ) {
  739. return request<{
  740. isSuccess: boolean
  741. code: number
  742. result: {
  743. currentPage: number
  744. hasNextPage: boolean
  745. hasPreviousPage: boolean
  746. model: string[]
  747. pageSize: number
  748. totalCount: number
  749. totalPages: number
  750. }
  751. isAuthorized: boolean
  752. }>('/api/ai/web-search/pageList', {
  753. method: 'POST',
  754. headers: {
  755. 'Content-Type': 'application/json'
  756. },
  757. data: body,
  758. ...(options || {})
  759. })
  760. }
  761. /** 更新网络搜索厂商 POST /api/ai/web-search/update */
  762. export async function postWebSearchUpdate(
  763. body: {
  764. id: string
  765. name: string
  766. description: string
  767. is_default: boolean
  768. parameters: { proxy_url: string; api_key: string; engine_id: string }
  769. },
  770. options?: { [key: string]: any }
  771. ) {
  772. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  773. '/api/ai/web-search/update',
  774. {
  775. method: 'POST',
  776. headers: {
  777. 'Content-Type': 'application/json'
  778. },
  779. data: body,
  780. ...(options || {})
  781. }
  782. )
  783. }