knowledge.ts 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import request from '@repo/api-client'
  4. /** 创建单个FAQ条目 POST /api/ai/faq/create */
  5. export async function postFaqCreate(
  6. body: {
  7. knowledge_base_id: string
  8. standard_question: string
  9. similar_questions: string[]
  10. negative_questions: string[]
  11. answers: string[]
  12. is_enabled: boolean
  13. },
  14. options?: { [key: string]: any }
  15. ) {
  16. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  17. '/api/ai/faq/create',
  18. {
  19. method: 'POST',
  20. headers: {
  21. 'Content-Type': 'application/json'
  22. },
  23. data: body,
  24. ...(options || {})
  25. }
  26. )
  27. }
  28. /** 删除单个FAQ条目 POST /api/ai/faq/delete */
  29. export async function postFaqOpenApiDelete(
  30. body: {
  31. id: string
  32. },
  33. options?: { [key: string]: any }
  34. ) {
  35. return request<Record<string, any>>('/api/ai/faq/delete', {
  36. method: 'POST',
  37. headers: {
  38. 'Content-Type': 'application/json'
  39. },
  40. data: body,
  41. ...(options || {})
  42. })
  43. }
  44. /** 详情 POST /api/ai/faq/info */
  45. export async function postFaqInfo(
  46. body: {
  47. id: string
  48. },
  49. options?: { [key: string]: any }
  50. ) {
  51. return request<{
  52. isSuccess: boolean
  53. code: number
  54. result: {
  55. answer_strategy: string
  56. answers: string[]
  57. chunk_id: string
  58. chunk_type: string
  59. creationTime: string
  60. creatorUserId: string
  61. id: string
  62. index_mode: string
  63. is_enabled: boolean
  64. is_recommended: boolean
  65. knowledge_base_id: string
  66. knowledge_id: string
  67. negative_questions: string[]
  68. similar_questions: string[]
  69. standard_question: string
  70. tag_id: string
  71. }
  72. isAuthorized: boolean
  73. }>('/api/ai/faq/info', {
  74. method: 'POST',
  75. headers: {
  76. 'Content-Type': 'application/json'
  77. },
  78. data: body,
  79. ...(options || {})
  80. })
  81. }
  82. /** 分页列表 POST /api/ai/faq/pageList */
  83. export async function postFaqPageList(
  84. body: {
  85. knowledge_base_id: string
  86. pageIndex: number
  87. pageSize: number
  88. keyword: string
  89. },
  90. options?: { [key: string]: any }
  91. ) {
  92. return request<{
  93. isSuccess: boolean
  94. code: number
  95. result: {
  96. currentPage: number
  97. hasNextPage: boolean
  98. hasPreviousPage: boolean
  99. model: {
  100. answer_strategy?: string
  101. answers?: string[]
  102. chunk_id?: string
  103. chunk_type?: string
  104. creationTime?: string
  105. creatorUserId?: string
  106. id?: string
  107. index_mode?: string
  108. is_enabled?: boolean
  109. is_recommended?: boolean
  110. knowledge_base_id?: string
  111. knowledge_id?: string
  112. negative_questions?: string[]
  113. similar_questions?: string[]
  114. standard_question?: string
  115. tag_id?: string
  116. }[]
  117. pageSize: number
  118. totalCount: number
  119. totalPages: number
  120. }
  121. isAuthorized: boolean
  122. }>('/api/ai/faq/pageList', {
  123. method: 'POST',
  124. headers: {
  125. 'Content-Type': 'application/json'
  126. },
  127. data: body,
  128. ...(options || {})
  129. })
  130. }
  131. /** 更新单个FAQ条目 POST /api/ai/faq/update */
  132. export async function postFaqUpdate(
  133. body: {
  134. id: string
  135. standard_question: string
  136. similar_questions: string[]
  137. negative_questions: string[]
  138. answers: string[]
  139. is_enabled: boolean
  140. },
  141. options?: { [key: string]: any }
  142. ) {
  143. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  144. '/api/ai/faq/update',
  145. {
  146. method: 'POST',
  147. headers: {
  148. 'Content-Type': 'application/json'
  149. },
  150. data: body,
  151. ...(options || {})
  152. }
  153. )
  154. }
  155. /** 创建知识库 POST /api/ai/knowledge-base/create */
  156. export async function postKnowledgeBaseCreate(
  157. body: {
  158. name: string
  159. description: string
  160. type: string
  161. wiki_config: {
  162. extraction_granularity: string
  163. max_pages_per_ingest: number
  164. synthesis_model_id: string
  165. }
  166. indexing_strategy: {
  167. graph_enabled: boolean
  168. keyword_enabled: boolean
  169. vector_enabled: boolean
  170. wiki_enabled: boolean
  171. }
  172. chunking_config: {
  173. chunk_size: number
  174. chunk_overlap: number
  175. separators: string[]
  176. parser_engine_rules: { engine: string; file_types: string[] }[]
  177. enable_parent_child: boolean
  178. parent_chunk_size: number
  179. child_chunk_size: number
  180. }
  181. embedding_model_id: string
  182. summary_model_id: string
  183. vlm_config: { model_id: string; enabled: boolean }
  184. asr_config: { model_id: string; language: string; enabled: boolean }
  185. storage_provider_config: { provider: string }
  186. storage_config: { provider: string }
  187. question_generation_config: { enabled: boolean; question_count: number }
  188. },
  189. options?: { [key: string]: any }
  190. ) {
  191. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  192. '/api/ai/knowledge-base/create',
  193. {
  194. method: 'POST',
  195. headers: {
  196. 'Content-Type': 'application/json'
  197. },
  198. data: body,
  199. ...(options || {})
  200. }
  201. )
  202. }
  203. /** 删除知识库 POST /api/ai/knowledge-base/delete */
  204. export async function postKnowledgeBaseOpenApiDelete(
  205. body: {
  206. id: string
  207. },
  208. options?: { [key: string]: any }
  209. ) {
  210. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  211. '/api/ai/knowledge-base/delete',
  212. {
  213. method: 'POST',
  214. headers: {
  215. 'Content-Type': 'application/json'
  216. },
  217. data: body,
  218. ...(options || {})
  219. }
  220. )
  221. }
  222. /** 混合搜索 (FAQ) POST /api/ai/knowledge-base/faq_hybrid_search */
  223. export async function postKnowledgeBaseFaqHybridSearch(
  224. body: {
  225. knowledge_base_id: string
  226. query_text: string
  227. vector_threshold: number
  228. match_count: number
  229. },
  230. options?: { [key: string]: any }
  231. ) {
  232. return request<{
  233. isSuccess: boolean
  234. code: number
  235. result: {
  236. answer_strategy?: string
  237. answers?: string[]
  238. chunk_id?: string
  239. chunk_type?: string
  240. creationTime?: string
  241. creatorUserId?: string
  242. id?: string
  243. index_mode?: string
  244. is_enabled?: boolean
  245. is_recommended?: boolean
  246. knowledge_base_id?: string
  247. knowledge_id?: string
  248. negative_questions?: string[]
  249. score?: number
  250. similar_questions?: string[]
  251. standard_question?: string
  252. tag_id?: string
  253. }[]
  254. isAuthorized: boolean
  255. }>('/api/ai/knowledge-base/faq_hybrid_search', {
  256. method: 'POST',
  257. headers: {
  258. 'Content-Type': 'application/json'
  259. },
  260. data: body,
  261. ...(options || {})
  262. })
  263. }
  264. /** 混合搜索 POST /api/ai/knowledge-base/hybrid_search */
  265. export async function postKnowledgeBaseHybridSearch(
  266. body: {
  267. id: string
  268. query_text: string
  269. vector_threshold: number
  270. keyword_threshold: number
  271. match_count: number
  272. },
  273. options?: { [key: string]: any }
  274. ) {
  275. return request<{ isSuccess: boolean; code: number; result: string[]; isAuthorized: boolean }>(
  276. '/api/ai/knowledge-base/hybrid_search',
  277. {
  278. method: 'POST',
  279. headers: {
  280. 'Content-Type': 'application/json'
  281. },
  282. data: body,
  283. ...(options || {})
  284. }
  285. )
  286. }
  287. /** 根据ids,混合搜索 POST /api/ai/knowledge-base/hybrid_search_ids */
  288. export async function postKnowledgeBaseHybridSearchIds(
  289. body: {
  290. query: string
  291. knowledge_base_ids: string[]
  292. knowledge_ids: string[]
  293. },
  294. options?: { [key: string]: any }
  295. ) {
  296. return request<{
  297. isSuccess: boolean
  298. code: number
  299. result: {
  300. chunk_index?: string
  301. chunk_metadata: { generated_questions: { id: string; question: string }[] }
  302. chunk_type?: string
  303. content?: string
  304. end_at?: number
  305. id?: string
  306. image_info?: string
  307. knowledge_base_id?: string
  308. knowledge_channel?: string
  309. knowledge_filename?: string
  310. knowledge_id?: string
  311. knowledge_source?: string
  312. knowledge_title?: string
  313. match_type?: number
  314. metadata: { base_score: string }
  315. parent_chunk_id?: string
  316. score?: number
  317. seq?: number
  318. start_at?: number
  319. sub_chunk_id?: string[]
  320. }[]
  321. isAuthorized: boolean
  322. }>('/api/ai/knowledge-base/hybrid_search_ids', {
  323. method: 'POST',
  324. headers: {
  325. 'Content-Type': 'application/json'
  326. },
  327. data: body,
  328. ...(options || {})
  329. })
  330. }
  331. /** 知识库详情 POST /api/ai/knowledge-base/info */
  332. export async function postKnowledgeBaseInfo(
  333. body: {
  334. id: string
  335. },
  336. options?: { [key: string]: any }
  337. ) {
  338. return request<{
  339. isSuccess: boolean
  340. code: number
  341. result: {
  342. asr_config: { enabled: boolean; language: string; model_id: string }
  343. chunking_config: {
  344. child_chunk_size: number
  345. chunk_overlap: number
  346. chunk_size: number
  347. enable_parent_child: boolean
  348. parent_chunk_size: number
  349. parser_engine_rules: { engine: string; file_types: string[] }[]
  350. separators: string[]
  351. }
  352. creationTime: string
  353. creatorUserId: string
  354. description: string
  355. embedding_model_id: string
  356. faq_config: { index_mode: string; question_index_mode: string }
  357. id: string
  358. indexing_strategy: {
  359. graph_enabled: boolean
  360. keyword_enabled: boolean
  361. vector_enabled: boolean
  362. wiki_enabled: boolean
  363. }
  364. isDeleted: boolean
  365. is_pinned: boolean
  366. is_temporary: boolean
  367. name: string
  368. question_generation_config: { enabled: boolean; question_count: number }
  369. storage_config: { provider: string }
  370. storage_provider_config: { provider: string }
  371. summary_model_id: string
  372. type: string
  373. updateTime: string
  374. vlm_config: { enabled: boolean; model_id: string }
  375. wiki_config: {
  376. extraction_granularity: string
  377. max_pages_per_ingest: number
  378. synthesis_model_id: string
  379. }
  380. }
  381. isAuthorized: boolean
  382. }>('/api/ai/knowledge-base/info', {
  383. method: 'POST',
  384. headers: {
  385. 'Content-Type': 'application/json'
  386. },
  387. data: body,
  388. ...(options || {})
  389. })
  390. }
  391. /** 获取知识库分页列表 POST /api/ai/knowledge-base/pageList */
  392. export async function postKnowledgeBasePageList(
  393. body: {
  394. keyword: string
  395. type: string
  396. pageIndex: number
  397. pageSize: number
  398. },
  399. options?: { [key: string]: any }
  400. ) {
  401. return request<{
  402. isSuccess: boolean
  403. code: number
  404. result: {
  405. currentPage: number
  406. hasNextPage: boolean
  407. hasPreviousPage: boolean
  408. model: {
  409. asr_config: { enabled: boolean; language: string; model_id: string }
  410. chunking_config: {
  411. child_chunk_size: number
  412. chunk_overlap: number
  413. chunk_size: number
  414. enable_parent_child: boolean
  415. parent_chunk_size: number
  416. parser_engine_rules: { engine: string; file_types: string[] }[]
  417. separators: string[]
  418. }
  419. creationTime: string
  420. creatorUserId: string
  421. description: string
  422. embedding_model_id: string
  423. faq_config: { index_mode: string; question_index_mode: string }
  424. id: string
  425. indexing_strategy: {
  426. graph_enabled: boolean
  427. keyword_enabled: boolean
  428. vector_enabled: boolean
  429. wiki_enabled: boolean
  430. }
  431. isDeleted: boolean
  432. is_pinned: boolean
  433. is_temporary: boolean
  434. name: string
  435. question_generation_config: { enabled: boolean; question_count: number }
  436. storage_config: { provider: string }
  437. storage_provider_config: { provider: string }
  438. summary_model_id: string
  439. type: string
  440. updateTime: string
  441. vlm_config: { enabled: boolean; model_id: string }
  442. wiki_config: {
  443. extraction_granularity: string
  444. max_pages_per_ingest: number
  445. synthesis_model_id: string
  446. }
  447. extract_config: { enabled: boolean }
  448. }[]
  449. pageSize: number
  450. totalCount: number
  451. totalPages: number
  452. }
  453. isAuthorized: boolean
  454. }>('/api/ai/knowledge-base/pageList', {
  455. method: 'POST',
  456. headers: {
  457. 'Content-Type': 'application/json'
  458. },
  459. data: body,
  460. ...(options || {})
  461. })
  462. }
  463. /** 更新知识库 POST /api/ai/knowledge-base/update */
  464. export async function postKnowledgeBaseUpdate(
  465. body: {
  466. id: string
  467. name: string
  468. description: string
  469. wiki_config: {
  470. extraction_granularity: string
  471. max_pages_per_ingest: number
  472. synthesis_model_id: string
  473. }
  474. indexing_strategy: {
  475. graph_enabled: boolean
  476. keyword_enabled: boolean
  477. vector_enabled: boolean
  478. wiki_enabled: boolean
  479. }
  480. chunking_config: {
  481. chunk_size: number
  482. chunk_overlap: number
  483. separators: string[]
  484. parser_engine_rules: { engine: string; file_types: string[] }[]
  485. enable_parent_child: boolean
  486. parent_chunk_size: number
  487. child_chunk_size: number
  488. }
  489. embedding_model_id: string
  490. summary_model_id: string
  491. vlm_config: { model_id: string; enabled: boolean }
  492. asr_config: { model_id: string; language: string; enabled: boolean }
  493. storage_provider_config: { provider: string }
  494. storage_config: { provider: string }
  495. question_generation_config: { enabled: boolean; question_count: number }
  496. },
  497. options?: { [key: string]: any }
  498. ) {
  499. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  500. '/api/ai/knowledge-base/update',
  501. {
  502. method: 'POST',
  503. headers: {
  504. 'Content-Type': 'application/json'
  505. },
  506. data: body,
  507. ...(options || {})
  508. }
  509. )
  510. }
  511. /** 创建来自文件的知识 POST /api/ai/knowledge/createWithFile */
  512. export async function postKnowledgeCreateWithFile(
  513. body: {
  514. knowledge_base_id: string
  515. fileId: string
  516. metadata: Record<string, any>
  517. enable_multi_model: boolean
  518. },
  519. options?: { [key: string]: any }
  520. ) {
  521. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  522. '/api/ai/knowledge/createWithFile',
  523. {
  524. method: 'POST',
  525. headers: {
  526. 'Content-Type': 'application/json'
  527. },
  528. data: body,
  529. ...(options || {})
  530. }
  531. )
  532. }
  533. /** 创建自定义知识 POST /api/ai/knowledge/createWithManual */
  534. export async function postKnowledgeCreateWithManual(
  535. body: {
  536. knowledge_base_id: string
  537. title: string
  538. content: string
  539. publish: boolean
  540. },
  541. options?: { [key: string]: any }
  542. ) {
  543. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  544. '/api/ai/knowledge/createWithManual',
  545. {
  546. method: 'POST',
  547. headers: {
  548. 'Content-Type': 'application/json'
  549. },
  550. data: body,
  551. ...(options || {})
  552. }
  553. )
  554. }
  555. /** 删除知识 POST /api/ai/knowledge/delete */
  556. export async function postKnowledgeOpenApiDelete(
  557. body: {
  558. id: string
  559. },
  560. options?: { [key: string]: any }
  561. ) {
  562. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  563. '/api/ai/knowledge/delete',
  564. {
  565. method: 'POST',
  566. headers: {
  567. 'Content-Type': 'application/json'
  568. },
  569. data: body,
  570. ...(options || {})
  571. }
  572. )
  573. }
  574. /** 获取知识分页列表 POST /api/ai/knowledge/pageList */
  575. export async function postKnowledgePageList(
  576. body: {
  577. knowledge_base_id: string
  578. title: string
  579. file_type: string
  580. pageIndex: number
  581. pageSize: number
  582. },
  583. options?: { [key: string]: any }
  584. ) {
  585. return request<{
  586. isSuccess: boolean
  587. code: number
  588. result: {
  589. currentPage: number
  590. hasNextPage: boolean
  591. hasPreviousPage: boolean
  592. model: {
  593. channel?: string
  594. creationTime?: string
  595. description?: string
  596. embedding_model_id?: string
  597. enable_status?: string
  598. error_message?: string
  599. file_hash?: string
  600. file_name?: string
  601. file_path?: string
  602. file_size?: number
  603. file_type?: string
  604. id?: string
  605. isDeleted?: boolean
  606. knowledge_base_id?: string
  607. metadata?: Record<string, any>
  608. parse_status?: string
  609. source?: string
  610. storage_size?: number
  611. summary_status?: string
  612. tag_id?: string
  613. title?: string
  614. type?: string
  615. updateTime?: string
  616. }[]
  617. pageSize: number
  618. totalCount: number
  619. totalPages: number
  620. }
  621. isAuthorized: boolean
  622. }>('/api/ai/knowledge/pageList', {
  623. method: 'POST',
  624. headers: {
  625. 'Content-Type': 'application/json'
  626. },
  627. data: body,
  628. ...(options || {})
  629. })
  630. }
  631. /** 重新解析知识 POST /api/ai/knowledge/reparse */
  632. export async function postKnowledgeReparse(
  633. body: {
  634. id: string
  635. },
  636. options?: { [key: string]: any }
  637. ) {
  638. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  639. '/api/ai/knowledge/reparse',
  640. {
  641. method: 'POST',
  642. headers: {
  643. 'Content-Type': 'application/json'
  644. },
  645. data: body,
  646. ...(options || {})
  647. }
  648. )
  649. }
  650. /** 更新知识 POST /api/ai/knowledge/update */
  651. export async function postKnowledgeUpdate(
  652. body: {
  653. id: string
  654. title: string
  655. description: string
  656. },
  657. options?: { [key: string]: any }
  658. ) {
  659. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  660. '/api/ai/knowledge/update',
  661. {
  662. method: 'POST',
  663. headers: {
  664. 'Content-Type': 'application/json'
  665. },
  666. data: body,
  667. ...(options || {})
  668. }
  669. )
  670. }