@dxpos/knowledge 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,24 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
  import { formDataBodySerializer } from './client';
3
3
  import { client } from './client.gen';
4
+ /**
5
+ * 批量删除文件
6
+ *
7
+ * 需编辑者及以上。
8
+ */
9
+ export const deleteApiFiles = (options) => (options.client ?? client).delete({
10
+ security: [{ scheme: 'bearer', type: 'http' }, {
11
+ in: 'cookie',
12
+ name: 'authjs.session-token',
13
+ type: 'apiKey'
14
+ }],
15
+ url: '/api/files',
16
+ ...options,
17
+ headers: {
18
+ 'Content-Type': 'application/json',
19
+ ...options.headers
20
+ }
21
+ });
4
22
  /**
5
23
  * 列出文件
6
24
  */
@@ -121,7 +139,7 @@ export const getApiFilesByIdUrl = (options) => (options.client ?? client).get({
121
139
  /**
122
140
  * RAG 问答
123
141
  *
124
- * stream 默认 true,返回 NDJSON 事件流:token / node / references / done / error。stream=false 时返回 JSON 信封,data 为完整回答与引用。
142
+ * stream 默认 true,返回 NDJSON 事件流:token / node / references / done / error。stream=false 时返回 JSON 信封,data 为完整回答与引用。attachments 为已上传的对话图片 fileId,实际上限由配置决定,默认 4。content 与 attachments 至少传一项。排队已满或等待超时时返回 429,响应头带 Retry-After。
125
143
  */
126
144
  export const postApiChat = (options) => (options.client ?? client).post({
127
145
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -137,39 +155,23 @@ export const postApiChat = (options) => (options.client ?? client).post({
137
155
  }
138
156
  });
139
157
  /**
140
- * 读取对话模块设置
158
+ * 读取会话生效的图片限制与欢迎语
141
159
  *
142
- * 需编辑者及以上。空字段表示继承全局设置。
160
+ * 按会话 > RAG 配置 > 全局 > 代码默认合并图片数量上限与压缩最长边;并返回生效的欢迎语与推荐问题(RAG > 全局)。
143
161
  */
144
- export const getApiChatSettings = (options) => (options?.client ?? client).get({
162
+ export const getApiChatLimits = (options) => (options.client ?? client).get({
145
163
  security: [{ scheme: 'bearer', type: 'http' }, {
146
164
  in: 'cookie',
147
165
  name: 'authjs.session-token',
148
166
  type: 'apiKey'
149
167
  }],
150
- url: '/api/chat/settings',
168
+ url: '/api/chat/limits',
151
169
  ...options
152
170
  });
153
- /**
154
- * 更新对话模块设置
155
- *
156
- * 需编辑者及以上。空字段表示继承全局设置。
157
- */
158
- export const putApiChatSettings = (options) => (options.client ?? client).put({
159
- security: [{ scheme: 'bearer', type: 'http' }, {
160
- in: 'cookie',
161
- name: 'authjs.session-token',
162
- type: 'apiKey'
163
- }],
164
- url: '/api/chat/settings',
165
- ...options,
166
- headers: {
167
- 'Content-Type': 'application/json',
168
- ...options.headers
169
- }
170
- });
171
171
  /**
172
172
  * 列出会话
173
+ *
174
+ * 管理员可传 userId 查看指定用户会话;ragId 可按 RAG 过滤。
173
175
  */
174
176
  export const getApiChatConversations = (options) => (options?.client ?? client).get({
175
177
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -240,6 +242,8 @@ export const patchApiChatConversationsById = (options) => (options.client ?? cli
240
242
  });
241
243
  /**
242
244
  * 关键词检索文档
245
+ *
246
+ * kbId 与 mark 不能同时为空,同时传入按 AND 匹配。
243
247
  */
244
248
  export const getApiSearch = (options) => (options.client ?? client).get({
245
249
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -250,3 +254,345 @@ export const getApiSearch = (options) => (options.client ?? client).get({
250
254
  url: '/api/search',
251
255
  ...options
252
256
  });
257
+ /**
258
+ * 上报检索结果点击
259
+ */
260
+ export const postApiSearchClick = (options) => (options.client ?? client).post({
261
+ security: [{ scheme: 'bearer', type: 'http' }, {
262
+ in: 'cookie',
263
+ name: 'authjs.session-token',
264
+ type: 'apiKey'
265
+ }],
266
+ url: '/api/search/click',
267
+ ...options,
268
+ headers: {
269
+ 'Content-Type': 'application/json',
270
+ ...options.headers
271
+ }
272
+ });
273
+ /**
274
+ * 列出知识库
275
+ */
276
+ export const getApiKnowledgeBases = (options) => (options?.client ?? client).get({
277
+ security: [{ scheme: 'bearer', type: 'http' }, {
278
+ in: 'cookie',
279
+ name: 'authjs.session-token',
280
+ type: 'apiKey'
281
+ }],
282
+ url: '/api/knowledge-bases',
283
+ ...options
284
+ });
285
+ /**
286
+ * 创建知识库
287
+ *
288
+ * 需管理员。mark 为知识库唯一标识,不可包含逗号。
289
+ */
290
+ export const postApiKnowledgeBases = (options) => (options.client ?? client).post({
291
+ security: [{ scheme: 'bearer', type: 'http' }, {
292
+ in: 'cookie',
293
+ name: 'authjs.session-token',
294
+ type: 'apiKey'
295
+ }],
296
+ url: '/api/knowledge-bases',
297
+ ...options,
298
+ headers: {
299
+ 'Content-Type': 'application/json',
300
+ ...options.headers
301
+ }
302
+ });
303
+ /**
304
+ * 删除知识库
305
+ *
306
+ * 需管理员。删除会级联清理其下文档与分块。
307
+ */
308
+ export const deleteApiKnowledgeBasesById = (options) => (options.client ?? client).delete({
309
+ security: [{ scheme: 'bearer', type: 'http' }, {
310
+ in: 'cookie',
311
+ name: 'authjs.session-token',
312
+ type: 'apiKey'
313
+ }],
314
+ url: '/api/knowledge-bases/{id}',
315
+ ...options
316
+ });
317
+ /**
318
+ * 获取知识库
319
+ */
320
+ export const getApiKnowledgeBasesById = (options) => (options.client ?? client).get({
321
+ security: [{ scheme: 'bearer', type: 'http' }, {
322
+ in: 'cookie',
323
+ name: 'authjs.session-token',
324
+ type: 'apiKey'
325
+ }],
326
+ url: '/api/knowledge-bases/{id}',
327
+ ...options
328
+ });
329
+ /**
330
+ * 更新知识库
331
+ *
332
+ * 需管理员。
333
+ */
334
+ export const patchApiKnowledgeBasesById = (options) => (options.client ?? client).patch({
335
+ security: [{ scheme: 'bearer', type: 'http' }, {
336
+ in: 'cookie',
337
+ name: 'authjs.session-token',
338
+ type: 'apiKey'
339
+ }],
340
+ url: '/api/knowledge-bases/{id}',
341
+ ...options,
342
+ headers: {
343
+ 'Content-Type': 'application/json',
344
+ ...options.headers
345
+ }
346
+ });
347
+ /**
348
+ * 列出 RAG 配置
349
+ */
350
+ export const getApiRags = (options) => (options?.client ?? client).get({
351
+ security: [{ scheme: 'bearer', type: 'http' }, {
352
+ in: 'cookie',
353
+ name: 'authjs.session-token',
354
+ type: 'apiKey'
355
+ }],
356
+ url: '/api/rags',
357
+ ...options
358
+ });
359
+ /**
360
+ * 创建 RAG 配置
361
+ *
362
+ * 绑定知识库与对话模块配置。mark 不可包含逗号。
363
+ */
364
+ export const postApiRags = (options) => (options.client ?? client).post({
365
+ security: [{ scheme: 'bearer', type: 'http' }, {
366
+ in: 'cookie',
367
+ name: 'authjs.session-token',
368
+ type: 'apiKey'
369
+ }],
370
+ url: '/api/rags',
371
+ ...options,
372
+ headers: {
373
+ 'Content-Type': 'application/json',
374
+ ...options.headers
375
+ }
376
+ });
377
+ /**
378
+ * 删除 RAG 配置
379
+ */
380
+ export const deleteApiRagsById = (options) => (options.client ?? client).delete({
381
+ security: [{ scheme: 'bearer', type: 'http' }, {
382
+ in: 'cookie',
383
+ name: 'authjs.session-token',
384
+ type: 'apiKey'
385
+ }],
386
+ url: '/api/rags/{id}',
387
+ ...options
388
+ });
389
+ /**
390
+ * 获取 RAG 配置
391
+ */
392
+ export const getApiRagsById = (options) => (options.client ?? client).get({
393
+ security: [{ scheme: 'bearer', type: 'http' }, {
394
+ in: 'cookie',
395
+ name: 'authjs.session-token',
396
+ type: 'apiKey'
397
+ }],
398
+ url: '/api/rags/{id}',
399
+ ...options
400
+ });
401
+ /**
402
+ * 更新 RAG 配置
403
+ *
404
+ * 空字段表示继承全局默认。
405
+ */
406
+ export const patchApiRagsById = (options) => (options.client ?? client).patch({
407
+ security: [{ scheme: 'bearer', type: 'http' }, {
408
+ in: 'cookie',
409
+ name: 'authjs.session-token',
410
+ type: 'apiKey'
411
+ }],
412
+ url: '/api/rags/{id}',
413
+ ...options,
414
+ headers: {
415
+ 'Content-Type': 'application/json',
416
+ ...options.headers
417
+ }
418
+ });
419
+ /**
420
+ * 按 id / mark 获取 RAG 配置摘要
421
+ *
422
+ * id 与 mark 不能同时为空,同时传入按 AND 匹配。返回 id/name/mark/welcome/recommendedQuestions。
423
+ */
424
+ export const getApiRagsDetail = (options) => (options?.client ?? client).get({
425
+ security: [{ scheme: 'bearer', type: 'http' }, {
426
+ in: 'cookie',
427
+ name: 'authjs.session-token',
428
+ type: 'apiKey'
429
+ }],
430
+ url: '/api/rags/detail',
431
+ ...options
432
+ });
433
+ /**
434
+ * 清空知识库文档
435
+ *
436
+ * 需编辑者及以上。按 kbId 清空该知识库全部文档与分块。
437
+ */
438
+ export const deleteApiDocuments = (options) => (options.client ?? client).delete({
439
+ security: [{ scheme: 'bearer', type: 'http' }, {
440
+ in: 'cookie',
441
+ name: 'authjs.session-token',
442
+ type: 'apiKey'
443
+ }],
444
+ url: '/api/documents',
445
+ ...options
446
+ });
447
+ /**
448
+ * 列出知识库文档
449
+ */
450
+ export const getApiDocuments = (options) => (options.client ?? client).get({
451
+ security: [{ scheme: 'bearer', type: 'http' }, {
452
+ in: 'cookie',
453
+ name: 'authjs.session-token',
454
+ type: 'apiKey'
455
+ }],
456
+ url: '/api/documents',
457
+ ...options
458
+ });
459
+ /**
460
+ * 创建空白文档或上传 Markdown
461
+ *
462
+ * Content-Type 为 application/json 时创建空白文档(kbId 由 query 传入);为 multipart/form-data 时上传 Markdown 文件,返回 NDJSON 进度事件流。需编辑者及以上。
463
+ */
464
+ export const postApiDocuments = (options) => (options.client ?? client).post({
465
+ security: [{ scheme: 'bearer', type: 'http' }, {
466
+ in: 'cookie',
467
+ name: 'authjs.session-token',
468
+ type: 'apiKey'
469
+ }],
470
+ url: '/api/documents',
471
+ ...options,
472
+ headers: {
473
+ 'Content-Type': 'application/json',
474
+ ...options.headers
475
+ }
476
+ });
477
+ /**
478
+ * 按知识库 mark 获取文档树
479
+ *
480
+ * 仅支持 mark 查询,返回嵌套文档树(文件夹优先,名称按中文排序)。
481
+ */
482
+ export const getApiDocumentsTree = (options) => (options.client ?? client).get({
483
+ security: [{ scheme: 'bearer', type: 'http' }, {
484
+ in: 'cookie',
485
+ name: 'authjs.session-token',
486
+ type: 'apiKey'
487
+ }],
488
+ url: '/api/documents/tree',
489
+ ...options
490
+ });
491
+ /**
492
+ * 删除文档
493
+ *
494
+ * 需编辑者及以上。
495
+ */
496
+ export const deleteApiDocumentsById = (options) => (options.client ?? client).delete({
497
+ security: [{ scheme: 'bearer', type: 'http' }, {
498
+ in: 'cookie',
499
+ name: 'authjs.session-token',
500
+ type: 'apiKey'
501
+ }],
502
+ url: '/api/documents/{id}',
503
+ ...options
504
+ });
505
+ /**
506
+ * 获取文档
507
+ */
508
+ export const getApiDocumentsById = (options) => (options.client ?? client).get({
509
+ security: [{ scheme: 'bearer', type: 'http' }, {
510
+ in: 'cookie',
511
+ name: 'authjs.session-token',
512
+ type: 'apiKey'
513
+ }],
514
+ url: '/api/documents/{id}',
515
+ ...options
516
+ });
517
+ /**
518
+ * 更新文档
519
+ *
520
+ * 需编辑者及以上。修改内容会重新分块与向量化。
521
+ */
522
+ export const patchApiDocumentsById = (options) => (options.client ?? client).patch({
523
+ security: [{ scheme: 'bearer', type: 'http' }, {
524
+ in: 'cookie',
525
+ name: 'authjs.session-token',
526
+ type: 'apiKey'
527
+ }],
528
+ url: '/api/documents/{id}',
529
+ ...options,
530
+ headers: {
531
+ 'Content-Type': 'application/json',
532
+ ...options.headers
533
+ }
534
+ });
535
+ /**
536
+ * 列出文件夹
537
+ *
538
+ * kbId 与 mark 不能同时为空,同时传入按 AND 匹配。
539
+ */
540
+ export const getApiFolders = (options) => (options?.client ?? client).get({
541
+ security: [{ scheme: 'bearer', type: 'http' }, {
542
+ in: 'cookie',
543
+ name: 'authjs.session-token',
544
+ type: 'apiKey'
545
+ }],
546
+ url: '/api/folders',
547
+ ...options
548
+ });
549
+ /**
550
+ * 创建文件夹
551
+ *
552
+ * 需编辑者及以上。同级文件夹与文档不能重名。
553
+ */
554
+ export const postApiFolders = (options) => (options.client ?? client).post({
555
+ security: [{ scheme: 'bearer', type: 'http' }, {
556
+ in: 'cookie',
557
+ name: 'authjs.session-token',
558
+ type: 'apiKey'
559
+ }],
560
+ url: '/api/folders',
561
+ ...options,
562
+ headers: {
563
+ 'Content-Type': 'application/json',
564
+ ...options.headers
565
+ }
566
+ });
567
+ /**
568
+ * 删除文件夹
569
+ *
570
+ * 需编辑者及以上。级联删除子目录与文档。
571
+ */
572
+ export const deleteApiFoldersById = (options) => (options.client ?? client).delete({
573
+ security: [{ scheme: 'bearer', type: 'http' }, {
574
+ in: 'cookie',
575
+ name: 'authjs.session-token',
576
+ type: 'apiKey'
577
+ }],
578
+ url: '/api/folders/{id}',
579
+ ...options
580
+ });
581
+ /**
582
+ * 更新文件夹
583
+ *
584
+ * 需编辑者及以上。可重命名、移动或修改可见性。
585
+ */
586
+ export const patchApiFoldersById = (options) => (options.client ?? client).patch({
587
+ security: [{ scheme: 'bearer', type: 'http' }, {
588
+ in: 'cookie',
589
+ name: 'authjs.session-token',
590
+ type: 'apiKey'
591
+ }],
592
+ url: '/api/folders/{id}',
593
+ ...options,
594
+ headers: {
595
+ 'Content-Type': 'application/json',
596
+ ...options.headers
597
+ }
598
+ });