@dxpos/knowledge 0.11.0 → 0.12.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,304 +1,1175 @@
1
1
  export type ClientOptions = {
2
2
  baseUrl: `${string}://${string}` | (string & {});
3
3
  };
4
+ /**
5
+ * 文件状态:pending 等待上传确认,ready 可用,failed 上传失败
6
+ */
4
7
  export type FileStatus = 'pending' | 'ready' | 'failed';
8
+ /**
9
+ * 文件归属业务:general 文件页上传,knowledge 知识库文档图片,chat 对话图片,rag 问答助手欢迎语图片,skill 技能压缩包,workflow 工作流图片
10
+ */
5
11
  export type FileScope = 'general' | 'knowledge' | 'chat' | 'rag' | 'skill' | 'workflow';
12
+ /**
13
+ * 对象存储文件元数据
14
+ */
6
15
  export type StoredFile = {
16
+ /**
17
+ * 文件 ID
18
+ */
7
19
  id: string;
20
+ /**
21
+ * 对象存储键
22
+ */
8
23
  objectKey: string;
24
+ /**
25
+ * 文件名
26
+ */
9
27
  filename: string;
28
+ /**
29
+ * 文件大小(字节)
30
+ */
10
31
  size: number;
32
+ /**
33
+ * MIME 类型
34
+ */
11
35
  mimeType: string;
12
36
  status: FileStatus;
13
37
  scope: FileScope;
38
+ /**
39
+ * 上传人用户 ID
40
+ */
14
41
  createdBy: string | null;
42
+ /**
43
+ * 最后更新人用户 ID
44
+ */
15
45
  updatedBy: string | null;
46
+ /**
47
+ * 创建时间
48
+ */
16
49
  createdAt: string;
50
+ /**
51
+ * 更新时间
52
+ */
17
53
  updatedAt: string;
18
54
  };
55
+ /**
56
+ * 文件列表项
57
+ */
19
58
  export type FileListItem = {
59
+ /**
60
+ * 文件 ID
61
+ */
20
62
  id: string;
63
+ /**
64
+ * 对象存储键
65
+ */
21
66
  objectKey: string;
67
+ /**
68
+ * 文件名
69
+ */
22
70
  filename: string;
71
+ /**
72
+ * 文件大小(字节)
73
+ */
23
74
  size: number;
75
+ /**
76
+ * MIME 类型
77
+ */
24
78
  mimeType: string;
25
79
  status: FileStatus;
26
80
  scope: FileScope;
81
+ /**
82
+ * 上传人用户 ID
83
+ */
27
84
  createdBy: string | null;
85
+ /**
86
+ * 最后更新人用户 ID
87
+ */
28
88
  updatedBy: string | null;
89
+ /**
90
+ * 创建时间
91
+ */
29
92
  createdAt: string;
93
+ /**
94
+ * 更新时间
95
+ */
30
96
  updatedAt: string;
97
+ /**
98
+ * 文件名,关键词高亮的 HTML
99
+ */
31
100
  filenameSnippet: string;
32
101
  };
102
+ /**
103
+ * 服务端直传单个文件结果;成功时返回 file
104
+ */
33
105
  export type BackendUploadResult = {
106
+ /**
107
+ * 文件名
108
+ */
34
109
  filename: string;
110
+ /**
111
+ * 单项结果:ok 成功,error 失败(见 error)
112
+ */
35
113
  status: 'ok' | 'error';
36
114
  file?: StoredFile;
115
+ /**
116
+ * 失败原因,仅 status=error 时返回
117
+ */
37
118
  error?: string;
38
119
  };
120
+ /**
121
+ * 预签名直传单个文件结果
122
+ */
39
123
  export type PrepareUploadResult = {
124
+ /**
125
+ * 文件名
126
+ */
40
127
  filename: string;
128
+ /**
129
+ * 单项结果:ok 成功,error 失败(见 error)
130
+ */
41
131
  status: 'ok' | 'error';
132
+ /**
133
+ * 文件 ID,确认上传时使用
134
+ */
42
135
  id?: string;
136
+ /**
137
+ * 对象存储键
138
+ */
43
139
  objectKey?: string;
140
+ /**
141
+ * 预签名 PUT 上传地址
142
+ */
44
143
  uploadUrl?: string;
144
+ /**
145
+ * 失败原因,仅 status=error 时返回
146
+ */
45
147
  error?: string;
46
148
  };
149
+ /**
150
+ * 确认上传单个文件结果;成功时返回 file
151
+ */
47
152
  export type CompleteUploadResult = {
153
+ /**
154
+ * 文件 ID
155
+ */
48
156
  id: string;
157
+ /**
158
+ * 单项结果:ok 成功,error 失败(见 error)
159
+ */
49
160
  status: 'ok' | 'error';
50
161
  file?: StoredFile;
162
+ /**
163
+ * 公开访问地址,仅知识库文档图片(scope=knowledge)返回
164
+ */
51
165
  publicUrl?: string;
166
+ /**
167
+ * 失败原因,仅 status=error 时返回
168
+ */
52
169
  error?: string;
53
170
  };
171
+ /**
172
+ * 删除单个文件结果
173
+ */
54
174
  export type BatchDeleteFileResult = {
175
+ /**
176
+ * 文件 ID
177
+ */
55
178
  id: string;
179
+ /**
180
+ * 单项结果:ok 成功,error 失败(见 error)
181
+ */
56
182
  status: 'ok' | 'error';
183
+ /**
184
+ * 失败原因,仅 status=error 时返回
185
+ */
57
186
  error?: string;
58
187
  };
188
+ /**
189
+ * 引用来源:message 会话消息,chat_log 对话审计,rag_welcome 问答助手欢迎语,chat_welcome 全局欢迎语,document 知识库文档,llm_provider 模型提供商图标
190
+ */
59
191
  export type FileReferenceKind = 'message' | 'chat_log' | 'rag_welcome' | 'chat_welcome' | 'document' | 'llm_provider';
192
+ /**
193
+ * 文件引用
194
+ */
60
195
  export type FileReference = {
61
196
  kind: FileReferenceKind;
197
+ /**
198
+ * 引用说明
199
+ */
62
200
  label: string;
201
+ /**
202
+ * 引用方 ID
203
+ */
63
204
  id?: string;
64
205
  };
206
+ /**
207
+ * 仍被引用的文件
208
+ */
65
209
  export type FileReferencedItem = {
210
+ /**
211
+ * 文件 ID
212
+ */
66
213
  id: string;
214
+ /**
215
+ * 文件名
216
+ */
67
217
  filename: string;
218
+ /**
219
+ * 引用列表
220
+ */
68
221
  references: Array<FileReference>;
69
222
  };
223
+ /**
224
+ * 文件仍被引用时的 409 响应数据
225
+ */
70
226
  export type FileReferencedData = {
227
+ /**
228
+ * 因仍被引用而未删除的文件
229
+ */
71
230
  blocked: Array<FileReferencedItem>;
72
231
  };
232
+ /**
233
+ * 清理原因:pending 超时未确认上传,failed 上传失败,unreferenced 已就绪但无引用
234
+ */
73
235
  export type CleanupReason = 'pending' | 'failed' | 'unreferenced';
236
+ /**
237
+ * 清理候选文件
238
+ */
74
239
  export type CleanupCandidate = {
240
+ /**
241
+ * 文件 ID
242
+ */
75
243
  id: string;
244
+ /**
245
+ * 对象存储键
246
+ */
76
247
  objectKey: string;
248
+ /**
249
+ * 文件名
250
+ */
77
251
  filename: string;
252
+ /**
253
+ * 文件大小(字节)
254
+ */
78
255
  size: number;
256
+ /**
257
+ * MIME 类型
258
+ */
79
259
  mimeType: string;
80
260
  status: FileStatus;
81
261
  scope: FileScope;
262
+ /**
263
+ * 上传人用户 ID
264
+ */
82
265
  createdBy: string | null;
266
+ /**
267
+ * 最后更新人用户 ID
268
+ */
83
269
  updatedBy: string | null;
270
+ /**
271
+ * 创建时间
272
+ */
84
273
  createdAt: string;
274
+ /**
275
+ * 更新时间
276
+ */
85
277
  updatedAt: string;
86
278
  reason: CleanupReason;
87
279
  };
280
+ /**
281
+ * 失效文件清理报告
282
+ */
88
283
  export type CleanupReport = {
284
+ /**
285
+ * 是否仅预览
286
+ */
89
287
  dryRun: boolean;
288
+ /**
289
+ * 实际使用的文件创建时长阈值(小时)
290
+ */
90
291
  olderThanHours: number;
292
+ /**
293
+ * 实际使用的每批删除数量
294
+ */
91
295
  deleteBatchSize: number;
296
+ /**
297
+ * 清理候选文件
298
+ */
92
299
  candidates: Array<CleanupCandidate>;
300
+ /**
301
+ * 候选文件总数
302
+ */
93
303
  total: number;
304
+ /**
305
+ * 删除结果,仅 dryRun=false 时返回
306
+ */
94
307
  deleted?: Array<BatchDeleteFileResult>;
95
308
  };
309
+ /**
310
+ * 消息角色:user 用户,assistant 问答助手
311
+ */
96
312
  export type MessageRole = 'user' | 'assistant';
313
+ /**
314
+ * 用户消息图片附件
315
+ */
97
316
  export type MessageAttachment = {
317
+ /**
318
+ * 图片文件 ID
319
+ */
98
320
  fileId: string;
321
+ /**
322
+ * 图片 MIME 类型
323
+ */
99
324
  mimeType: string;
325
+ /**
326
+ * 当前有效的下载地址,仅响应返回
327
+ */
100
328
  url?: string;
101
329
  };
330
+ /**
331
+ * 会话消息
332
+ */
102
333
  export type Message = {
334
+ /**
335
+ * 消息 ID
336
+ */
103
337
  id: string;
338
+ /**
339
+ * 所属会话 ID
340
+ */
104
341
  conversationId: string;
105
342
  role: MessageRole;
343
+ /**
344
+ * 消息正文
345
+ */
106
346
  content: string;
347
+ /**
348
+ * 图片附件,仅用户消息可能有值
349
+ */
107
350
  attachments: Array<MessageAttachment>;
351
+ /**
352
+ * 回答引用的知识库文档,仅问答助手消息可能有值
353
+ */
108
354
  references: Array<{
355
+ /**
356
+ * 文档 ID
357
+ */
109
358
  id: string;
359
+ /**
360
+ * 文档名
361
+ */
110
362
  filename: string;
363
+ /**
364
+ * 文档分块总数
365
+ */
111
366
  chunkCount: number;
367
+ /**
368
+ * 该文档命中分块的最高匹配度
369
+ */
112
370
  score: number;
113
371
  }>;
372
+ /**
373
+ * 输入 Token 数,仅问答助手消息有值
374
+ */
114
375
  promptTokens: number | null;
376
+ /**
377
+ * 输出 Token 数,仅问答助手消息有值
378
+ */
115
379
  completionTokens: number | null;
380
+ /**
381
+ * 总 Token 数,仅问答助手消息有值
382
+ */
116
383
  totalTokens: number | null;
384
+ /**
385
+ * 回答是否被中断
386
+ */
117
387
  aborted: boolean;
388
+ /**
389
+ * 创建人用户 ID
390
+ */
118
391
  createdBy: string | null;
392
+ /**
393
+ * 创建时间
394
+ */
119
395
  createdAt: string;
120
396
  };
397
+ /**
398
+ * 会话
399
+ */
121
400
  export type Conversation = {
401
+ /**
402
+ * 会话 ID
403
+ */
122
404
  id: string;
405
+ /**
406
+ * 会话标题
407
+ */
123
408
  title: string;
409
+ /**
410
+ * 绑定的问答助手 ID;智能路由会话首问前为 null,问答助手被删除后也为 null
411
+ */
124
412
  ragId: number | null;
413
+ /**
414
+ * 绑定的智能路由 ID;直接绑定问答助手的会话为 null
415
+ */
416
+ routerId: number | null;
417
+ /**
418
+ * 多轮对话历史压缩摘要
419
+ */
125
420
  contextSummary: string | null;
421
+ /**
422
+ * 摘要覆盖到的最后一条消息 ID
423
+ */
126
424
  contextSummaryUpTo: string | null;
425
+ /**
426
+ * 会话归属用户 ID
427
+ */
127
428
  createdBy: string | null;
429
+ /**
430
+ * 最后更新人用户 ID
431
+ */
128
432
  updatedBy: string | null;
433
+ /**
434
+ * 创建时间
435
+ */
129
436
  createdAt: string;
130
437
  };
