@dxpos/knowledge 0.6.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.
@@ -155,31 +155,85 @@ export const postApiChat = (options) => (options.client ?? client).post({
155
155
  }
156
156
  });
157
157
  /**
158
- * 读取对话模块设置
158
+ * 读取会话生效的图片限制与欢迎语
159
159
  *
160
- * 需编辑者及以上。空字段表示继承全局设置。
160
+ * 按会话 > RAG 配置 > 全局 > 代码默认合并图片数量上限与压缩最长边;并返回生效的欢迎语与推荐问题(RAG > 全局)。
161
161
  */
162
- export const getApiChatSettings = (options) => (options?.client ?? client).get({
162
+ export const getApiChatLimits = (options) => (options.client ?? client).get({
163
163
  security: [{ scheme: 'bearer', type: 'http' }, {
164
164
  in: 'cookie',
165
165
  name: 'authjs.session-token',
166
166
  type: 'apiKey'
167
167
  }],
168
- url: '/api/chat/settings',
168
+ url: '/api/chat/limits',
169
169
  ...options
170
170
  });
171
171
  /**
172
- * 更新对话模块设置
172
+ * 列出会话
173
173
  *
174
- * 需编辑者及以上。空字段表示继承全局设置。
174
+ * 管理员可传 userId 查看指定用户会话;ragId 可按 RAG 过滤。
175
+ */
176
+ export const getApiChatConversations = (options) => (options?.client ?? client).get({
177
+ security: [{ scheme: 'bearer', type: 'http' }, {
178
+ in: 'cookie',
179
+ name: 'authjs.session-token',
180
+ type: 'apiKey'
181
+ }],
182
+ url: '/api/chat/conversations',
183
+ ...options
184
+ });
185
+ /**
186
+ * 创建会话
175
187
  */
176
- export const putApiChatSettings = (options) => (options.client ?? client).put({
188
+ export const postApiChatConversations = (options) => (options?.client ?? client).post({
177
189
  security: [{ scheme: 'bearer', type: 'http' }, {
178
190
  in: 'cookie',
179
191
  name: 'authjs.session-token',
180
192
  type: 'apiKey'
181
193
  }],
182
- url: '/api/chat/settings',
194
+ url: '/api/chat/conversations',
195
+ ...options,
196
+ headers: {
197
+ 'Content-Type': 'application/json',
198
+ ...options?.headers
199
+ }
200
+ });
201
+ /**
202
+ * 删除会话
203
+ */
204
+ export const deleteApiChatConversationsById = (options) => (options.client ?? client).delete({
205
+ security: [{ scheme: 'bearer', type: 'http' }, {
206
+ in: 'cookie',
207
+ name: 'authjs.session-token',
208
+ type: 'apiKey'
209
+ }],
210
+ url: '/api/chat/conversations/{id}',
211
+ ...options
212
+ });
213
+ /**
214
+ * 获取会话与消息
215
+ */
216
+ export const getApiChatConversationsById = (options) => (options.client ?? client).get({
217
+ security: [{ scheme: 'bearer', type: 'http' }, {
218
+ in: 'cookie',
219
+ name: 'authjs.session-token',
220
+ type: 'apiKey'
221
+ }],
222
+ url: '/api/chat/conversations/{id}',
223
+ ...options
224
+ });
225
+ /**
226
+ * 更新会话
227
+ *
228
+ * 需编辑者及以上。
229
+ */
230
+ export const patchApiChatConversationsById = (options) => (options.client ?? client).patch({
231
+ security: [{ scheme: 'bearer', type: 'http' }, {
232
+ in: 'cookie',
233
+ name: 'authjs.session-token',
234
+ type: 'apiKey'
235
+ }],
236
+ url: '/api/chat/conversations/{id}',
183
237
  ...options,
184
238
  headers: {
185
239
  'Content-Type': 'application/json',
@@ -187,31 +241,59 @@ export const putApiChatSettings = (options) => (options.client ?? client).put({
187
241
  }
188
242
  });
189
243
  /**
190
- * 读取指定用户的对话模块设置
244
+ * 关键词检索文档
191
245
  *
192
- * 需用户管理员。空字段表示继承全局设置。
246
+ * kbId 与 mark 不能同时为空,同时传入按 AND 匹配。
193
247
  */
194
- export const getApiChatSettingsByUserByUserId = (options) => (options.client ?? client).get({
248
+ export const getApiSearch = (options) => (options.client ?? client).get({
195
249
  security: [{ scheme: 'bearer', type: 'http' }, {
196
250
  in: 'cookie',
197
251
  name: 'authjs.session-token',
198
252
  type: 'apiKey'
199
253
  }],
200
- url: '/api/chat/settings/by-user/{userId}',
254
+ url: '/api/search',
201
255
  ...options
202
256
  });
203
257
  /**
204
- * 更新指定用户的对话模块设置
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
+ * 创建知识库
205
287
  *
206
- * 需用户管理员。空字段表示继承全局设置。
288
+ * 需管理员。mark 为知识库唯一标识,不可包含逗号。
207
289
  */
208
- export const putApiChatSettingsByUserByUserId = (options) => (options.client ?? client).put({
290
+ export const postApiKnowledgeBases = (options) => (options.client ?? client).post({
209
291
  security: [{ scheme: 'bearer', type: 'http' }, {
210
292
  in: 'cookie',
211
293
  name: 'authjs.session-token',
212
294
  type: 'apiKey'
213
295
  }],
214
- url: '/api/chat/settings/by-user/{userId}',
296
+ url: '/api/knowledge-bases',
215
297
  ...options,
216
298
  headers: {
217
299
  'Content-Type': 'application/json',
@@ -219,83 +301,115 @@ export const putApiChatSettingsByUserByUserId = (options) => (options.client ??
219
301
  }
220
302
  });
221
303
  /**
222
- * 读取会话生效的图片限制
304
+ * 删除知识库
223
305
  *
224
- * 按会话 > 模块 > 全局 > 代码默认合并图片数量上限与压缩最长边。
306
+ * 需管理员。删除会级联清理其下文档与分块。
225
307
  */
226
- export const getApiChatLimits = (options) => (options.client ?? client).get({
308
+ export const deleteApiKnowledgeBasesById = (options) => (options.client ?? client).delete({
227
309
  security: [{ scheme: 'bearer', type: 'http' }, {
228
310
  in: 'cookie',
229
311
  name: 'authjs.session-token',
230
312
  type: 'apiKey'
231
313
  }],
232
- url: '/api/chat/limits',
314
+ url: '/api/knowledge-bases/{id}',
233
315
  ...options
234
316
  });
235
317
  /**
236
- * 列出会话
318
+ * 获取知识库
237
319
  */
238
- export const getApiChatConversations = (options) => (options?.client ?? client).get({
320
+ export const getApiKnowledgeBasesById = (options) => (options.client ?? client).get({
239
321
  security: [{ scheme: 'bearer', type: 'http' }, {
240
322
  in: 'cookie',
241
323
  name: 'authjs.session-token',
242
324
  type: 'apiKey'
243
325
  }],
244
- url: '/api/chat/conversations',
326
+ url: '/api/knowledge-bases/{id}',
245
327
  ...options
246
328
  });
247
329
  /**
248
- * 创建会话
330
+ * 更新知识库
331
+ *
332
+ * 需管理员。
249
333
  */
250
- export const postApiChatConversations = (options) => (options?.client ?? client).post({
334
+ export const patchApiKnowledgeBasesById = (options) => (options.client ?? client).patch({
251
335
  security: [{ scheme: 'bearer', type: 'http' }, {
252
336
  in: 'cookie',
253
337
  name: 'authjs.session-token',
254
338
  type: 'apiKey'
255
339
  }],
256
- url: '/api/chat/conversations',
340
+ url: '/api/knowledge-bases/{id}',
257
341
  ...options,
258
342
  headers: {
259
343
  'Content-Type': 'application/json',
260
- ...options?.headers
344
+ ...options.headers
261
345
  }
262
346
  });
263
347
  /**
264
- * 删除会话
348
+ * 列出 RAG 配置
265
349
  */
266
- export const deleteApiChatConversationsById = (options) => (options.client ?? client).delete({
350
+ export const getApiRags = (options) => (options?.client ?? client).get({
267
351
  security: [{ scheme: 'bearer', type: 'http' }, {
268
352
  in: 'cookie',
269
353
  name: 'authjs.session-token',
270
354
  type: 'apiKey'
271
355
  }],
272
- url: '/api/chat/conversations/{id}',
356
+ url: '/api/rags',
273
357
  ...options
274
358
  });
275
359
  /**
276
- * 获取会话与消息
360
+ * 创建 RAG 配置
361
+ *
362
+ * 绑定知识库与对话模块配置。mark 不可包含逗号。
277
363
  */
278
- export const getApiChatConversationsById = (options) => (options.client ?? client).get({
364
+ export const postApiRags = (options) => (options.client ?? client).post({
279
365
  security: [{ scheme: 'bearer', type: 'http' }, {
280
366
  in: 'cookie',
281
367
  name: 'authjs.session-token',
282
368
  type: 'apiKey'
283
369
  }],
284
- url: '/api/chat/conversations/{id}',
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}',
285
387
  ...options
286
388
  });
287
389
  /**
288
- * 更新会话
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 配置
289
403
  *
290
- * 需编辑者及以上。
404
+ * 空字段表示继承全局默认。
291
405
  */
292
- export const patchApiChatConversationsById = (options) => (options.client ?? client).patch({
406
+ export const patchApiRagsById = (options) => (options.client ?? client).patch({
293
407
  security: [{ scheme: 'bearer', type: 'http' }, {
294
408
  in: 'cookie',
295
409
  name: 'authjs.session-token',
296
410
  type: 'apiKey'
297
411
  }],
298
- url: '/api/chat/conversations/{id}',
412
+ url: '/api/rags/{id}',
299
413
  ...options,
300
414
  headers: {
301
415
  'Content-Type': 'application/json',
@@ -303,27 +417,57 @@ export const patchApiChatConversationsById = (options) => (options.client ?? cli
303
417
  }
304
418
  });
305
419
  /**
306
- * 关键词检索文档
420
+ * 按 id / mark 获取 RAG 配置摘要
421
+ *
422
+ * id 与 mark 不能同时为空,同时传入按 AND 匹配。返回 id/name/mark/welcome/recommendedQuestions。
307
423
  */
308
- export const getApiSearch = (options) => (options.client ?? client).get({
424
+ export const getApiRagsDetail = (options) => (options?.client ?? client).get({
309
425
  security: [{ scheme: 'bearer', type: 'http' }, {
310
426
  in: 'cookie',
311
427
  name: 'authjs.session-token',
312
428
  type: 'apiKey'
313
429
  }],
314
- url: '/api/search',
430
+ url: '/api/rags/detail',
315
431
  ...options
316
432
  });
317
433
  /**
318
- * 上报检索结果点击
434
+ * 清空知识库文档
435
+ *
436
+ * 需编辑者及以上。按 kbId 清空该知识库全部文档与分块。
319
437
  */
320
- export const postApiSearchClick = (options) => (options.client ?? client).post({
438
+ export const deleteApiDocuments = (options) => (options.client ?? client).delete({
321
439
  security: [{ scheme: 'bearer', type: 'http' }, {
322
440
  in: 'cookie',
323
441
  name: 'authjs.session-token',
324
442
  type: 'apiKey'
325
443
  }],
326
- url: '/api/search/click',
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',
327
471
  ...options,
328
472
  headers: {
329
473
  'Content-Type': 'application/json',
@@ -331,59 +475,121 @@ export const postApiSearchClick = (options) => (options.client ?? client).post({
331
475
  }
332
476
  });
333
477
  /**
334
- * 列出用户 LLM 并发配置
478
+ * 按知识库 mark 获取文档树
335
479
  *
336
- * 需超级管理员。返回全部用户的覆盖值与生效值预览。
480
+ * 仅支持 mark 查询,返回嵌套文档树(文件夹优先,名称按中文排序)。
337
481
  */
338
- export const getApiLlmConcurrency = (options) => (options?.client ?? client).get({
482
+ export const getApiDocumentsTree = (options) => (options.client ?? client).get({
339
483
  security: [{ scheme: 'bearer', type: 'http' }, {
340
484
  in: 'cookie',
341
485
  name: 'authjs.session-token',
342
486
  type: 'apiKey'
343
487
  }],
344
- url: '/api/llm/concurrency',
488
+ url: '/api/documents/tree',
345
489
  ...options
346
490
  });
347
491
  /**
348
- * 清除单用户 LLM 并发覆盖
492
+ * 删除文档
349
493
  *
350
- * 需超级管理员。清除后回退全局默认。
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
+ * 获取文档
351
507
  */
352
- export const deleteApiLlmConcurrencyByUserId = (options) => (options.client ?? client).delete({
508
+ export const getApiDocumentsById = (options) => (options.client ?? client).get({
353
509
  security: [{ scheme: 'bearer', type: 'http' }, {
354
510
  in: 'cookie',
355
511
  name: 'authjs.session-token',
356
512
  type: 'apiKey'
357
513
  }],
358
- url: '/api/llm/concurrency/{userId}',
514
+ url: '/api/documents/{id}',
359
515
  ...options
360
516
  });
361
517
  /**
362
- * 读取单用户 LLM 并发配置
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
+ * 删除文件夹
363
569
  *
364
- * 需超级管理员。
570
+ * 需编辑者及以上。级联删除子目录与文档。
365
571
  */
366
- export const getApiLlmConcurrencyByUserId = (options) => (options.client ?? client).get({
572
+ export const deleteApiFoldersById = (options) => (options.client ?? client).delete({
367
573
  security: [{ scheme: 'bearer', type: 'http' }, {
368
574
  in: 'cookie',
369
575
  name: 'authjs.session-token',
370
576
  type: 'apiKey'
371
577
  }],
372
- url: '/api/llm/concurrency/{userId}',
578
+ url: '/api/folders/{id}',
373
579
  ...options
374
580
  });
375
581
  /**
376
- * 更新单用户 LLM 并发配置
582
+ * 更新文件夹
377
583
  *
378
- * 需超级管理员。空字段表示回退全局默认。
584
+ * 需编辑者及以上。可重命名、移动或修改可见性。
379
585
  */
380
- export const putApiLlmConcurrencyByUserId = (options) => (options.client ?? client).put({
586
+ export const patchApiFoldersById = (options) => (options.client ?? client).patch({
381
587
  security: [{ scheme: 'bearer', type: 'http' }, {
382
588
  in: 'cookie',
383
589
  name: 'authjs.session-token',
384
590
  type: 'apiKey'
385
591
  }],
386
- url: '/api/llm/concurrency/{userId}',
592
+ url: '/api/folders/{id}',
387
593
  ...options,
388
594
  headers: {
389
595
  'Content-Type': 'application/json',