vector.ts 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import request from '@repo/api-client'
  4. /** 使用原始凭据测试连接 POST /api/ai/vector-store/connect_test_config */
  5. export async function postConnectTestConfig(
  6. body: {
  7. engine_type: string
  8. connection_config: { addr: string; username: string; password: string }
  9. },
  10. options?: { [key: string]: any }
  11. ) {
  12. return request<{
  13. isSuccess: boolean
  14. code: number
  15. result: { version: string }
  16. isAuthorized: boolean
  17. }>('/api/ai/vector-store/connect_test_config', {
  18. method: 'POST',
  19. headers: {
  20. 'Content-Type': 'application/json'
  21. },
  22. data: body,
  23. ...(options || {})
  24. })
  25. }
  26. /** 测试已保存或环境变量存储的连接 POST /api/ai/vector-store/connect_test_id */
  27. export async function postConnectTestId(
  28. body: {
  29. id: string
  30. },
  31. options?: { [key: string]: any }
  32. ) {
  33. return request<{
  34. isSuccess: boolean
  35. code: number
  36. result: { version: string }
  37. isAuthorized: boolean
  38. }>('/api/ai/vector-store/connect_test_id', {
  39. method: 'POST',
  40. headers: {
  41. 'Content-Type': 'application/json'
  42. },
  43. data: body,
  44. ...(options || {})
  45. })
  46. }
  47. /** 创建向量存储 POST /api/ai/vector-store/create */
  48. export async function postCreate(
  49. body: {
  50. name: string
  51. engine_type: string
  52. connection_config: { addr: string; username: string; password: string }
  53. index_config: { index_name: string; number_of_shards: number; number_of_replicas: number }
  54. },
  55. options?: { [key: string]: any }
  56. ) {
  57. return request<{
  58. isSuccess: boolean
  59. code: number
  60. result: {
  61. connection_config: { addr: string; version: string; username: string }
  62. creationTime: string
  63. creatorUserId: string
  64. engine_type: string
  65. id: string
  66. index_config: { number_of_shards: number; index_name: string; number_of_replicas: number }
  67. isDeleted: boolean
  68. name: string
  69. source: string
  70. updateTime: string
  71. userId: string
  72. }
  73. isAuthorized: boolean
  74. }>('/api/ai/vector-store/create', {
  75. method: 'POST',
  76. headers: {
  77. 'Content-Type': 'application/json'
  78. },
  79. data: body,
  80. ...(options || {})
  81. })
  82. }
  83. /** 删除向量存储 POST /api/ai/vector-store/delete */
  84. export async function postOpenApiDelete(
  85. body: {
  86. id: string
  87. },
  88. options?: { [key: string]: any }
  89. ) {
  90. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  91. '/api/ai/vector-store/delete',
  92. {
  93. method: 'POST',
  94. headers: {
  95. 'Content-Type': 'application/json'
  96. },
  97. data: body,
  98. ...(options || {})
  99. }
  100. )
  101. }
  102. /** 获取详情 POST /api/ai/vector-store/info */
  103. export async function postInfo(
  104. body: {
  105. id: string
  106. },
  107. options?: { [key: string]: any }
  108. ) {
  109. return request<{
  110. isSuccess: boolean
  111. code: number
  112. result: {
  113. connection_config: { addr: string; version: string; username: string }
  114. creationTime: string
  115. creatorUserId: string
  116. engine_type: string
  117. id: string
  118. index_config: { number_of_shards: number; index_name: string; number_of_replicas: number }
  119. isDeleted: boolean
  120. name: string
  121. source: string
  122. updateTime: string
  123. userId: string
  124. }
  125. isAuthorized: boolean
  126. }>('/api/ai/vector-store/info', {
  127. method: 'POST',
  128. headers: {
  129. 'Content-Type': 'application/json'
  130. },
  131. data: body,
  132. ...(options || {})
  133. })
  134. }
  135. /** 获取分页列表 POST /api/ai/vector-store/pageList */
  136. export async function postPageList(
  137. body: {
  138. keyword: string
  139. pageIndex: number
  140. pageSize: number
  141. },
  142. options?: { [key: string]: any }
  143. ) {
  144. return request<{
  145. isSuccess: boolean
  146. code: number
  147. result: {
  148. connection_fields: {
  149. default: string
  150. description: string
  151. immutable: boolean
  152. name: string
  153. required: boolean
  154. sensitive: boolean
  155. type: string
  156. }[]
  157. display_name: string
  158. index_fields: {
  159. default: string
  160. description: string
  161. immutable: boolean
  162. name: string
  163. required: boolean
  164. sensitive: boolean
  165. type: string
  166. max: number
  167. min: number
  168. enum?: string[]
  169. }[]
  170. type: string
  171. }[]
  172. isAuthorized: boolean
  173. }>('/api/ai/vector-store/pageList', {
  174. method: 'POST',
  175. headers: {
  176. 'Content-Type': 'application/json'
  177. },
  178. data: body,
  179. ...(options || {})
  180. })
  181. }
  182. /** 获取向量选择列表 POST /api/ai/vector-store/selectList */
  183. export async function postSelectList(
  184. body: {
  185. keyword?: string
  186. },
  187. options?: { [key: string]: any }
  188. ) {
  189. return request<{
  190. isSuccess: boolean
  191. code: number
  192. result: {
  193. connection_fields: {
  194. default: string
  195. description: string
  196. immutable: boolean
  197. name: string
  198. required: boolean
  199. sensitive: boolean
  200. type: string
  201. }[]
  202. display_name: string
  203. index_fields: {
  204. default: string
  205. description: string
  206. immutable: boolean
  207. name: string
  208. required: boolean
  209. sensitive: boolean
  210. type: string
  211. max: number
  212. min: number
  213. enum?: string[]
  214. }[]
  215. type: string
  216. }[]
  217. isAuthorized: boolean
  218. }>('/api/ai/vector-store/selectList', {
  219. method: 'POST',
  220. headers: {
  221. 'Content-Type': 'application/json'
  222. },
  223. data: body,
  224. ...(options || {})
  225. })
  226. }
  227. /** 获取支持的向量存储类型列表 POST /api/ai/vector-store/types */
  228. export async function postTypes(body: {}, options?: { [key: string]: any }) {
  229. return request<{
  230. isSuccess: boolean
  231. code: number
  232. result: {
  233. connection_fields: {
  234. default: string
  235. description: string
  236. immutable: boolean
  237. name: string
  238. required: boolean
  239. sensitive: boolean
  240. type: string
  241. }[]
  242. display_name: string
  243. index_fields: {
  244. default: string
  245. description: string
  246. immutable: boolean
  247. name: string
  248. required: boolean
  249. sensitive: boolean
  250. type: string
  251. max: number
  252. min: number
  253. enum?: string[]
  254. }[]
  255. type: string
  256. }[]
  257. isAuthorized: boolean
  258. }>('/api/ai/vector-store/types', {
  259. method: 'POST',
  260. headers: {
  261. 'Content-Type': 'application/json'
  262. },
  263. data: body,
  264. ...(options || {})
  265. })
  266. }
  267. /** 更新向量存储 POST /api/ai/vector-store/update */
  268. export async function postUpdate(
  269. body: {
  270. id: string
  271. name: string
  272. },
  273. options?: { [key: string]: any }
  274. ) {
  275. return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
  276. '/api/ai/vector-store/update',
  277. {
  278. method: 'POST',
  279. headers: {
  280. 'Content-Type': 'application/json'
  281. },
  282. data: body,
  283. ...(options || {})
  284. }
  285. )
  286. }