438
+ /**
439
+ * 流式问答 NDJSON 事件,每行一个,按 type 区分
440
+ */
131
441
  export type ChatEvent = {
442
+ /**
443
+ * 回答增量文本
444
+ */
132
445
  type: 'token';
446
+ /**
447
+ * 增量文本片段
448
+ */
133
449
  content: string;
134
450
  } | {
451
+ /**
452
+ * 处理节点完成
453
+ */
135
454
  type: 'node';
455
+ /**
456
+ * 节点名称
457
+ */
136
458
  name: string;
459
+ /**
460
+ * 节点状态,固定为 end
461
+ */
137
462
  status: 'end';
138
463
  } | {
464
+ /**
465
+ * 回答引用的知识库文档
466
+ */
139
467
  type: 'references';
468
+ /**
469
+ * 按匹配度降序排列
470
+ */
140
471
  documents: Array<{
472
+ /**
473
+ * 文档 ID
474
+ */
141
475
  id: string;
476
+ /**
477
+ * 文档名
478
+ */
142
479
  filename: string;
480
+ /**
481
+ * 文档分块总数
482
+ */
143
483
  chunkCount: number;
484
+ /**
485
+ * 该文档命中分块的最高匹配度
486
+ */
144
487
  score: number;
145
488
  }>;
146
489
  } | {
490
+ /**
491
+ * 智能路由命中,仅智能路由会话首问时返回
492
+ */
493
+ type: 'route';
494
+ /**
495
+ * 命中并绑定到会话的问答助手 ID
496
+ */
497
+ ragId: number;
498
+ /**
499
+ * 命中的问答助手名称
500
+ */
501
+ ragName: string;
502
+ } | {
503
+ /**
504
+ * 回答结束
505
+ */
147
506
  type: 'done';
148
507
  } | {
508
+ /**
509
+ * 处理出错,事件流随即结束
510
+ */
149
511
  type: 'error';
512
+ /**
513
+ * 错误信息
514
+ */
150
515
  message: string;
151
516
  };
517
+ /**
518
+ * 非流式问答结果;route 仅在本次触发智能路由时有值,否则为 null
519
+ */
152
520
  export type ChatAnswer = {
521
+ /**
522
+ * 完整回答
523
+ */
153
524
  answer: string;
525
+ /**
526
+ * 回答引用的知识库文档,按匹配度降序排列
527
+ */
154
528
  references: Array<{
529
+ /**
530
+ * 文档 ID
531
+ */
155
532
  id: string;
533
+ /**
534
+ * 文档名
535
+ */
156
536
  filename: string;
537
+ /**
538
+ * 文档分块总数
539
+ */
157
540
  chunkCount: number;
541
+ /**
542
+ * 该文档命中分块的最高匹配度
543
+ */
158
544
  score: number;
159
545
  }>;
546
+ route: ChatRouteResult;
160
547
  };
548
+ /**
549
+ * 智能路由命中结果
550
+ */
551
+ export type ChatRouteResult = {
552
+ /**
553
+ * 命中并绑定到会话的问答助手 ID
554
+ */
555
+ ragId: number;
556
+ /**
557
+ * 命中的问答助手名称
558
+ */
559
+ ragName: string;
560
+ } | null;
561
+ /**
562
+ * 知识库
563
+ */
161
564
  export type KnowledgeBase = {
565
+ /**
566
+ * 知识库 ID
567
+ */
162
568
  id: number;
569
+ /**
570
+ * 名称
571
+ */
163
572
  name: string;
573
+ /**
574
+ * 知识库唯一标识,不可包含逗号
575
+ */
164
576
  mark: string;
577
+ /**
578
+ * 描述
579
+ */
165
580
  description: string | null;
581
+ /**
582
+ * 文档分块大小(字符),不小于 100;null 继承全局
583
+ */
166
584
  chunkSize: number | null;
585
+ /**
586
+ * 相邻分块重叠字符数,需小于分块大小;null 继承全局
587
+ */
167
588
  chunkOverlap: number | null;
589
+ /**
590
+ * 召回时可按「字段=值」等条件过滤的文档 front matter 字段名
591
+ */
592
+ filterFields: Array<string>;
593
+ /**
594
+ * 创建人用户 ID
595
+ */
168
596
  createdBy: string | null;
597
+ /**
598
+ * 最后更新人用户 ID
599
+ */
169
600
  updatedBy: string | null;
601
+ /**
602
+ * 创建时间
603
+ */
170
604
  createdAt: string;
605
+ /**
606
+ * 更新时间
607
+ */
171
608
  updatedAt: string;
172
609
  };
610
+ /**
611
+ * 按当前角色可见范围统计的文档数;阅览者仅统计公开文档
612
+ */
173
613
  export type KnowledgeBaseDocumentStats = {
614
+ /**
615
+ * 公开文档数
616
+ */
174
617
  public: number;
618
+ /**
619
+ * 内部文档数,阅览者不返回
620
+ */
175
621
  internal?: number;
622
+ /**
623
+ * 私有文档数,阅览者不返回
624
+ */
176
625
  private?: number;
626
+ /**
627
+ * 当前角色可见的文档总数
628
+ */
177
629
  total: number;
178
630
  };
631
+ /**
632
+ * 知识库列表项,含文档数统计
633
+ */
179
634
  export type KnowledgeBaseListItem = {
635
+ /**
636
+ * 知识库 ID
637
+ */
180
638
  id: number;
639
+ /**
640
+ * 名称
641
+ */
181
642
  name: string;
643
+ /**
644
+ * 知识库唯一标识,不可包含逗号
645
+ */
182
646
  mark: string;
647
+ /**
648
+ * 描述
649
+ */
183
650
  description: string | null;
651
+ /**
652
+ * 文档分块大小(字符),不小于 100;null 继承全局
653
+ */
184
654
  chunkSize: number | null;
655
+ /**
656
+ * 相邻分块重叠字符数,需小于分块大小;null 继承全局
657
+ */
185
658
  chunkOverlap: number | null;
659
+ /**
660
+ * 召回时可按「字段=值」等条件过滤的文档 front matter 字段名
661
+ */
662
+ filterFields: Array<string>;
663
+ /**
664
+ * 创建人用户 ID
665
+ */
186
666
  createdBy: string | null;
667
+ /**
668
+ * 最后更新人用户 ID
669
+ */
187
670
  updatedBy: string | null;
671
+ /**
672
+ * 创建时间
673
+ */
188
674
  createdAt: string;
675
+ /**
676
+ * 更新时间
677
+ */
189
678
  updatedAt: string;
190
679
  documentStats: KnowledgeBaseDocumentStats;
191
680
  };
681
+ /**
682
+ * 知识库导出包 manifest.json
683
+ */
684
+ export type KnowledgeBaseManifest = {
685
+ /**
686
+ * 导出包格式版本
687
+ */
688
+ version: 1;
689
+ /**
690
+ * 导出时间
691
+ */
692
+ exportedAt: string;
693
+ /**
694
+ * 文档元数据列表
695
+ */
696
+ documents: Array<{
697
+ /**
698
+ * 文档在包内的相对路径,如 guides/setup.md
699
+ */
700
+ path: string;
701
+ visibility: Visibility;
702
+ /**
703
+ * 同级排序序号
704
+ */
705
+ sortOrder: number;
706
+ }>;
707
+ };
708
+ /**
709
+ * 可见性:public 公开,阅览者可浏览且参与问答检索;internal 内部,阅览者不可浏览但参与问答检索;private 私有,阅览者不可浏览也不参与问答检索。编辑者及以上不受限制
710
+ */
711
+ export type Visibility = 'public' | 'internal' | 'private';
712
+ /**
713
+ * 问答助手:绑定知识库与对话参数
714
+ */
192
715
  export type Rag = {
716
+ /**
717
+ * 问答助手 ID
718
+ */
193
719
  id: number;
720
+ /**
721
+ * 名称
722
+ */
194
723
  name: string;
724
+ /**
725
+ * 描述;作为智能路由候选且未填写意图时,用作意图描述
726
+ */
195
727
  description: string | null;
728
+ /**
729
+ * 问答助手唯一标识,可用于创建会话;不可包含逗号
730
+ */
196
731
  mark: string | null;
732
+ /**
733
+ * 绑定的知识库 ID
734
+ */
197
735
  kbId: number;
736
+ /**
737
+ * 系统提示词,支持 {{context}} 检索资料、{{fallback}} 低匹配度默认回复变量;null 继承全局
738
+ */
198
739
  systemPrompt: string | null;
740
+ /**
741
+ * 问题拆分提示词;null 继承全局
742
+ */
199
743
  splitPrompt: string | null;
744
+ /**
745
+ * 是否将用户问题拆分为多个子问题分别检索;null 继承全局
746
+ */
200
747
  splitQuery: boolean | null;
748
+ /**
749
+ * 向量检索匹配度阈值,取值 0~1,低于阈值的结果被过滤;null 继承全局
750
+ */
201
751
  scoreThreshold: number | null;
752
+ /**
753
+ * 检索结果全部低于阈值时的回复文案;null 继承全局
754
+ */
202
755
  lowScoreReply: string | null;
756
+ /**
757
+ * 深度思考:default 使用模型默认,false 关闭,low / medium / high 为思考强度;null 继承全局
758
+ */
203
759
  deepThinking: 'default' | 'false' | 'low' | 'medium' | 'high' | null;
760
+ /**
761
+ * 是否开启多轮对话(携带历史上下文);null 继承全局
762
+ */
204
763
  multiTurn: boolean | null;
764
+ /**
765
+ * 多轮对话上下文 Token 阈值,超出后压缩历史;null 继承全局
766
+ */
205
767
  contextThreshold: number | null;
768
+ /**
769
+ * 每个问题向量检索的最大匹配数;null 继承全局
770
+ */
206
771
  retrieveLimit: number | null;
772
+ /**
773
+ * 单条消息图片数量上限;null 继承全局
774
+ */
207
775
  imageMaxCount: number | null;
776
+ /**
777
+ * 对话图片压缩最长边(像素);null 继承全局
778
+ */
208
779
  imageMaxEdge: number | null;
780
+ /**
781
+ * 文本模型供应商 ID,与 textModel 需同时填写;null 使用全局文本模型
782
+ */
783
+ textProviderId: number | null;
784
+ /**
785
+ * 文本模型名称,与 textProviderId 需同时填写;null 使用全局文本模型
786
+ */
787
+ textModel: string | null;
209
788
  welcome: RagWelcomeConfig;
789
+ /**
790
+ * 推荐问题列表;null 继承全局
791
+ */
210
792
  recommendedQuestions: Array<string> | null;
793
+ /**
794
+ * 创建人用户 ID
795
+ */
211
796
  createdBy: string | null;
797
+ /**
798
+ * 最后更新人用户 ID
799
+ */
212
800
  updatedBy: string | null;
801
+ /**
802
+ * 创建时间
803
+ */
213
804
  createdAt: string;
805
+ /**
806
+ * 更新时间
807
+ */
214
808
  updatedAt: string;
215
809
  };
810
+ /**
811
+ * 欢迎语配置;问答助手上为 null 时继承全局
812
+ */
216
813
  export type RagWelcomeConfig = {
814
+ /**
815
+ * 欢迎语文案,null 表示无文案
816
+ */
217
817
  text: string | null;
818
+ /**
819
+ * 欢迎语图片列表
820
+ */
218
821
  images?: Array<RagWelcomeImage>;
219
822
  } | null;
823
+ /**
824
+ * 欢迎语图片
825
+ */
220
826
  export type RagWelcomeImage = {
827
+ /**
828
+ * 图片文件 ID
829
+ */
221
830
  fileId: string;
831
+ /**
832
+ * 图片 MIME 类型
833
+ */
222
834
  mimeType: string;
835
+ /**
836
+ * 当前有效的下载地址,仅响应返回
837
+ */
223
838
  url?: string;
224
839
  };
840
+ /**
841
+ * 智能路由的候选问答助手
842
+ */
843
+ export type IntentRoute = {
844
+ /**
845
+ * 候选问答助手 ID
846
+ */
847
+ ragId: number;
848
+ /**
849
+ * 意图描述,供模型判断是否命中;null 时取问答助手描述
850
+ */
851
+ intent: string | null;
852
+ };
853
+ /**
854
+ * 智能路由:按会话首问分析意图,路由到候选问答助手,未命中走兜底助手
855
+ */
856
+ export type IntentRouter = {
857
+ /**
858
+ * 智能路由 ID
859
+ */
860
+ id: number;
861
+ /**
862
+ * 名称
863
+ */
864
+ name: string;
865
+ /**
866
+ * 描述
867
+ */
868
+ description: string | null;
869
+ /**
870
+ * 智能路由唯一标识,可用于创建会话(routerMark);不可包含逗号
871
+ */
872
+ mark: string | null;
873
+ /**
874
+ * 意图分析提示词,必须包含 {{assistants}} 变量,模型需只输出命中助手的 id;null 使用默认提示词
875
+ */
876
+ intentPrompt: string | null;
877
+ /**
878
+ * 意图分析使用的文本模型供应商 ID,与 textModel 需同时填写;null 使用全局文本模型
879
+ */
880
+ textProviderId: number | null;
881
+ /**
882
+ * 意图分析使用的文本模型名称,与 textProviderId 需同时填写;null 使用全局文本模型
883
+ */
884
+ textModel: string | null;
885
+ /**
886
+ * 意图分析的深度思考:false 关闭(默认),default 使用模型默认,low / medium / high 为思考强度
887
+ */
888
+ deepThinking: 'default' | 'false' | 'low' | 'medium' | 'high';
889
+ /**
890
+ * 兜底问答助手 ID,未命中任何候选时使用
891
+ */
892
+ fallbackRagId: number;
893
+ /**
894
+ * 候选问答助手列表,至少一项且不能重复
895
+ */
896
+ routes: Array<IntentRoute>;
897
+ /**
898
+ * 创建人用户 ID
899
+ */
900
+ createdBy: string | null;
901
+ /**
902
+ * 最后更新人用户 ID
903
+ */
904
+ updatedBy: string | null;
905
+ /**
906
+ * 创建时间
907
+ */
908
+ createdAt: string;
909
+ /**
910
+ * 更新时间
911
+ */
912
+ updatedAt: string;
913
+ };
914
+ /**
915
+ * 关键词检索命中
916
+ */
225
917
  export type SearchHit = {
918
+ /**
919
+ * 文档 ID
920
+ */
226
921
  documentId: string;
922
+ /**
923
+ * 文档名
924
+ */
227
925
  filename: string;
926
+ /**
927
+ * 命中分块序号
928
+ */
228
929
  chunkIndex: number;
930
+ /**
931
+ * 命中分块原文
932
+ */
229
933
  content: string;
934
+ /**
935
+ * 命中分块原文,关键词高亮的 HTML
936
+ */
230
937
  snippet: string;
938
+ /**
939
+ * 文档名,关键词高亮的 HTML
940
+ */
231
941
  filenameSnippet: string;
942
+ /**
943
+ * 文档 front matter 元数据,字段名到字符串值列表
944
+ */
945
+ metadata: {
946
+ [key: string]: Array<string>;
947
+ };
232
948
  };
233
- export type Visibility = 'public' | 'internal' | 'private';
949
+ /**
950
+ * 文档处理状态:processing 分块与向量化中,ready 可用,failed 处理失败
951
+ */
234
952
  export type DocumentStatus = 'processing' | 'ready' | 'failed';
953
+ /**
954
+ * 知识库文档
955
+ */
235
956
  export type Document = {
957
+ /**
958
+ * 文档 ID
959
+ */
236
960
  id: string;
961
+ /**
962
+ * 所属知识库 ID
963
+ */
237
964
  kbId: number;
965
+ /**
966
+ * 所在文件夹 ID,null 表示根目录
967
+ */
238
968
  folderId: string | null;
969
+ /**
970
+ * 同级排序序号
971
+ */
239
972
  sortOrder: number;
973
+ /**
974
+ * 文档名
975
+ */
240
976
  filename: string;
977
+ /**
978
+ * Markdown 正文
979
+ */
241
980
  content: string;
981
+ /**
982
+ * 正文字符数
983
+ */
242
984
  charCount: number;
985
+ /**
986
+ * 分块数
987
+ */
243
988
  chunkCount: number;
244
989
  status: DocumentStatus;
245
990
  visibility: Visibility;
991
+ /**
992
+ * 分块大小(字符);null 继承知识库或全局
993
+ */
246
994
  chunkSize: number | null;
995
+ /**
996
+ * 分块重叠字符数;null 继承知识库或全局
997
+ */
247
998
  chunkOverlap: number | null;
999
+ /**
1000
+ * 创建人用户 ID
1001
+ */
248
1002
  createdBy: string | null;
1003
+ /**
1004
+ * 最后更新人用户 ID
1005
+ */
249
1006
  updatedBy: string | null;
1007
+ /**
1008
+ * 创建时间
1009
+ */
250
1010
  createdAt: string;
1011
+ /**
1012
+ * 更新时间
1013
+ */
251
1014
  updatedAt: string;
252
1015
  };
1016
+ /**
1017
+ * 文档摘要,不含正文
1018
+ */
253
1019
  export type DocumentSummary = {
1020
+ /**
1021
+ * 文档 ID
1022
+ */
254
1023
  id: string;
1024
+ /**
1025
+ * 所属知识库 ID
1026
+ */
255
1027
  kbId: number;
1028
+ /**
1029
+ * 所在文件夹 ID,null 表示根目录
1030
+ */
256
1031
  folderId: string | null;
1032
+ /**
1033
+ * 同级排序序号
1034
+ */
257
1035
  sortOrder: number;
1036
+ /**
1037
+ * 文档名
1038
+ */
258
1039
  filename: string;
1040
+ /**
1041
+ * 正文字符数
1042
+ */
259
1043
  charCount: number;
1044
+ /**
1045
+ * 分块数
1046
+ */
260
1047
  chunkCount: number;
261
1048
  status: DocumentStatus;
262
1049
  visibility: Visibility;
1050
+ /**
1051
+ * 分块大小(字符);null 继承知识库或全局
1052
+ */
263
1053
  chunkSize: number | null;
1054
+ /**
1055
+ * 分块重叠字符数;null 继承知识库或全局
1056
+ */
264
1057
  chunkOverlap: number | null;
1058
+ /**
1059
+ * 创建人用户 ID
1060
+ */
265
1061
  createdBy: string | null;
1062
+ /**
1063
+ * 最后更新人用户 ID
1064
+ */
266
1065
  updatedBy: string | null;
1066
+ /**
1067
+ * 创建时间
1068
+ */
267
1069
  createdAt: string;
1070
+ /**
1071
+ * 更新时间
1072
+ */
268
1073
  updatedAt: string;
269
1074
  };
1075
+ /**
1076
+ * 文档树节点,按 type 区分文件夹或文件
1077
+ */
270
1078
  export type DocumentTreeNode = {
1079
+ /**
1080
+ * 文件夹节点
1081
+ */
271
1082
  type: 'folder';
272
1083
  folder: Folder;
1084
+ /**
1085
+ * 子节点,文件夹在前
1086
+ */
273
1087
  children: Array<DocumentTreeNode>;
274
1088
  } | {
1089
+ /**
1090
+ * 文件节点
1091
+ */
275
1092
  type: 'file';
276
1093
  document: DocumentSummary;
277
1094
  };
1095
+ /**
1096
+ * 知识库文件夹
1097
+ */
278
1098
  export type Folder = {
1099
+ /**
1100
+ * 文件夹 ID
1101
+ */
279
1102
  id: string;
1103
+ /**
1104
+ * 所属知识库 ID
1105
+ */
280
1106
  kbId: number;
1107
+ /**
1108
+ * 文件夹名
1109
+ */
281
1110
  name: string;
1111
+ /**
1112
+ * 父文件夹 ID,null 表示根目录
1113
+ */
282
1114
  parentId: string | null;
1115
+ /**
1116
+ * 同级排序序号
1117
+ */
283
1118
  sortOrder: number;
284
1119
  visibility: Visibility;
1120
+ /**
1121
+ * 创建人用户 ID
1122
+ */
285
1123
  createdBy: string | null;
1124
+ /**
1125
+ * 最后更新人用户 ID
1126
+ */
286
1127
  updatedBy: string | null;
1128
+ /**
1129
+ * 创建时间
1130
+ */
287
1131
  createdAt: string;
1132
+ /**
1133
+ * 更新时间
1134
+ */
288
1135
  updatedAt: string;
289
1136
  };
1137
+ /**
1138
+ * 调用工作流请求体
1139
+ */
290
1140
  export type WorkflowInvokeRequest = {
1141
+ /**
1142
+ * 开始节点入参,键为入参名
1143
+ */
291
1144
  input?: {
292
1145
  [key: string]: unknown;
293
1146
  };
294
1147
  };
1148
+ /**
1149
+ * 工作流执行结果
1150
+ */
295
1151
  export type WorkflowInvokeResult = {
1152
+ /**
1153
+ * 执行记录 ID
1154
+ */
296
1155
  executionId: string;
1156
+ /**
1157
+ * 工作流 ID
1158
+ */
297
1159
  workflowId: string;
1160
+ /**
1161
+ * 执行状态:completed 成功,failed 失败
1162
+ */
298
1163
  status: 'completed' | 'failed';
1164
+ /**
1165
+ * 工作流输出,无输出时为 null
1166
+ */
299
1167
  output: {
300
1168
  [key: string]: unknown;
301
1169
  } | null;
1170
+ /**
1171
+ * 失败原因,成功时为 null
1172
+ */
302
1173
  error: string | null;
303
1174
  };
304
1175
  export type ErrorResponse = {
@@ -306,16 +1177,116 @@ export type ErrorResponse = {
306
1177
  * 业务码,成功为 0
307
1178
  */
308
1179
  code: number;
1180
+ /**
1181
+ * 提示信息,失败时为错误原因
1182
+ */
309
1183
  message: string;
310
1184
  data: {
311
1185
  [key: string]: unknown;
312
1186
  } | Array<unknown> | null;
313
1187
  };
1188
+ /**
1189
+ * 创建智能路由请求体
1190
+ */
1191
+ export type IntentRouterCreate = {
1192
+ /**
1193
+ * 名称
1194
+ */
1195
+ name: string;
1196
+ /**
1197
+ * 描述
1198
+ */
1199
+ description?: string | null;
1200
+ /**
1201
+ * 智能路由唯一标识,可用于创建会话(routerMark);不可包含逗号
1202
+ */
1203
+ mark?: string | null;
1204
+ /**
1205
+ * 意图分析提示词,必须包含 {{assistants}} 变量,模型需只输出命中助手的 id;null 使用默认提示词
1206
+ */
1207
+ intentPrompt?: string | null;
1208
+ /**
1209
+ * 意图分析使用的文本模型供应商 ID,与 textModel 需同时填写;null 使用全局文本模型
1210
+ */
1211
+ textProviderId?: number | null;
1212
+ /**
1213
+ * 意图分析使用的文本模型名称,与 textProviderId 需同时填写;null 使用全局文本模型
1214
+ */
1215
+ textModel?: string | null;
1216
+ /**
1217
+ * 意图分析的深度思考:false 关闭(默认),default 使用模型默认,low / medium / high 为思考强度
1218
+ */
1219
+ deepThinking?: 'default' | 'false' | 'low' | 'medium' | 'high';
1220
+ /**
1221
+ * 兜底问答助手 ID,未命中任何候选时使用
1222
+ */
1223
+ fallbackRagId: number;
1224
+ /**
1225
+ * 候选问答助手列表,至少一项且不能重复
1226
+ */
1227
+ routes: Array<IntentRoute>;
1228
+ };
1229
+ /**
1230
+ * 更新智能路由请求体,仅更新传入字段
1231
+ */
1232
+ export type IntentRouterUpdate = {
1233
+ /**
1234
+ * 名称
1235
+ */
1236
+ name?: string;
1237
+ /**
1238
+ * 描述
1239
+ */
1240
+ description?: string | null;
1241
+ /**
1242
+ * 智能路由唯一标识,可用于创建会话(routerMark);不可包含逗号
1243
+ */
1244
+ mark?: string | null;
1245
+ /**
1246
+ * 意图分析提示词,必须包含 {{assistants}} 变量,模型需只输出命中助手的 id;null 使用默认提示词
1247
+ */
1248
+ intentPrompt?: string | null;
1249
+ /**
1250
+ * 意图分析使用的文本模型供应商 ID,与 textModel 需同时填写;null 使用全局文本模型
1251
+ */
1252
+ textProviderId?: number | null;
1253
+ /**
1254
+ * 意图分析使用的文本模型名称,与 textProviderId 需同时填写;null 使用全局文本模型
1255
+ */
1256
+ textModel?: string | null;
1257
+ /**
1258
+ * 意图分析的深度思考:false 关闭(默认),default 使用模型默认,low / medium / high 为思考强度
1259
+ */
1260
+ deepThinking?: 'default' | 'false' | 'low' | 'medium' | 'high';
1261
+ /**
1262
+ * 兜底问答助手 ID,未命中任何候选时使用
1263
+ */
1264
+ fallbackRagId?: number;
1265
+ /**
1266
+ * 候选问答助手列表,至少一项且不能重复
1267
+ */
1268
+ routes?: Array<IntentRoute>;
1269
+ };
1270
+ /**
1271
+ * 问答助手摘要
1272
+ */
314
1273
  export type RagDetail = {
1274
+ /**
1275
+ * 问答助手 ID
1276
+ */
315
1277
  id: number;
1278
+ /**
1279
+ * 名称
1280
+ */
316
1281
  name: string;
1282
+ /**
1283
+ * 问答助手唯一标识,可用于创建会话;不可包含逗号
1284
+ */
317
1285
  mark: string | null;
318
1286
  welcome: RagWelcomeConfig;
1287
+ /**
1288
+ * 推荐问题列表;null 继承全局
1289
+ */
319
1290
  recommendedQuestions: Array<string> | null;
320
1291
  };
321
1292
  export type DocumentUpdateByPath = {
@@ -338,7 +1309,13 @@ export type DocumentUpdateByPath = {
338
1309
  };
339
1310
  export type DeleteApiFilesData = {
340
1311
  body: {
1312
+ /**
1313
+ * 待删除文件 ID 列表
1314
+ */
341
1315
  ids: Array<string>;
1316
+ /**
1317
+ * 为 true 时忽略引用强制删除
1318
+ */
342
1319
  force?: boolean;
343
1320
  };
344
1321
  path?: never;
@@ -370,6 +1347,9 @@ export type DeleteApiFilesErrors = {
370
1347
  * 业务码,成功为 0
371
1348
  */
372
1349
  code: number;
1350
+ /**
1351
+ * 提示信息,失败时为错误原因
1352
+ */
373
1353
  message: string;
374
1354
  data: FileReferencedData;
375
1355
  };
@@ -392,8 +1372,14 @@ export type DeleteApiFilesResponses = {
392
1372
  * 业务码,成功为 0
393
1373
  */
394
1374
  code: number;
1375
+ /**
1376
+ * 提示信息,失败时为错误原因
1377
+ */
395
1378
  message: string;
396
1379
  data: {
1380
+ /**
1381
+ * 逐项结果,顺序与请求一致
1382
+ */
397
1383
  results: Array<BatchDeleteFileResult>;
398
1384
  };
399
1385
  };
@@ -403,7 +1389,13 @@ export type GetApiFilesData = {
403
1389
  body?: never;
404
1390
  path?: never;
405
1391
  query?: {
1392
+ /**
1393
+ * 文件归属业务:general 文件页上传,knowledge 知识库文档图片,chat 对话图片,rag 问答助手欢迎语图片,skill 技能压缩包,workflow 工作流图片
1394
+ */
406
1395
  scope?: FileScope;
1396
+ /**
1397
+ * 文件状态:pending 等待上传确认,ready 可用,failed 上传失败
1398
+ */
407
1399
  status?: FileStatus;
408
1400
  /**
409
1401
  * 文件名关键词
@@ -417,7 +1409,13 @@ export type GetApiFilesData = {
417
1409
  * 创建时间止
418
1410
  */
419
1411
  endDate?: string;
1412
+ /**
1413
+ * 每页条数,默认 50,最大 200
1414
+ */
420
1415
  limit?: number;
1416
+ /**
1417
+ * 偏移量,默认 0
1418
+ */
421
1419
  offset?: number;
422
1420
  };
423
1421
  url: '/api/files';
@@ -446,9 +1444,18 @@ export type GetApiFilesResponses = {
446
1444
  * 业务码,成功为 0
447
1445
  */
448
1446
  code: number;
1447
+ /**
1448
+ * 提示信息,失败时为错误原因
1449
+ */
449
1450
  message: string;
450
1451
  data: {
1452
+ /**
1453
+ * 当前页文件
1454
+ */
451
1455
  items: Array<FileListItem>;
1456
+ /**
1457
+ * 符合条件的文件总数
1458
+ */
452
1459
  total: number;
453
1460
  };
454
1461
  };
@@ -456,6 +1463,9 @@ export type GetApiFilesResponses = {
456
1463
  export type GetApiFilesResponse = GetApiFilesResponses[keyof GetApiFilesResponses];
457
1464
  export type PostApiFilesData = {
458
1465
  body: {
1466
+ /**
1467
+ * 待上传文件
1468
+ */
459
1469
  files: Array<Blob | File>;
460
1470
  scope: FileScope;
461
1471
  };
@@ -499,8 +1509,14 @@ export type PostApiFilesResponses = {
499
1509
  * 业务码,成功为 0
500
1510
  */
501
1511
  code: number;
1512
+ /**
1513
+ * 提示信息,失败时为错误原因
1514
+ */
502
1515
  message: string;
503
1516
  data: {
1517
+ /**
1518
+ * 逐项结果,顺序与请求一致
1519
+ */
504
1520
  results: Array<BackendUploadResult>;
505
1521
  };
506
1522
  };
@@ -508,9 +1524,21 @@ export type PostApiFilesResponses = {
508
1524
  export type PostApiFilesResponse = PostApiFilesResponses[keyof PostApiFilesResponses];
509
1525
  export type PostApiFilesPresignData = {
510
1526
  body: {
1527
+ /**
1528
+ * 待上传文件列表
1529
+ */
511
1530
  items: Array<{
1531
+ /**
1532
+ * 文件名
1533
+ */
512
1534
  filename: string;
1535
+ /**
1536
+ * 文件大小(字节)
1537
+ */
513
1538
  size: number;
1539
+ /**
1540
+ * MIME 类型
1541
+ */
514
1542
  mimeType: string;
515
1543
  scope: FileScope;
516
1544
  }>;
@@ -555,8 +1583,14 @@ export type PostApiFilesPresignResponses = {
555
1583
  * 业务码,成功为 0
556
1584
  */
557
1585
  code: number;
1586
+ /**
1587
+ * 提示信息,失败时为错误原因
1588
+ */
558
1589
  message: string;
559
1590
  data: {
1591
+ /**
1592
+ * 逐项结果,顺序与请求一致
1593
+ */
560
1594
  results: Array<PrepareUploadResult>;
561
1595
  };
562
1596
  };
@@ -564,6 +1598,9 @@ export type PostApiFilesPresignResponses = {
564
1598
  export type PostApiFilesPresignResponse = PostApiFilesPresignResponses[keyof PostApiFilesPresignResponses];
565
1599
  export type PostApiFilesCompleteData = {
566
1600
  body: {
1601
+ /**
1602
+ * 预签名直传返回的文件 ID 列表
1603
+ */
567
1604
  ids: Array<string>;
568
1605
  };
569
1606
  path?: never;
@@ -606,8 +1643,14 @@ export type PostApiFilesCompleteResponses = {
606
1643
  * 业务码,成功为 0
607
1644
  */
608
1645
  code: number;
1646
+ /**
1647
+ * 提示信息,失败时为错误原因
1648
+ */
609
1649
  message: string;
610
1650
  data: {
1651
+ /**
1652
+ * 逐项结果,顺序与请求一致
1653
+ */
611
1654
  results: Array<CompleteUploadResult>;
612
1655
  };
613
1656
  };
@@ -615,8 +1658,17 @@ export type PostApiFilesCompleteResponses = {
615
1658
  export type PostApiFilesCompleteResponse = PostApiFilesCompleteResponses[keyof PostApiFilesCompleteResponses];
616
1659
  export type PostApiFilesCleanupData = {
617
1660
  body: {
1661
+ /**
1662
+ * 为 true 时仅返回候选列表不删除,默认 true
1663
+ */
618
1664
  dryRun?: boolean;
1665
+ /**
1666
+ * 仅处理创建超过该时长(小时)的文件,默认 24
1667
+ */
619
1668
  olderThanHours?: number;
1669
+ /**
1670
+ * 每批删除数量,默认 100
1671
+ */
620
1672
  deleteBatchSize?: number;
621
1673
  };
622
1674
  path?: never;
@@ -659,6 +1711,9 @@ export type PostApiFilesCleanupResponses = {
659
1711
  * 业务码,成功为 0
660
1712
  */
661
1713
  code: number;
1714
+ /**
1715
+ * 提示信息,失败时为错误原因
1716
+ */
662
1717
  message: string;
663
1718
  data: CleanupReport;
664
1719
  };
@@ -667,9 +1722,15 @@ export type PostApiFilesCleanupResponse = PostApiFilesCleanupResponses[keyof Pos
667
1722
  export type DeleteApiFilesByIdData = {
668
1723
  body?: never;
669
1724
  path: {
1725
+ /**
1726
+ * 资源 ID
1727
+ */
670
1728
  id: string;
671
1729
  };
672
1730
  query?: {
1731
+ /**
1732
+ * 为 true 时忽略引用强制删除
1733
+ */
673
1734
  force?: boolean;
674
1735
  };
675
1736
  url: '/api/files/{id}';
@@ -699,6 +1760,9 @@ export type DeleteApiFilesByIdErrors = {
699
1760
  * 业务码,成功为 0
700
1761
  */
701
1762
  code: number;
1763
+ /**
1764
+ * 提示信息,失败时为错误原因
1765
+ */
702
1766
  message: string;
703
1767
  data: FileReferencedData;
704
1768
  };
@@ -720,7 +1784,10 @@ export type DeleteApiFilesByIdResponses = {
720
1784
  /**
721
1785
  * 业务码,成功为 0
722
1786
  */
723
- code: number;
1787
+ code: number;
1788
+ /**
1789
+ * 提示信息,失败时为错误原因
1790
+ */
724
1791
  message: string;
725
1792
  data: null;
726
1793
  };
@@ -729,6 +1796,9 @@ export type DeleteApiFilesByIdResponse = DeleteApiFilesByIdResponses[keyof Delet
729
1796
  export type GetApiFilesByIdData = {
730
1797
  body?: never;
731
1798
  path: {
1799
+ /**
1800
+ * 资源 ID
1801
+ */
732
1802
  id: string;
733
1803
  };
734
1804
  query?: never;
@@ -770,6 +1840,9 @@ export type GetApiFilesByIdResponses = {
770
1840
  * 业务码,成功为 0
771
1841
  */
772
1842
  code: number;
1843
+ /**
1844
+ * 提示信息,失败时为错误原因
1845
+ */
773
1846
  message: string;
774
1847
  data: StoredFile;
775
1848
  };
@@ -778,6 +1851,9 @@ export type GetApiFilesByIdResponse = GetApiFilesByIdResponses[keyof GetApiFiles
778
1851
  export type GetApiFilesByIdRawData = {
779
1852
  body?: never;
780
1853
  path: {
1854
+ /**
1855
+ * 资源 ID
1856
+ */
781
1857
  id: string;
782
1858
  };
783
1859
  query?: never;
@@ -820,6 +1896,9 @@ export type GetApiFilesByIdRawResponse = GetApiFilesByIdRawResponses[keyof GetAp
820
1896
  export type GetApiFilesByIdUrlData = {
821
1897
  body?: never;
822
1898
  path: {
1899
+ /**
1900
+ * 资源 ID
1901
+ */
823
1902
  id: string;
824
1903
  };
825
1904
  query?: never;
@@ -861,8 +1940,14 @@ export type GetApiFilesByIdUrlResponses = {
861
1940
  * 业务码,成功为 0
862
1941
  */
863
1942
  code: number;
1943
+ /**
1944
+ * 提示信息,失败时为错误原因
1945
+ */
864
1946
  message: string;
865
1947
  data: {
1948
+ /**
1949
+ * 下载地址
1950
+ */
866
1951
  url: string;
867
1952
  };
868
1953
  };
@@ -870,11 +1955,26 @@ export type GetApiFilesByIdUrlResponses = {
870
1955
  export type GetApiFilesByIdUrlResponse = GetApiFilesByIdUrlResponses[keyof GetApiFilesByIdUrlResponses];
871
1956
  export type PostApiChatData = {
872
1957
  body: {
1958
+ /**
1959
+ * 会话 ID
1960
+ */
873
1961
  conversationId: string;
1962
+ /**
1963
+ * 用户问题,与 attachments 至少传一项
1964
+ */
874
1965
  content: string;
1966
+ /**
1967
+ * 图片附件,实际数量上限以 /api/chat/limits 返回的 imageMaxCount 为准
1968
+ */
875
1969
  attachments?: Array<{
1970
+ /**
1971
+ * 当前用户上传且已就绪的对话图片文件 ID(scope=chat)
1972
+ */
876
1973
  fileId: string;
877
1974
  }>;
1975
+ /**
1976
+ * 是否以 NDJSON 事件流返回,默认 true
1977
+ */
878
1978
  stream?: boolean;
879
1979
  };
880
1980
  path?: never;
@@ -917,6 +2017,9 @@ export type PostApiChatResponses = {
917
2017
  * 业务码,成功为 0
918
2018
  */
919
2019
  code: number;
2020
+ /**
2021
+ * 提示信息,失败时为错误原因
2022
+ */
920
2023
  message: string;
921
2024
  data: ChatAnswer;
922
2025
  };
@@ -926,6 +2029,9 @@ export type GetApiChatLimitsData = {
926
2029
  body?: never;
927
2030
  path?: never;
928
2031
  query: {
2032
+ /**
2033
+ * 会话 ID
2034
+ */
929
2035
  conversationId: string;
930
2036
  };
931
2037
  url: '/api/chat/limits';
@@ -958,11 +2064,23 @@ export type GetApiChatLimitsResponses = {
958
2064
  * 业务码,成功为 0
959
2065
  */
960
2066
  code: number;
2067
+ /**
2068
+ * 提示信息,失败时为错误原因
2069
+ */
961
2070
  message: string;
962
2071
  data: {
2072
+ /**
2073
+ * 单条消息图片数量上限
2074
+ */
963
2075
  imageMaxCount: number;
2076
+ /**
2077
+ * 图片压缩最长边(像素),客户端上传前按此缩放
2078
+ */
964
2079
  imageMaxEdge: number;
965
2080
  welcome: RagWelcomeConfig;
2081
+ /**
2082
+ * 生效的推荐问题
2083
+ */
966
2084
  recommendedQuestions: Array<string>;
967
2085
  };
968
2086
  };
@@ -972,8 +2090,18 @@ export type GetApiChatConversationsData = {
972
2090
  body?: never;
973
2091
  path?: never;
974
2092
  query?: {
2093
+ /**
2094
+ * 按会话归属用户过滤,仅管理员及以上生效
2095
+ */
975
2096
  userId?: string;
2097
+ /**
2098
+ * 按问答助手 ID 过滤
2099
+ */
976
2100
  ragId?: number;
2101
+ /**
2102
+ * 按智能路由 ID 过滤
2103
+ */
2104
+ routerId?: number;
977
2105
  };
978
2106
  url: '/api/chat/conversations';
979
2107
  };
@@ -997,6 +2125,9 @@ export type GetApiChatConversationsResponses = {
997
2125
  * 业务码,成功为 0
998
2126
  */
999
2127
  code: number;
2128
+ /**
2129
+ * 提示信息,失败时为错误原因
2130
+ */
1000
2131
  message: string;
1001
2132
  data: Array<Conversation>;
1002
2133
  };
@@ -1004,10 +2135,30 @@ export type GetApiChatConversationsResponses = {
1004
2135
  export type GetApiChatConversationsResponse = GetApiChatConversationsResponses[keyof GetApiChatConversationsResponses];
1005
2136
  export type PostApiChatConversationsData = {
1006
2137
  body?: {
2138
+ /**
2139
+ * 会话标题
2140
+ */
1007
2141
  title?: string;
2142
+ /**
2143
+ * 会话归属用户 ID,默认为当前用户;指定他人时需对该用户有管理权限
2144
+ */
1008
2145
  userId?: string;
2146
+ /**
2147
+ * 直接绑定的问答助手 ID,与 mark 二选一
2148
+ */
1009
2149
  ragId?: number;
2150
+ /**
2151
+ * 直接绑定的问答助手标识,与 ragId 二选一
2152
+ */
1010
2153
  mark?: string;
2154
+ /**
2155
+ * 绑定的智能路由 ID,与 routerMark 二选一
2156
+ */
2157
+ routerId?: number;
2158
+ /**
2159
+ * 绑定的智能路由标识,与 routerId 二选一
2160
+ */
2161
+ routerMark?: string;
1011
2162
  };
1012
2163
  path?: never;
1013
2164
  query?: never;
@@ -1049,6 +2200,9 @@ export type PostApiChatConversationsResponses = {
1049
2200
  * 业务码,成功为 0
1050
2201
  */
1051
2202
  code: number;
2203
+ /**
2204
+ * 提示信息,失败时为错误原因
2205
+ */
1052
2206
  message: string;
1053
2207
  data: Conversation;
1054
2208
  };
@@ -1057,6 +2211,9 @@ export type PostApiChatConversationsResponse = PostApiChatConversationsResponses
1057
2211
  export type DeleteApiChatConversationsByIdData = {
1058
2212
  body?: never;
1059
2213
  path: {
2214
+ /**
2215
+ * 资源 ID
2216
+ */
1060
2217
  id: string;
1061
2218
  };
1062
2219
  query?: never;
@@ -1098,6 +2255,9 @@ export type DeleteApiChatConversationsByIdResponses = {
1098
2255
  * 业务码,成功为 0
1099
2256
  */
1100
2257
  code: number;
2258
+ /**
2259
+ * 提示信息,失败时为错误原因
2260
+ */
1101
2261
  message: string;
1102
2262
  data: null;
1103
2263
  };
@@ -1106,6 +2266,9 @@ export type DeleteApiChatConversationsByIdResponse = DeleteApiChatConversationsB
1106
2266
  export type GetApiChatConversationsByIdData = {
1107
2267
  body?: never;
1108
2268
  path: {
2269
+ /**
2270
+ * 资源 ID
2271
+ */
1109
2272
  id: string;
1110
2273
  };
1111
2274
  query?: never;
@@ -1147,9 +2310,15 @@ export type GetApiChatConversationsByIdResponses = {
1147
2310
  * 业务码,成功为 0
1148
2311
  */
1149
2312
  code: number;
2313
+ /**
2314
+ * 提示信息,失败时为错误原因
2315
+ */
1150
2316
  message: string;
1151
2317
  data: {
1152
2318
  conversation: Conversation;
2319
+ /**
2320
+ * 会话消息,按时间正序
2321
+ */
1153
2322
  messages: Array<Message>;
1154
2323
  };
1155
2324
  };
@@ -1157,15 +2326,263 @@ export type GetApiChatConversationsByIdResponses = {
1157
2326
  export type GetApiChatConversationsByIdResponse = GetApiChatConversationsByIdResponses[keyof GetApiChatConversationsByIdResponses];
1158
2327
  export type PatchApiChatConversationsByIdData = {
1159
2328
  body: {
2329
+ /**
2330
+ * 会话标题,为空时保持原标题
2331
+ */
1160
2332
  title?: string;
1161
2333
  };
1162
2334
  path: {
2335
+ /**
2336
+ * 资源 ID
2337
+ */
2338
+ id: string;
2339
+ };
2340
+ query?: never;
2341
+ url: '/api/chat/conversations/{id}';
2342
+ };
2343
+ export type PatchApiChatConversationsByIdErrors = {
2344
+ /**
2345
+ * 请求参数无效
2346
+ */
2347
+ 400: ErrorResponse;
2348
+ /**
2349
+ * 未登录
2350
+ */
2351
+ 401: ErrorResponse;
2352
+ /**
2353
+ * 无权限
2354
+ */
2355
+ 403: ErrorResponse;
2356
+ /**
2357
+ * 资源不存在
2358
+ */
2359
+ 404: ErrorResponse;
2360
+ /**
2361
+ * LLM 并发已满
2362
+ */
2363
+ 429: ErrorResponse;
2364
+ /**
2365
+ * 服务器内部错误
2366
+ */
2367
+ 500: ErrorResponse;
2368
+ };
2369
+ export type PatchApiChatConversationsByIdError = PatchApiChatConversationsByIdErrors[keyof PatchApiChatConversationsByIdErrors];
2370
+ export type PatchApiChatConversationsByIdResponses = {
2371
+ /**
2372
+ * 成功
2373
+ */
2374
+ 200: {
2375
+ /**
2376
+ * 业务码,成功为 0
2377
+ */
2378
+ code: number;
2379
+ /**
2380
+ * 提示信息,失败时为错误原因
2381
+ */
2382
+ message: string;
2383
+ data: Conversation;
2384
+ };
2385
+ };
2386
+ export type PatchApiChatConversationsByIdResponse = PatchApiChatConversationsByIdResponses[keyof PatchApiChatConversationsByIdResponses];
2387
+ export type GetApiChatRoutersData = {
2388
+ body?: never;
2389
+ path?: never;
2390
+ query?: never;
2391
+ url: '/api/chat/routers';
2392
+ };
2393
+ export type GetApiChatRoutersErrors = {
2394
+ /**
2395
+ * 未登录
2396
+ */
2397
+ 401: ErrorResponse;
2398
+ /**
2399
+ * 服务器内部错误
2400
+ */
2401
+ 500: ErrorResponse;
2402
+ };
2403
+ export type GetApiChatRoutersError = GetApiChatRoutersErrors[keyof GetApiChatRoutersErrors];
2404
+ export type GetApiChatRoutersResponses = {
2405
+ /**
2406
+ * 成功
2407
+ */
2408
+ 200: {
2409
+ /**
2410
+ * 业务码,成功为 0
2411
+ */
2412
+ code: number;
2413
+ /**
2414
+ * 提示信息,失败时为错误原因
2415
+ */
2416
+ message: string;
2417
+ data: Array<IntentRouter>;
2418
+ };
2419
+ };
2420
+ export type GetApiChatRoutersResponse = GetApiChatRoutersResponses[keyof GetApiChatRoutersResponses];
2421
+ export type PostApiChatRoutersData = {
2422
+ body: IntentRouterCreate;
2423
+ path?: never;
2424
+ query?: never;
2425
+ url: '/api/chat/routers';
2426
+ };
2427
+ export type PostApiChatRoutersErrors = {
2428
+ /**
2429
+ * 请求参数无效
2430
+ */
2431
+ 400: ErrorResponse;
2432
+ /**
2433
+ * 未登录
2434
+ */
2435
+ 401: ErrorResponse;
2436
+ /**
2437
+ * 服务器内部错误
2438
+ */
2439
+ 500: ErrorResponse;
2440
+ };
2441
+ export type PostApiChatRoutersError = PostApiChatRoutersErrors[keyof PostApiChatRoutersErrors];
2442
+ export type PostApiChatRoutersResponses = {
2443
+ /**
2444
+ * 成功
2445
+ */
2446
+ 201: {
2447
+ /**
2448
+ * 业务码,成功为 0
2449
+ */
2450
+ code: number;
2451
+ /**
2452
+ * 提示信息,失败时为错误原因
2453
+ */
2454
+ message: string;
2455
+ data: {
2456
+ /**
2457
+ * 新建智能路由 ID
2458
+ */
2459
+ id: number;
2460
+ };
2461
+ };
2462
+ };
2463
+ export type PostApiChatRoutersResponse = PostApiChatRoutersResponses[keyof PostApiChatRoutersResponses];
2464
+ export type DeleteApiChatRoutersByIdData = {
2465
+ body?: never;
2466
+ path: {
2467
+ /**
2468
+ * 资源 ID
2469
+ */
2470
+ id: string;
2471
+ };
2472
+ query?: never;
2473
+ url: '/api/chat/routers/{id}';
2474
+ };
2475
+ export type DeleteApiChatRoutersByIdErrors = {
2476
+ /**
2477
+ * 请求参数无效
2478
+ */
2479
+ 400: ErrorResponse;
2480
+ /**
2481
+ * 未登录
2482
+ */
2483
+ 401: ErrorResponse;
2484
+ /**
2485
+ * 无权限
2486
+ */
2487
+ 403: ErrorResponse;
2488
+ /**
2489
+ * 资源不存在
2490
+ */
2491
+ 404: ErrorResponse;
2492
+ /**
2493
+ * LLM 并发已满
2494
+ */
2495
+ 429: ErrorResponse;
2496
+ /**
2497
+ * 服务器内部错误
2498
+ */
2499
+ 500: ErrorResponse;
2500
+ };
2501
+ export type DeleteApiChatRoutersByIdError = DeleteApiChatRoutersByIdErrors[keyof DeleteApiChatRoutersByIdErrors];
2502
+ export type DeleteApiChatRoutersByIdResponses = {
2503
+ /**
2504
+ * 成功
2505
+ */
2506
+ 200: {
2507
+ /**
2508
+ * 业务码,成功为 0
2509
+ */
2510
+ code: number;
2511
+ /**
2512
+ * 提示信息,失败时为错误原因
2513
+ */
2514
+ message: string;
2515
+ data: null;
2516
+ };
2517
+ };
2518
+ export type DeleteApiChatRoutersByIdResponse = DeleteApiChatRoutersByIdResponses[keyof DeleteApiChatRoutersByIdResponses];
2519
+ export type GetApiChatRoutersByIdData = {
2520
+ body?: never;
2521
+ path: {
2522
+ /**
2523
+ * 资源 ID
2524
+ */
2525
+ id: string;
2526
+ };
2527
+ query?: never;
2528
+ url: '/api/chat/routers/{id}';
2529
+ };
2530
+ export type GetApiChatRoutersByIdErrors = {
2531
+ /**
2532
+ * 请求参数无效
2533
+ */
2534
+ 400: ErrorResponse;
2535
+ /**
2536
+ * 未登录
2537
+ */
2538
+ 401: ErrorResponse;
2539
+ /**
2540
+ * 无权限
2541
+ */
2542
+ 403: ErrorResponse;
2543
+ /**
2544
+ * 资源不存在
2545
+ */
2546
+ 404: ErrorResponse;
2547
+ /**
2548
+ * LLM 并发已满
2549
+ */
2550
+ 429: ErrorResponse;
2551
+ /**
2552
+ * 服务器内部错误
2553
+ */
2554
+ 500: ErrorResponse;
2555
+ };
2556
+ export type GetApiChatRoutersByIdError = GetApiChatRoutersByIdErrors[keyof GetApiChatRoutersByIdErrors];
2557
+ export type GetApiChatRoutersByIdResponses = {
2558
+ /**
2559
+ * 成功
2560
+ */
2561
+ 200: {
2562
+ /**
2563
+ * 业务码,成功为 0
2564
+ */
2565
+ code: number;
2566
+ /**
2567
+ * 提示信息,失败时为错误原因
2568
+ */
2569
+ message: string;
2570
+ data: IntentRouter;
2571
+ };
2572
+ };
2573
+ export type GetApiChatRoutersByIdResponse = GetApiChatRoutersByIdResponses[keyof GetApiChatRoutersByIdResponses];
2574
+ export type PatchApiChatRoutersByIdData = {
2575
+ body: IntentRouterUpdate;
2576
+ path: {
2577
+ /**
2578
+ * 资源 ID
2579
+ */
1163
2580
  id: string;
1164
2581
  };
1165
2582
  query?: never;
1166
- url: '/api/chat/conversations/{id}';
2583
+ url: '/api/chat/routers/{id}';
1167
2584
  };
1168
- export type PatchApiChatConversationsByIdErrors = {
2585
+ export type PatchApiChatRoutersByIdErrors = {
1169
2586
  /**
1170
2587
  * 请求参数无效
1171
2588
  */
@@ -1191,8 +2608,8 @@ export type PatchApiChatConversationsByIdErrors = {
1191
2608
  */
1192
2609
  500: ErrorResponse;
1193
2610
  };
1194
- export type PatchApiChatConversationsByIdError = PatchApiChatConversationsByIdErrors[keyof PatchApiChatConversationsByIdErrors];
1195
- export type PatchApiChatConversationsByIdResponses = {
2611
+ export type PatchApiChatRoutersByIdError = PatchApiChatRoutersByIdErrors[keyof PatchApiChatRoutersByIdErrors];
2612
+ export type PatchApiChatRoutersByIdResponses = {
1196
2613
  /**
1197
2614
  * 成功
1198
2615
  */
@@ -1201,11 +2618,14 @@ export type PatchApiChatConversationsByIdResponses = {
1201
2618
  * 业务码,成功为 0
1202
2619
  */
1203
2620
  code: number;
2621
+ /**
2622
+ * 提示信息,失败时为错误原因
2623
+ */
1204
2624
  message: string;
1205
- data: Conversation;
2625
+ data: IntentRouter;
1206
2626
  };
1207
2627
  };
1208
- export type PatchApiChatConversationsByIdResponse = PatchApiChatConversationsByIdResponses[keyof PatchApiChatConversationsByIdResponses];
2628
+ export type PatchApiChatRoutersByIdResponse = PatchApiChatRoutersByIdResponses[keyof PatchApiChatRoutersByIdResponses];
1209
2629
  export type GetApiSearchData = {
1210
2630
  body?: never;
1211
2631
  path?: never;
@@ -1222,6 +2642,9 @@ export type GetApiSearchData = {
1222
2642
  * 知识库标识,与 kbId 不能同时为空
1223
2643
  */
1224
2644
  mark?: string;
2645
+ /**
2646
+ * 返回条数上限,默认 20,最大 50
2647
+ */
1225
2648
  limit?: number;
1226
2649
  };
1227
2650
  url: '/api/search';
@@ -1254,6 +2677,9 @@ export type GetApiSearchResponses = {
1254
2677
  * 业务码,成功为 0
1255
2678
  */
1256
2679
  code: number;
2680
+ /**
2681
+ * 提示信息,失败时为错误原因
2682
+ */
1257
2683
  message: string;
1258
2684
  data: Array<SearchHit>;
1259
2685
  };
@@ -1310,6 +2736,9 @@ export type PostApiSearchClickResponses = {
1310
2736
  * 业务码,成功为 0
1311
2737
  */
1312
2738
  code: number;
2739
+ /**
2740
+ * 提示信息,失败时为错误原因
2741
+ */
1313
2742
  message: string;
1314
2743
  data: null;
1315
2744
  };
@@ -1341,6 +2770,9 @@ export type GetApiKnowledgeBasesResponses = {
1341
2770
  * 业务码,成功为 0
1342
2771
  */
1343
2772
  code: number;
2773
+ /**
2774
+ * 提示信息,失败时为错误原因
2775
+ */
1344
2776
  message: string;
1345
2777
  data: Array<KnowledgeBaseListItem>;
1346
2778
  };
@@ -1348,11 +2780,30 @@ export type GetApiKnowledgeBasesResponses = {
1348
2780
  export type GetApiKnowledgeBasesResponse = GetApiKnowledgeBasesResponses[keyof GetApiKnowledgeBasesResponses];
1349
2781
  export type PostApiKnowledgeBasesData = {
1350
2782
  body: {
2783
+ /**
2784
+ * 名称
2785
+ */
1351
2786
  name: string;
2787
+ /**
2788
+ * 知识库唯一标识,不可包含逗号
2789
+ */
1352
2790
  mark: string;
2791
+ /**
2792
+ * 描述
2793
+ */
1353
2794
  description?: string | null;
2795
+ /**
2796
+ * 文档分块大小(字符),不小于 100;null 继承全局
2797
+ */
1354
2798
  chunkSize?: number | null;
2799
+ /**
2800
+ * 相邻分块重叠字符数,需小于分块大小;null 继承全局
2801
+ */
1355
2802
  chunkOverlap?: number | null;
2803
+ /**
2804
+ * 召回时可按「字段=值」等条件过滤的文档 front matter 字段名
2805
+ */
2806
+ filterFields?: Array<string>;
1356
2807
  };
1357
2808
  path?: never;
1358
2809
  query?: never;
@@ -1386,8 +2837,14 @@ export type PostApiKnowledgeBasesResponses = {
1386
2837
  * 业务码,成功为 0
1387
2838
  */
1388
2839
  code: number;
2840
+ /**
2841
+ * 提示信息,失败时为错误原因
2842
+ */
1389
2843
  message: string;
1390
2844
  data: {
2845
+ /**
2846
+ * 新建知识库 ID
2847
+ */
1391
2848
  id: number;
1392
2849
  };
1393
2850
  };
@@ -1396,6 +2853,9 @@ export type PostApiKnowledgeBasesResponse = PostApiKnowledgeBasesResponses[keyof
1396
2853
  export type DeleteApiKnowledgeBasesByIdData = {
1397
2854
  body?: never;
1398
2855
  path: {
2856
+ /**
2857
+ * 资源 ID
2858
+ */
1399
2859
  id: string;
1400
2860
  };
1401
2861
  query?: never;
@@ -1437,6 +2897,9 @@ export type DeleteApiKnowledgeBasesByIdResponses = {
1437
2897
  * 业务码,成功为 0
1438
2898
  */
1439
2899
  code: number;
2900
+ /**
2901
+ * 提示信息,失败时为错误原因
2902
+ */
1440
2903
  message: string;
1441
2904
  data: null;
1442
2905
  };
@@ -1445,6 +2908,9 @@ export type DeleteApiKnowledgeBasesByIdResponse = DeleteApiKnowledgeBasesByIdRes
1445
2908
  export type GetApiKnowledgeBasesByIdData = {
1446
2909
  body?: never;
1447
2910
  path: {
2911
+ /**
2912
+ * 资源 ID
2913
+ */
1448
2914
  id: string;
1449
2915
  };
1450
2916
  query?: never;
@@ -1486,6 +2952,9 @@ export type GetApiKnowledgeBasesByIdResponses = {
1486
2952
  * 业务码,成功为 0
1487
2953
  */
1488
2954
  code: number;
2955
+ /**
2956
+ * 提示信息,失败时为错误原因
2957
+ */
1489
2958
  message: string;
1490
2959
  data: KnowledgeBase;
1491
2960
  };
@@ -1493,13 +2962,35 @@ export type GetApiKnowledgeBasesByIdResponses = {
1493
2962
  export type GetApiKnowledgeBasesByIdResponse = GetApiKnowledgeBasesByIdResponses[keyof GetApiKnowledgeBasesByIdResponses];
1494
2963
  export type PatchApiKnowledgeBasesByIdData = {
1495
2964
  body: {
2965
+ /**
2966
+ * 名称
2967
+ */
1496
2968
  name?: string;
2969
+ /**
2970
+ * 知识库唯一标识,不可包含逗号
2971
+ */
1497
2972
  mark?: string;
2973
+ /**
2974
+ * 描述
2975
+ */
1498
2976
  description?: string | null;
2977
+ /**
2978
+ * 文档分块大小(字符),不小于 100;null 继承全局
2979
+ */
1499
2980
  chunkSize?: number | null;
2981
+ /**
2982
+ * 相邻分块重叠字符数,需小于分块大小;null 继承全局
2983
+ */
1500
2984
  chunkOverlap?: number | null;
2985
+ /**
2986
+ * 召回时可按「字段=值」等条件过滤的文档 front matter 字段名
2987
+ */
2988
+ filterFields?: Array<string>;
1501
2989
  };
1502
2990
  path: {
2991
+ /**
2992
+ * 资源 ID
2993
+ */
1503
2994
  id: string;
1504
2995
  };
1505
2996
  query?: never;
@@ -1541,11 +3032,47 @@ export type PatchApiKnowledgeBasesByIdResponses = {
1541
3032
  * 业务码,成功为 0
1542
3033
  */
1543
3034
  code: number;
3035
+ /**
3036
+ * 提示信息,失败时为错误原因
3037
+ */
1544
3038
  message: string;
1545
3039
  data: KnowledgeBase;
1546
3040
  };
1547
3041
  };
1548
3042
  export type PatchApiKnowledgeBasesByIdResponse = PatchApiKnowledgeBasesByIdResponses[keyof PatchApiKnowledgeBasesByIdResponses];
3043
+ export type GetApiKnowledgeBasesByIdExportData = {
3044
+ body?: never;
3045
+ path: {
3046
+ /**
3047
+ * 资源 ID
3048
+ */
3049
+ id: string;
3050
+ };
3051
+ query?: never;
3052
+ url: '/api/knowledge-bases/{id}/export';
3053
+ };
3054
+ export type GetApiKnowledgeBasesByIdExportErrors = {
3055
+ /**
3056
+ * 未登录
3057
+ */
3058
+ 401: ErrorResponse;
3059
+ /**
3060
+ * 资源不存在
3061
+ */
3062
+ 404: ErrorResponse;
3063
+ /**
3064
+ * 服务器内部错误
3065
+ */
3066
+ 500: ErrorResponse;
3067
+ };
3068
+ export type GetApiKnowledgeBasesByIdExportError = GetApiKnowledgeBasesByIdExportErrors[keyof GetApiKnowledgeBasesByIdExportErrors];
3069
+ export type GetApiKnowledgeBasesByIdExportResponses = {
3070
+ /**
3071
+ * Zip 二进制流
3072
+ */
3073
+ 200: Blob | File;
3074
+ };
3075
+ export type GetApiKnowledgeBasesByIdExportResponse = GetApiKnowledgeBasesByIdExportResponses[keyof GetApiKnowledgeBasesByIdExportResponses];
1549
3076
  export type GetApiRagsData = {
1550
3077
  body?: never;
1551
3078
  path?: never;
@@ -1572,6 +3099,9 @@ export type GetApiRagsResponses = {
1572
3099
  * 业务码,成功为 0
1573
3100
  */
1574
3101
  code: number;
3102
+ /**
3103
+ * 提示信息,失败时为错误原因
3104
+ */
1575
3105
  message: string;
1576
3106
  data: Array<Rag>;
1577
3107
  };
@@ -1579,22 +3109,78 @@ export type GetApiRagsResponses = {
1579
3109
  export type GetApiRagsResponse = GetApiRagsResponses[keyof GetApiRagsResponses];
1580
3110
  export type PostApiRagsData = {
1581
3111
  body: {
3112
+ /**
3113
+ * 名称
3114
+ */
1582
3115
  name: string;
3116
+ /**
3117
+ * 描述;作为智能路由候选且未填写意图时,用作意图描述
3118
+ */
1583
3119
  description?: string | null;
3120
+ /**
3121
+ * 问答助手唯一标识,可用于创建会话;不可包含逗号
3122
+ */
1584
3123
  mark?: string | null;
3124
+ /**
3125
+ * 绑定的知识库 ID
3126
+ */
1585
3127
  kbId: number;
3128
+ /**
3129
+ * 系统提示词,支持 {{context}} 检索资料、{{fallback}} 低匹配度默认回复变量;null 继承全局
3130
+ */
1586
3131
  systemPrompt?: string | null;
3132
+ /**
3133
+ * 问题拆分提示词;null 继承全局
3134
+ */
1587
3135
  splitPrompt?: string | null;
3136
+ /**
3137
+ * 是否将用户问题拆分为多个子问题分别检索;null 继承全局
3138
+ */
1588
3139
  splitQuery?: boolean | null;
3140
+ /**
3141
+ * 向量检索匹配度阈值,取值 0~1,低于阈值的结果被过滤;null 继承全局
3142
+ */
1589
3143
  scoreThreshold?: number | null;
3144
+ /**
3145
+ * 检索结果全部低于阈值时的回复文案;null 继承全局
3146
+ */
1590
3147
  lowScoreReply?: string | null;
3148
+ /**
3149
+ * 深度思考:default 使用模型默认,false 关闭,low / medium / high 为思考强度;null 继承全局
3150
+ */
1591
3151
  deepThinking?: 'default' | 'false' | 'low' | 'medium' | 'high' | null;
3152
+ /**
3153
+ * 是否开启多轮对话(携带历史上下文);null 继承全局
3154
+ */
1592
3155
  multiTurn?: boolean | null;
3156
+ /**
3157
+ * 多轮对话上下文 Token 阈值,超出后压缩历史;null 继承全局
3158
+ */
1593
3159
  contextThreshold?: number | null;
3160
+ /**
3161
+ * 每个问题向量检索的最大匹配数;null 继承全局
3162
+ */
1594
3163
  retrieveLimit?: number | null;
3164
+ /**
3165
+ * 单条消息图片数量上限;null 继承全局
3166
+ */
1595
3167
  imageMaxCount?: number | null;
3168
+ /**
3169
+ * 对话图片压缩最长边(像素);null 继承全局
3170
+ */
1596
3171
  imageMaxEdge?: number | null;
3172
+ /**
3173
+ * 文本模型供应商 ID,与 textModel 需同时填写;null 使用全局文本模型
3174
+ */
3175
+ textProviderId?: number | null;
3176
+ /**
3177
+ * 文本模型名称,与 textProviderId 需同时填写;null 使用全局文本模型
3178
+ */
3179
+ textModel?: string | null;
1597
3180
  welcome?: RagWelcomeConfig;
3181
+ /**
3182
+ * 推荐问题列表;null 继承全局
3183
+ */
1598
3184
  recommendedQuestions?: Array<string> | null;
1599
3185
  };
1600
3186
  path?: never;
@@ -1625,8 +3211,14 @@ export type PostApiRagsResponses = {
1625
3211
  * 业务码,成功为 0
1626
3212
  */
1627
3213
  code: number;
3214
+ /**
3215
+ * 提示信息,失败时为错误原因
3216
+ */
1628
3217
  message: string;
1629
3218
  data: {
3219
+ /**
3220
+ * 新建问答助手 ID
3221
+ */
1630
3222
  id: number;
1631
3223
  };
1632
3224
  };
@@ -1635,6 +3227,9 @@ export type PostApiRagsResponse = PostApiRagsResponses[keyof PostApiRagsResponse
1635
3227
  export type DeleteApiRagsByIdData = {
1636
3228
  body?: never;
1637
3229
  path: {
3230
+ /**
3231
+ * 资源 ID
3232
+ */
1638
3233
  id: string;
1639
3234
  };
1640
3235
  query?: never;
@@ -1676,6 +3271,9 @@ export type DeleteApiRagsByIdResponses = {
1676
3271
  * 业务码,成功为 0
1677
3272
  */
1678
3273
  code: number;
3274
+ /**
3275
+ * 提示信息,失败时为错误原因
3276
+ */
1679
3277
  message: string;
1680
3278
  data: null;
1681
3279
  };
@@ -1684,6 +3282,9 @@ export type DeleteApiRagsByIdResponse = DeleteApiRagsByIdResponses[keyof DeleteA
1684
3282
  export type GetApiRagsByIdData = {
1685
3283
  body?: never;
1686
3284
  path: {
3285
+ /**
3286
+ * 资源 ID
3287
+ */
1687
3288
  id: string;
1688
3289
  };
1689
3290
  query?: never;
@@ -1725,6 +3326,9 @@ export type GetApiRagsByIdResponses = {
1725
3326
  * 业务码,成功为 0
1726
3327
  */
1727
3328
  code: number;
3329
+ /**
3330
+ * 提示信息,失败时为错误原因
3331
+ */
1728
3332
  message: string;
1729
3333
  data: Rag;
1730
3334
  };
@@ -1732,25 +3336,84 @@ export type GetApiRagsByIdResponses = {
1732
3336
  export type GetApiRagsByIdResponse = GetApiRagsByIdResponses[keyof GetApiRagsByIdResponses];
1733
3337
  export type PatchApiRagsByIdData = {
1734
3338
  body: {
3339
+ /**
3340
+ * 名称
3341
+ */
1735
3342
  name?: string;
3343
+ /**
3344
+ * 描述;作为智能路由候选且未填写意图时,用作意图描述
3345
+ */
1736
3346
  description?: string | null;
3347
+ /**
3348
+ * 问答助手唯一标识,可用于创建会话;不可包含逗号
3349
+ */
1737
3350
  mark?: string | null;
3351
+ /**
3352
+ * 绑定的知识库 ID
3353
+ */
1738
3354
  kbId?: number;
3355
+ /**
3356
+ * 系统提示词,支持 {{context}} 检索资料、{{fallback}} 低匹配度默认回复变量;null 继承全局
3357
+ */
1739
3358
  systemPrompt?: string | null;
3359
+ /**
3360
+ * 问题拆分提示词;null 继承全局
3361
+ */
1740
3362
  splitPrompt?: string | null;
3363
+ /**
3364
+ * 是否将用户问题拆分为多个子问题分别检索;null 继承全局
3365
+ */
1741
3366
  splitQuery?: boolean | null;
3367
+ /**
3368
+ * 向量检索匹配度阈值,取值 0~1,低于阈值的结果被过滤;null 继承全局
3369
+ */
1742
3370
  scoreThreshold?: number | null;
3371
+ /**
3372
+ * 检索结果全部低于阈值时的回复文案;null 继承全局
3373
+ */
1743
3374
  lowScoreReply?: string | null;
3375
+ /**
3376
+ * 深度思考:default 使用模型默认,false 关闭,low / medium / high 为思考强度;null 继承全局
3377
+ */
1744
3378
  deepThinking?: 'default' | 'false' | 'low' | 'medium' | 'high' | null;
3379
+ /**
3380
+ * 是否开启多轮对话(携带历史上下文);null 继承全局
3381
+ */
1745
3382
  multiTurn?: boolean | null;
3383
+ /**
3384
+ * 多轮对话上下文 Token 阈值,超出后压缩历史;null 继承全局
3385
+ */
1746
3386
  contextThreshold?: number | null;
3387
+ /**
3388
+ * 每个问题向量检索的最大匹配数;null 继承全局
3389
+ */
1747
3390
  retrieveLimit?: number | null;
3391
+ /**
3392
+ * 单条消息图片数量上限;null 继承全局
3393
+ */
1748
3394
  imageMaxCount?: number | null;
3395
+ /**
3396
+ * 对话图片压缩最长边(像素);null 继承全局
3397
+ */
1749
3398
  imageMaxEdge?: number | null;
3399
+ /**
3400
+ * 文本模型供应商 ID,与 textModel 需同时填写;null 使用全局文本模型
3401
+ */
3402
+ textProviderId?: number | null;
3403
+ /**
3404
+ * 文本模型名称,与 textProviderId 需同时填写;null 使用全局文本模型
3405
+ */
3406
+ textModel?: string | null;
1750
3407
  welcome?: RagWelcomeConfig;
3408
+ /**
3409
+ * 推荐问题列表;null 继承全局
3410
+ */
1751
3411
  recommendedQuestions?: Array<string> | null;
1752
3412
  };
1753
3413
  path: {
3414
+ /**
3415
+ * 资源 ID
3416
+ */
1754
3417
  id: string;
1755
3418
  };
1756
3419
  query?: never;
@@ -1792,6 +3455,9 @@ export type PatchApiRagsByIdResponses = {
1792
3455
  * 业务码,成功为 0
1793
3456
  */
1794
3457
  code: number;
3458
+ /**
3459
+ * 提示信息,失败时为错误原因
3460
+ */
1795
3461
  message: string;
1796
3462
  data: Rag;
1797
3463
  };
@@ -1801,7 +3467,13 @@ export type GetApiRagsDetailData = {
1801
3467
  body?: never;
1802
3468
  path?: never;
1803
3469
  query?: {
3470
+ /**
3471
+ * 问答助手 ID,与 mark 不能同时为空
3472
+ */
1804
3473
  id?: number | null;
3474
+ /**
3475
+ * 问答助手标识,与 id 不能同时为空
3476
+ */
1805
3477
  mark?: string;
1806
3478
  };
1807
3479
  url: '/api/rags/detail';
@@ -1834,6 +3506,9 @@ export type GetApiRagsDetailResponses = {
1834
3506
  * 业务码,成功为 0
1835
3507
  */
1836
3508
  code: number;
3509
+ /**
3510
+ * 提示信息,失败时为错误原因
3511
+ */
1837
3512
  message: string;
1838
3513
  data: RagDetail;
1839
3514
  };
@@ -1878,6 +3553,9 @@ export type DeleteApiDocumentsResponses = {
1878
3553
  * 业务码,成功为 0
1879
3554
  */
1880
3555
  code: number;
3556
+ /**
3557
+ * 提示信息,失败时为错误原因
3558
+ */
1881
3559
  message: string;
1882
3560
  data: null;
1883
3561
  };
@@ -1918,6 +3596,9 @@ export type GetApiDocumentsResponses = {
1918
3596
  * 业务码,成功为 0
1919
3597
  */
1920
3598
  code: number;
3599
+ /**
3600
+ * 提示信息,失败时为错误原因
3601
+ */
1921
3602
  message: string;
1922
3603
  data: Array<DocumentSummary>;
1923
3604
  };
@@ -1925,7 +3606,13 @@ export type GetApiDocumentsResponses = {
1925
3606
  export type GetApiDocumentsResponse = GetApiDocumentsResponses[keyof GetApiDocumentsResponses];
1926
3607
  export type PostApiDocumentsData = {
1927
3608
  body?: {
3609
+ /**
3610
+ * 文档名,不能包含 /,同级不能与文件夹或文档重名
3611
+ */
1928
3612
  filename: string;
3613
+ /**
3614
+ * 所在文件夹 ID,不传或 null 表示根目录
3615
+ */
1929
3616
  folderId?: string | null;
1930
3617
  visibility?: Visibility;
1931
3618
  };
@@ -1966,6 +3653,9 @@ export type PostApiDocumentsResponses = {
1966
3653
  * 业务码,成功为 0
1967
3654
  */
1968
3655
  code: number;
3656
+ /**
3657
+ * 提示信息,失败时为错误原因
3658
+ */
1969
3659
  message: string;
1970
3660
  data: DocumentSummary;
1971
3661
  };
@@ -2010,6 +3700,9 @@ export type GetApiDocumentsTreeResponses = {
2010
3700
  * 业务码,成功为 0
2011
3701
  */
2012
3702
  code: number;
3703
+ /**
3704
+ * 提示信息,失败时为错误原因
3705
+ */
2013
3706
  message: string;
2014
3707
  data: Array<DocumentTreeNode>;
2015
3708
  };
@@ -2057,6 +3750,9 @@ export type PatchApiDocumentsByPathResponses = {
2057
3750
  * 业务码,成功为 0
2058
3751
  */
2059
3752
  code: number;
3753
+ /**
3754
+ * 提示信息,失败时为错误原因
3755
+ */
2060
3756
  message: string;
2061
3757
  data: Document;
2062
3758
  };
@@ -2065,6 +3761,9 @@ export type PatchApiDocumentsByPathResponse = PatchApiDocumentsByPathResponses[k
2065
3761
  export type DeleteApiDocumentsByIdData = {
2066
3762
  body?: never;
2067
3763
  path: {
3764
+ /**
3765
+ * 资源 ID
3766
+ */
2068
3767
  id: string;
2069
3768
  };
2070
3769
  query?: never;
@@ -2106,6 +3805,9 @@ export type DeleteApiDocumentsByIdResponses = {
2106
3805
  * 业务码,成功为 0
2107
3806
  */
2108
3807
  code: number;
3808
+ /**
3809
+ * 提示信息,失败时为错误原因
3810
+ */
2109
3811
  message: string;
2110
3812
  data: null;
2111
3813
  };
@@ -2114,9 +3816,15 @@ export type DeleteApiDocumentsByIdResponse = DeleteApiDocumentsByIdResponses[key
2114
3816
  export type GetApiDocumentsByIdData = {
2115
3817
  body?: never;
2116
3818
  path: {
3819
+ /**
3820
+ * 资源 ID
3821
+ */
2117
3822
  id: string;
2118
3823
  };
2119
3824
  query?: {
3825
+ /**
3826
+ * 访问来源,用于访问统计:docs 文档页、search 检索结果;不传记为直接访问
3827
+ */
2120
3828
  source?: 'docs' | 'search';
2121
3829
  };
2122
3830
  url: '/api/documents/{id}';
@@ -2145,6 +3853,9 @@ export type GetApiDocumentsByIdResponses = {
2145
3853
  * 业务码,成功为 0
2146
3854
  */
2147
3855
  code: number;
3856
+ /**
3857
+ * 提示信息,失败时为错误原因
3858
+ */
2148
3859
  message: string;
2149
3860
  data: Document;
2150
3861
  };
@@ -2152,15 +3863,36 @@ export type GetApiDocumentsByIdResponses = {
2152
3863
  export type GetApiDocumentsByIdResponse = GetApiDocumentsByIdResponses[keyof GetApiDocumentsByIdResponses];
2153
3864
  export type PatchApiDocumentsByIdData = {
2154
3865
  body: {
3866
+ /**
3867
+ * 文档名
3868
+ */
2155
3869
  filename?: string;
3870
+ /**
3871
+ * Markdown 正文,修改后重新分块与向量化
3872
+ */
2156
3873
  content?: string;
2157
3874
  visibility?: Visibility;
3875
+ /**
3876
+ * 分块大小(字符),不小于 100;null 继承知识库或全局
3877
+ */
2158
3878
  chunkSize?: number | null;
3879
+ /**
3880
+ * 分块重叠字符数,需小于分块大小;null 继承知识库或全局
3881
+ */
2159
3882
  chunkOverlap?: number | null;
3883
+ /**
3884
+ * 移动到的目标文件夹 ID,null 表示根目录
3885
+ */
2160
3886
  folderId?: string | null;
3887
+ /**
3888
+ * 在目标目录中的排序位置,从 0 开始
3889
+ */
2161
3890
  index?: number;
2162
3891
  };
2163
3892
  path: {
3893
+ /**
3894
+ * 资源 ID
3895
+ */
2164
3896
  id: string;
2165
3897
  };
2166
3898
  query?: never;
@@ -2202,6 +3934,9 @@ export type PatchApiDocumentsByIdResponses = {
2202
3934
  * 业务码,成功为 0
2203
3935
  */
2204
3936
  code: number;
3937
+ /**
3938
+ * 提示信息,失败时为错误原因
3939
+ */
2205
3940
  message: string;
2206
3941
  data: Document;
2207
3942
  };
@@ -2210,6 +3945,9 @@ export type PatchApiDocumentsByIdResponse = PatchApiDocumentsByIdResponses[keyof
2210
3945
  export type PostApiDocumentsByIdCopyData = {
2211
3946
  body?: never;
2212
3947
  path: {
3948
+ /**
3949
+ * 资源 ID
3950
+ */
2213
3951
  id: string;
2214
3952
  };
2215
3953
  query?: never;
@@ -2251,6 +3989,9 @@ export type PostApiDocumentsByIdCopyResponses = {
2251
3989
  * 业务码,成功为 0
2252
3990
  */
2253
3991
  code: number;
3992
+ /**
3993
+ * 提示信息,失败时为错误原因
3994
+ */
2254
3995
  message: string;
2255
3996
  data: Document;
2256
3997
  };
@@ -2260,7 +4001,13 @@ export type GetApiFoldersData = {
2260
4001
  body?: never;
2261
4002
  path?: never;
2262
4003
  query?: {
4004
+ /**
4005
+ * 知识库 ID,与 mark 不能同时为空
4006
+ */
2263
4007
  kbId?: number | null;
4008
+ /**
4009
+ * 知识库标识,与 kbId 不能同时为空
4010
+ */
2264
4011
  mark?: string;
2265
4012
  };
2266
4013
  url: '/api/folders';
@@ -2293,6 +4040,9 @@ export type GetApiFoldersResponses = {
2293
4040
  * 业务码,成功为 0
2294
4041
  */
2295
4042
  code: number;
4043
+ /**
4044
+ * 提示信息,失败时为错误原因
4045
+ */
2296
4046
  message: string;
2297
4047
  data: Array<Folder>;
2298
4048
  };
@@ -2300,9 +4050,18 @@ export type GetApiFoldersResponses = {
2300
4050
  export type GetApiFoldersResponse = GetApiFoldersResponses[keyof GetApiFoldersResponses];
2301
4051
  export type PostApiFoldersData = {
2302
4052
  body: {
4053
+ /**
4054
+ * 文件夹名,不能包含 /,同级不能与文件夹或文档重名
4055
+ */
2303
4056
  name: string;
4057
+ /**
4058
+ * 父文件夹 ID,不传或 null 表示根目录
4059
+ */
2304
4060
  parentId?: string | null;
2305
4061
  visibility?: Visibility;
4062
+ /**
4063
+ * 所属知识库 ID
4064
+ */
2306
4065
  kbId: number;
2307
4066
  };
2308
4067
  path?: never;
@@ -2337,6 +4096,9 @@ export type PostApiFoldersResponses = {
2337
4096
  * 业务码,成功为 0
2338
4097
  */
2339
4098
  code: number;
4099
+ /**
4100
+ * 提示信息,失败时为错误原因
4101
+ */
2340
4102
  message: string;
2341
4103
  data: Folder;
2342
4104
  };
@@ -2345,6 +4107,9 @@ export type PostApiFoldersResponse = PostApiFoldersResponses[keyof PostApiFolder
2345
4107
  export type DeleteApiFoldersByIdData = {
2346
4108
  body?: never;
2347
4109
  path: {
4110
+ /**
4111
+ * 资源 ID
4112
+ */
2348
4113
  id: string;
2349
4114
  };
2350
4115
  query?: never;
@@ -2386,6 +4151,9 @@ export type DeleteApiFoldersByIdResponses = {
2386
4151
  * 业务码,成功为 0
2387
4152
  */
2388
4153
  code: number;
4154
+ /**
4155
+ * 提示信息,失败时为错误原因
4156
+ */
2389
4157
  message: string;
2390
4158
  data: null;
2391
4159
  };
@@ -2393,12 +4161,24 @@ export type DeleteApiFoldersByIdResponses = {
2393
4161
  export type DeleteApiFoldersByIdResponse = DeleteApiFoldersByIdResponses[keyof DeleteApiFoldersByIdResponses];
2394
4162
  export type PatchApiFoldersByIdData = {
2395
4163
  body: {
4164
+ /**
4165
+ * 文件夹名,不能包含 /
4166
+ */
2396
4167
  name?: string;
4168
+ /**
4169
+ * 移动到的父文件夹 ID,null 表示根目录
4170
+ */
2397
4171
  parentId?: string | null;
2398
4172
  visibility?: Visibility;
4173
+ /**
4174
+ * 在同级中的排序位置,从 0 开始
4175
+ */
2399
4176
  index?: number;
2400
4177
  };
2401
4178
  path: {
4179
+ /**
4180
+ * 资源 ID
4181
+ */
2402
4182
  id: string;
2403
4183
  };
2404
4184
  query?: never;
@@ -2440,6 +4220,9 @@ export type PatchApiFoldersByIdResponses = {
2440
4220
  * 业务码,成功为 0
2441
4221
  */
2442
4222
  code: number;
4223
+ /**
4224
+ * 提示信息,失败时为错误原因
4225
+ */
2443
4226
  message: string;
2444
4227
  data: Folder;
2445
4228
  };
@@ -2448,6 +4231,9 @@ export type PatchApiFoldersByIdResponse = PatchApiFoldersByIdResponses[keyof Pat
2448
4231
  export type PostApiWorkflowsByIdInvokeData = {
2449
4232
  body: WorkflowInvokeRequest;
2450
4233
  path: {
4234
+ /**
4235
+ * 资源 ID
4236
+ */
2451
4237
  id: string;
2452
4238
  };
2453
4239
  query?: never;
@@ -2489,6 +4275,9 @@ export type PostApiWorkflowsByIdInvokeResponses = {
2489
4275
  * 业务码,成功为 0
2490
4276
  */
2491
4277
  code: number;
4278
+ /**
4279
+ * 提示信息,失败时为错误原因
4280
+ */
2492
4281
  message: string;
2493
4282
  data: WorkflowInvokeResult;
2494
4283
  };