@dxpos/knowledge 0.10.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,282 +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
  };
173
- export type Rag = {
610
+ /**
611
+ * 按当前角色可见范围统计的文档数;阅览者仅统计公开文档
612
+ */
613
+ export type KnowledgeBaseDocumentStats = {
614
+ /**
615
+ * 公开文档数
616
+ */
617
+ public: number;
618
+ /**
619
+ * 内部文档数,阅览者不返回
620
+ */
621
+ internal?: number;
622
+ /**
623
+ * 私有文档数,阅览者不返回
624
+ */
625
+ private?: number;
626
+ /**
627
+ * 当前角色可见的文档总数
628
+ */
629
+ total: number;
630
+ };
631
+ /**
632
+ * 知识库列表项,含文档数统计
633
+ */
634
+ export type KnowledgeBaseListItem = {
635
+ /**
636
+ * 知识库 ID
637
+ */
174
638
  id: number;
175
- name: string;
639
+ /**
640
+ * 名称
641
+ */
642
+ name: string;
643
+ /**
644
+ * 知识库唯一标识,不可包含逗号
645
+ */
646
+ mark: string;
647
+ /**
648
+ * 描述
649
+ */
650
+ description: string | null;
651
+ /**
652
+ * 文档分块大小(字符),不小于 100;null 继承全局
653
+ */
654
+ chunkSize: number | null;
655
+ /**
656
+ * 相邻分块重叠字符数,需小于分块大小;null 继承全局
657
+ */
658
+ chunkOverlap: number | null;
659
+ /**
660
+ * 召回时可按「字段=值」等条件过滤的文档 front matter 字段名
661
+ */
662
+ filterFields: Array<string>;
663
+ /**
664
+ * 创建人用户 ID
665
+ */
666
+ createdBy: string | null;
667
+ /**
668
+ * 最后更新人用户 ID
669
+ */
670
+ updatedBy: string | null;
671
+ /**
672
+ * 创建时间
673
+ */
674
+ createdAt: string;
675
+ /**
676
+ * 更新时间
677
+ */
678
+ updatedAt: string;
679
+ documentStats: KnowledgeBaseDocumentStats;
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
+ */
715
+ export type Rag = {
716
+ /**
717
+ * 问答助手 ID
718
+ */
719
+ id: number;
720
+ /**
721
+ * 名称
722
+ */
723
+ name: string;
724
+ /**
725
+ * 描述;作为智能路由候选且未填写意图时,用作意图描述
726
+ */
176
727
  description: string | null;
728
+ /**
729
+ * 问答助手唯一标识,可用于创建会话;不可包含逗号
730
+ */
177
731
  mark: string | null;
732
+ /**
733
+ * 绑定的知识库 ID
734
+ */
178
735
  kbId: number;
736
+ /**
737
+ * 系统提示词,支持 {{context}} 检索资料、{{fallback}} 低匹配度默认回复变量;null 继承全局
738
+ */
179
739
  systemPrompt: string | null;
740
+ /**
741
+ * 问题拆分提示词;null 继承全局
742
+ */
180
743
  splitPrompt: string | null;
744
+ /**
745
+ * 是否将用户问题拆分为多个子问题分别检索;null 继承全局
746
+ */
181
747
  splitQuery: boolean | null;
748
+ /**
749
+ * 向量检索匹配度阈值,取值 0~1,低于阈值的结果被过滤;null 继承全局
750
+ */
182
751
  scoreThreshold: number | null;
752
+ /**
753
+ * 检索结果全部低于阈值时的回复文案;null 继承全局
754
+ */
183
755
  lowScoreReply: string | null;
756
+ /**
757
+ * 深度思考:default 使用模型默认,false 关闭,low / medium / high 为思考强度;null 继承全局
758
+ */
184
759
  deepThinking: 'default' | 'false' | 'low' | 'medium' | 'high' | null;
760
+ /**
761
+ * 是否开启多轮对话(携带历史上下文);null 继承全局
762
+ */
185
763
  multiTurn: boolean | null;
764
+ /**
765
+ * 多轮对话上下文 Token 阈值,超出后压缩历史;null 继承全局
766
+ */
186
767
  contextThreshold: number | null;
768
+ /**
769
+ * 每个问题向量检索的最大匹配数;null 继承全局
770
+ */
187
771
  retrieveLimit: number | null;
772
+ /**
773
+ * 单条消息图片数量上限;null 继承全局
774
+ */
188
775
  imageMaxCount: number | null;
776
+ /**
777
+ * 对话图片压缩最长边(像素);null 继承全局
778
+ */
189
779
  imageMaxEdge: number | null;
780
+ /**
781
+ * 文本模型供应商 ID,与 textModel 需同时填写;null 使用全局文本模型
782
+ */
783
+ textProviderId: number | null;
784
+ /**
785
+ * 文本模型名称,与 textProviderId 需同时填写;null 使用全局文本模型
786
+ */
787
+ textModel: string | null;
190
788
  welcome: RagWelcomeConfig;
789
+ /**
790
+ * 推荐问题列表;null 继承全局
791
+ */
191
792
  recommendedQuestions: Array<string> | null;
793
+ /**
794
+ * 创建人用户 ID
795
+ */
192
796
  createdBy: string | null;
797
+ /**
798
+ * 最后更新人用户 ID
799
+ */
193
800
  updatedBy: string | null;
801
+ /**
802
+ * 创建时间
803
+ */
194
804
  createdAt: string;
805
+ /**
806
+ * 更新时间
807
+ */
195
808
  updatedAt: string;
196
809
  };
810
+ /**
811
+ * 欢迎语配置;问答助手上为 null 时继承全局
812
+ */
197
813
  export type RagWelcomeConfig = {
814
+ /**
815
+ * 欢迎语文案,null 表示无文案
816
+ */
198
817
  text: string | null;
818
+ /**
819
+ * 欢迎语图片列表
820
+ */
199
821
  images?: Array<RagWelcomeImage>;
200
822
  } | null;
823
+ /**
824
+ * 欢迎语图片
825
+ */
201
826
  export type RagWelcomeImage = {
827
+ /**
828
+ * 图片文件 ID
829
+ */
202
830
  fileId: string;
831
+ /**
832
+ * 图片 MIME 类型
833
+ */
203
834
  mimeType: string;
835
+ /**
836
+ * 当前有效的下载地址,仅响应返回
837
+ */
204
838
  url?: string;
205
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
+ */
206
917
  export type SearchHit = {
918
+ /**
919
+ * 文档 ID
920
+ */
207
921
  documentId: string;
922
+ /**
923
+ * 文档名
924
+ */
208
925
  filename: string;
926
+ /**
927
+ * 命中分块序号
928
+ */
209
929
  chunkIndex: number;
930
+ /**
931
+ * 命中分块原文
932
+ */
210
933
  content: string;
934
+ /**
935
+ * 命中分块原文,关键词高亮的 HTML
936
+ */
211
937
  snippet: string;
938
+ /**
939
+ * 文档名,关键词高亮的 HTML
940
+ */
212
941
  filenameSnippet: string;
942
+ /**
943
+ * 文档 front matter 元数据,字段名到字符串值列表
944
+ */
945
+ metadata: {
946
+ [key: string]: Array<string>;
947
+ };
213
948
  };
214
- export type Visibility = 'public' | 'internal' | 'private';
949
+ /**
950
+ * 文档处理状态:processing 分块与向量化中,ready 可用,failed 处理失败
951
+ */
215
952
  export type DocumentStatus = 'processing' | 'ready' | 'failed';
953
+ /**
954
+ * 知识库文档
955
+ */
216
956
  export type Document = {
957
+ /**
958
+ * 文档 ID
959
+ */
217
960
  id: string;
961
+ /**
962
+ * 所属知识库 ID
963
+ */
218
964
  kbId: number;
965
+ /**
966
+ * 所在文件夹 ID,null 表示根目录
967
+ */
219
968
  folderId: string | null;
969
+ /**
970
+ * 同级排序序号
971
+ */
972
+ sortOrder: number;
973
+ /**
974
+ * 文档名
975
+ */
220
976
  filename: string;
977
+ /**
978
+ * Markdown 正文
979
+ */
221
980
  content: string;
981
+ /**
982
+ * 正文字符数
983
+ */
222
984
  charCount: number;
985
+ /**
986
+ * 分块数
987
+ */
223
988
  chunkCount: number;
224
989
  status: DocumentStatus;
225
990
  visibility: Visibility;
991
+ /**
992
+ * 分块大小(字符);null 继承知识库或全局
993
+ */
226
994
  chunkSize: number | null;
995
+ /**
996
+ * 分块重叠字符数;null 继承知识库或全局
997
+ */
227
998
  chunkOverlap: number | null;
999
+ /**
1000
+ * 创建人用户 ID
1001
+ */
228
1002
  createdBy: string | null;
1003
+ /**
1004
+ * 最后更新人用户 ID
1005
+ */
229
1006
  updatedBy: string | null;
1007
+ /**
1008
+ * 创建时间
1009
+ */
230
1010
  createdAt: string;
1011
+ /**
1012
+ * 更新时间
1013
+ */
231
1014
  updatedAt: string;
232
1015
  };
1016
+ /**
1017
+ * 文档摘要,不含正文
1018
+ */
233
1019
  export type DocumentSummary = {
1020
+ /**
1021
+ * 文档 ID
1022
+ */
234
1023
  id: string;
1024
+ /**
1025
+ * 所属知识库 ID
1026
+ */
235
1027
  kbId: number;
1028
+ /**
1029
+ * 所在文件夹 ID,null 表示根目录
1030
+ */
236
1031
  folderId: string | null;
1032
+ /**
1033
+ * 同级排序序号
1034
+ */
1035
+ sortOrder: number;
1036
+ /**
1037
+ * 文档名
1038
+ */
237
1039
  filename: string;
1040
+ /**
1041
+ * 正文字符数
1042
+ */
238
1043
  charCount: number;
1044
+ /**
1045
+ * 分块数
1046
+ */
239
1047
  chunkCount: number;
240
1048
  status: DocumentStatus;
241
1049
  visibility: Visibility;
1050
+ /**
1051
+ * 分块大小(字符);null 继承知识库或全局
1052
+ */
242
1053
  chunkSize: number | null;
1054
+ /**
1055
+ * 分块重叠字符数;null 继承知识库或全局
1056
+ */
243
1057
  chunkOverlap: number | null;
1058
+ /**
1059
+ * 创建人用户 ID
1060
+ */
244
1061
  createdBy: string | null;
1062
+ /**
1063
+ * 最后更新人用户 ID
1064
+ */
245
1065
  updatedBy: string | null;
1066
+ /**
1067
+ * 创建时间
1068
+ */
246
1069
  createdAt: string;
1070
+ /**
1071
+ * 更新时间
1072
+ */
247
1073
  updatedAt: string;
248
1074
  };
1075
+ /**
1076
+ * 文档树节点,按 type 区分文件夹或文件
1077
+ */
249
1078
  export type DocumentTreeNode = {
1079
+ /**
1080
+ * 文件夹节点
1081
+ */
250
1082
  type: 'folder';
251
1083
  folder: Folder;
1084
+ /**
1085
+ * 子节点,文件夹在前
1086
+ */
252
1087
  children: Array<DocumentTreeNode>;
253
1088
  } | {
1089
+ /**
1090
+ * 文件节点
1091
+ */
254
1092
  type: 'file';
255
1093
  document: DocumentSummary;
256
1094
  };
1095
+ /**
1096
+ * 知识库文件夹
1097
+ */
257
1098
  export type Folder = {
1099
+ /**
1100
+ * 文件夹 ID
1101
+ */
258
1102
  id: string;
1103
+ /**
1104
+ * 所属知识库 ID
1105
+ */
259
1106
  kbId: number;
1107
+ /**
1108
+ * 文件夹名
1109
+ */
260
1110
  name: string;
1111
+ /**
1112
+ * 父文件夹 ID,null 表示根目录
1113
+ */
261
1114
  parentId: string | null;
1115
+ /**
1116
+ * 同级排序序号
1117
+ */
1118
+ sortOrder: number;
262
1119
  visibility: Visibility;
1120
+ /**
1121
+ * 创建人用户 ID
1122
+ */
263
1123
  createdBy: string | null;
1124
+ /**
1125
+ * 最后更新人用户 ID
1126
+ */
264
1127
  updatedBy: string | null;
1128
+ /**
1129
+ * 创建时间
1130
+ */
265
1131
  createdAt: string;
1132
+ /**
1133
+ * 更新时间
1134
+ */
266
1135
  updatedAt: string;
267
1136
  };
1137
+ /**
1138
+ * 调用工作流请求体
1139
+ */
268
1140
  export type WorkflowInvokeRequest = {
1141
+ /**
1142
+ * 开始节点入参,键为入参名
1143
+ */
269
1144
  input?: {
270
1145
  [key: string]: unknown;
271
1146
  };
272
1147
  };
1148
+ /**
1149
+ * 工作流执行结果
1150
+ */
273
1151
  export type WorkflowInvokeResult = {
1152
+ /**
1153
+ * 执行记录 ID
1154
+ */
274
1155
  executionId: string;
1156
+ /**
1157
+ * 工作流 ID
1158
+ */
275
1159
  workflowId: string;
1160
+ /**
1161
+ * 执行状态:completed 成功,failed 失败
1162
+ */
276
1163
  status: 'completed' | 'failed';
1164
+ /**
1165
+ * 工作流输出,无输出时为 null
1166
+ */
277
1167
  output: {
278
1168
  [key: string]: unknown;
279
1169
  } | null;
1170
+ /**
1171
+ * 失败原因,成功时为 null
1172
+ */
280
1173
  error: string | null;
281
1174
  };
282
1175
  export type ErrorResponse = {
@@ -284,16 +1177,116 @@ export type ErrorResponse = {
284
1177
  * 业务码,成功为 0
285
1178
  */
286
1179
  code: number;
1180
+ /**
1181
+ * 提示信息,失败时为错误原因
1182
+ */
287
1183
  message: string;
288
1184
  data: {
289
1185
  [key: string]: unknown;
290
1186
  } | Array<unknown> | null;
291
1187
  };
292
- export type RagDetail = {
293
- id: number;
294
- name: string;
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
+ */
1273
+ export type RagDetail = {
1274
+ /**
1275
+ * 问答助手 ID
1276
+ */
1277
+ id: number;
1278
+ /**
1279
+ * 名称
1280
+ */
1281
+ name: string;
1282
+ /**
1283
+ * 问答助手唯一标识,可用于创建会话;不可包含逗号
1284
+ */
295
1285
  mark: string | null;
296
1286
  welcome: RagWelcomeConfig;
1287
+ /**
1288
+ * 推荐问题列表;null 继承全局
1289
+ */
297
1290
  recommendedQuestions: Array<string> | null;
298
1291
  };
299
1292
  export type DocumentUpdateByPath = {
@@ -316,7 +1309,13 @@ export type DocumentUpdateByPath = {
316
1309
  };
317
1310
  export type DeleteApiFilesData = {
318
1311
  body: {
1312
+ /**
1313
+ * 待删除文件 ID 列表
1314
+ */
319
1315
  ids: Array<string>;
1316
+ /**
1317
+ * 为 true 时忽略引用强制删除
1318
+ */
320
1319
  force?: boolean;
321
1320
  };
322
1321
  path?: never;
@@ -348,6 +1347,9 @@ export type DeleteApiFilesErrors = {
348
1347
  * 业务码,成功为 0
349
1348
  */
350
1349
  code: number;
1350
+ /**
1351
+ * 提示信息,失败时为错误原因
1352
+ */
351
1353
  message: string;
352
1354
  data: FileReferencedData;
353
1355
  };
@@ -370,8 +1372,14 @@ export type DeleteApiFilesResponses = {
370
1372
  * 业务码,成功为 0
371
1373
  */
372
1374
  code: number;
1375
+ /**
1376
+ * 提示信息,失败时为错误原因
1377
+ */
373
1378
  message: string;
374
1379
  data: {
1380
+ /**
1381
+ * 逐项结果,顺序与请求一致
1382
+ */
375
1383
  results: Array<BatchDeleteFileResult>;
376
1384
  };
377
1385
  };
@@ -381,7 +1389,13 @@ export type GetApiFilesData = {
381
1389
  body?: never;
382
1390
  path?: never;
383
1391
  query?: {
1392
+ /**
1393
+ * 文件归属业务:general 文件页上传,knowledge 知识库文档图片,chat 对话图片,rag 问答助手欢迎语图片,skill 技能压缩包,workflow 工作流图片
1394
+ */
384
1395
  scope?: FileScope;
1396
+ /**
1397
+ * 文件状态:pending 等待上传确认,ready 可用,failed 上传失败
1398
+ */
385
1399
  status?: FileStatus;
386
1400
  /**
387
1401
  * 文件名关键词
@@ -395,12 +1409,333 @@ export type GetApiFilesData = {
395
1409
  * 创建时间止
396
1410
  */
397
1411
  endDate?: string;
1412
+ /**
1413
+ * 每页条数,默认 50,最大 200
1414
+ */
398
1415
  limit?: number;
1416
+ /**
1417
+ * 偏移量,默认 0
1418
+ */
399
1419
  offset?: number;
400
1420
  };
401
1421
  url: '/api/files';
402
1422
  };
403
- export type GetApiFilesErrors = {
1423
+ export type GetApiFilesErrors = {
1424
+ /**
1425
+ * 请求参数无效
1426
+ */
1427
+ 400: ErrorResponse;
1428
+ /**
1429
+ * 未登录
1430
+ */
1431
+ 401: ErrorResponse;
1432
+ /**
1433
+ * 服务器内部错误
1434
+ */
1435
+ 500: ErrorResponse;
1436
+ };
1437
+ export type GetApiFilesError = GetApiFilesErrors[keyof GetApiFilesErrors];
1438
+ export type GetApiFilesResponses = {
1439
+ /**
1440
+ * 成功
1441
+ */
1442
+ 200: {
1443
+ /**
1444
+ * 业务码,成功为 0
1445
+ */
1446
+ code: number;
1447
+ /**
1448
+ * 提示信息,失败时为错误原因
1449
+ */
1450
+ message: string;
1451
+ data: {
1452
+ /**
1453
+ * 当前页文件
1454
+ */
1455
+ items: Array<FileListItem>;
1456
+ /**
1457
+ * 符合条件的文件总数
1458
+ */
1459
+ total: number;
1460
+ };
1461
+ };
1462
+ };
1463
+ export type GetApiFilesResponse = GetApiFilesResponses[keyof GetApiFilesResponses];
1464
+ export type PostApiFilesData = {
1465
+ body: {
1466
+ /**
1467
+ * 待上传文件
1468
+ */
1469
+ files: Array<Blob | File>;
1470
+ scope: FileScope;
1471
+ };
1472
+ path?: never;
1473
+ query?: never;
1474
+ url: '/api/files';
1475
+ };
1476
+ export type PostApiFilesErrors = {
1477
+ /**
1478
+ * 请求参数无效
1479
+ */
1480
+ 400: ErrorResponse;
1481
+ /**
1482
+ * 未登录
1483
+ */
1484
+ 401: ErrorResponse;
1485
+ /**
1486
+ * 无权限
1487
+ */
1488
+ 403: ErrorResponse;
1489
+ /**
1490
+ * 资源不存在
1491
+ */
1492
+ 404: ErrorResponse;
1493
+ /**
1494
+ * LLM 并发已满
1495
+ */
1496
+ 429: ErrorResponse;
1497
+ /**
1498
+ * 服务器内部错误
1499
+ */
1500
+ 500: ErrorResponse;
1501
+ };
1502
+ export type PostApiFilesError = PostApiFilesErrors[keyof PostApiFilesErrors];
1503
+ export type PostApiFilesResponses = {
1504
+ /**
1505
+ * 部分或全部成功
1506
+ */
1507
+ 201: {
1508
+ /**
1509
+ * 业务码,成功为 0
1510
+ */
1511
+ code: number;
1512
+ /**
1513
+ * 提示信息,失败时为错误原因
1514
+ */
1515
+ message: string;
1516
+ data: {
1517
+ /**
1518
+ * 逐项结果,顺序与请求一致
1519
+ */
1520
+ results: Array<BackendUploadResult>;
1521
+ };
1522
+ };
1523
+ };
1524
+ export type PostApiFilesResponse = PostApiFilesResponses[keyof PostApiFilesResponses];
1525
+ export type PostApiFilesPresignData = {
1526
+ body: {
1527
+ /**
1528
+ * 待上传文件列表
1529
+ */
1530
+ items: Array<{
1531
+ /**
1532
+ * 文件名
1533
+ */
1534
+ filename: string;
1535
+ /**
1536
+ * 文件大小(字节)
1537
+ */
1538
+ size: number;
1539
+ /**
1540
+ * MIME 类型
1541
+ */
1542
+ mimeType: string;
1543
+ scope: FileScope;
1544
+ }>;
1545
+ };
1546
+ path?: never;
1547
+ query?: never;
1548
+ url: '/api/files/presign';
1549
+ };
1550
+ export type PostApiFilesPresignErrors = {
1551
+ /**
1552
+ * 请求参数无效
1553
+ */
1554
+ 400: ErrorResponse;
1555
+ /**
1556
+ * 未登录
1557
+ */
1558
+ 401: ErrorResponse;
1559
+ /**
1560
+ * 无权限
1561
+ */
1562
+ 403: ErrorResponse;
1563
+ /**
1564
+ * 资源不存在
1565
+ */
1566
+ 404: ErrorResponse;
1567
+ /**
1568
+ * LLM 并发已满
1569
+ */
1570
+ 429: ErrorResponse;
1571
+ /**
1572
+ * 服务器内部错误
1573
+ */
1574
+ 500: ErrorResponse;
1575
+ };
1576
+ export type PostApiFilesPresignError = PostApiFilesPresignErrors[keyof PostApiFilesPresignErrors];
1577
+ export type PostApiFilesPresignResponses = {
1578
+ /**
1579
+ * 成功
1580
+ */
1581
+ 201: {
1582
+ /**
1583
+ * 业务码,成功为 0
1584
+ */
1585
+ code: number;
1586
+ /**
1587
+ * 提示信息,失败时为错误原因
1588
+ */
1589
+ message: string;
1590
+ data: {
1591
+ /**
1592
+ * 逐项结果,顺序与请求一致
1593
+ */
1594
+ results: Array<PrepareUploadResult>;
1595
+ };
1596
+ };
1597
+ };
1598
+ export type PostApiFilesPresignResponse = PostApiFilesPresignResponses[keyof PostApiFilesPresignResponses];
1599
+ export type PostApiFilesCompleteData = {
1600
+ body: {
1601
+ /**
1602
+ * 预签名直传返回的文件 ID 列表
1603
+ */
1604
+ ids: Array<string>;
1605
+ };
1606
+ path?: never;
1607
+ query?: never;
1608
+ url: '/api/files/complete';
1609
+ };
1610
+ export type PostApiFilesCompleteErrors = {
1611
+ /**
1612
+ * 请求参数无效
1613
+ */
1614
+ 400: ErrorResponse;
1615
+ /**
1616
+ * 未登录
1617
+ */
1618
+ 401: ErrorResponse;
1619
+ /**
1620
+ * 无权限
1621
+ */
1622
+ 403: ErrorResponse;
1623
+ /**
1624
+ * 资源不存在
1625
+ */
1626
+ 404: ErrorResponse;
1627
+ /**
1628
+ * LLM 并发已满
1629
+ */
1630
+ 429: ErrorResponse;
1631
+ /**
1632
+ * 服务器内部错误
1633
+ */
1634
+ 500: ErrorResponse;
1635
+ };
1636
+ export type PostApiFilesCompleteError = PostApiFilesCompleteErrors[keyof PostApiFilesCompleteErrors];
1637
+ export type PostApiFilesCompleteResponses = {
1638
+ /**
1639
+ * 成功
1640
+ */
1641
+ 200: {
1642
+ /**
1643
+ * 业务码,成功为 0
1644
+ */
1645
+ code: number;
1646
+ /**
1647
+ * 提示信息,失败时为错误原因
1648
+ */
1649
+ message: string;
1650
+ data: {
1651
+ /**
1652
+ * 逐项结果,顺序与请求一致
1653
+ */
1654
+ results: Array<CompleteUploadResult>;
1655
+ };
1656
+ };
1657
+ };
1658
+ export type PostApiFilesCompleteResponse = PostApiFilesCompleteResponses[keyof PostApiFilesCompleteResponses];
1659
+ export type PostApiFilesCleanupData = {
1660
+ body: {
1661
+ /**
1662
+ * 为 true 时仅返回候选列表不删除,默认 true
1663
+ */
1664
+ dryRun?: boolean;
1665
+ /**
1666
+ * 仅处理创建超过该时长(小时)的文件,默认 24
1667
+ */
1668
+ olderThanHours?: number;
1669
+ /**
1670
+ * 每批删除数量,默认 100
1671
+ */
1672
+ deleteBatchSize?: number;
1673
+ };
1674
+ path?: never;
1675
+ query?: never;
1676
+ url: '/api/files/cleanup';
1677
+ };
1678
+ export type PostApiFilesCleanupErrors = {
1679
+ /**
1680
+ * 请求参数无效
1681
+ */
1682
+ 400: ErrorResponse;
1683
+ /**
1684
+ * 未登录
1685
+ */
1686
+ 401: ErrorResponse;
1687
+ /**
1688
+ * 无权限
1689
+ */
1690
+ 403: ErrorResponse;
1691
+ /**
1692
+ * 资源不存在
1693
+ */
1694
+ 404: ErrorResponse;
1695
+ /**
1696
+ * LLM 并发已满
1697
+ */
1698
+ 429: ErrorResponse;
1699
+ /**
1700
+ * 服务器内部错误
1701
+ */
1702
+ 500: ErrorResponse;
1703
+ };
1704
+ export type PostApiFilesCleanupError = PostApiFilesCleanupErrors[keyof PostApiFilesCleanupErrors];
1705
+ export type PostApiFilesCleanupResponses = {
1706
+ /**
1707
+ * 成功
1708
+ */
1709
+ 200: {
1710
+ /**
1711
+ * 业务码,成功为 0
1712
+ */
1713
+ code: number;
1714
+ /**
1715
+ * 提示信息,失败时为错误原因
1716
+ */
1717
+ message: string;
1718
+ data: CleanupReport;
1719
+ };
1720
+ };
1721
+ export type PostApiFilesCleanupResponse = PostApiFilesCleanupResponses[keyof PostApiFilesCleanupResponses];
1722
+ export type DeleteApiFilesByIdData = {
1723
+ body?: never;
1724
+ path: {
1725
+ /**
1726
+ * 资源 ID
1727
+ */
1728
+ id: string;
1729
+ };
1730
+ query?: {
1731
+ /**
1732
+ * 为 true 时忽略引用强制删除
1733
+ */
1734
+ force?: boolean;
1735
+ };
1736
+ url: '/api/files/{id}';
1737
+ };
1738
+ export type DeleteApiFilesByIdErrors = {
404
1739
  /**
405
1740
  * 请求参数无效
406
1741
  */
@@ -409,13 +1744,39 @@ export type GetApiFilesErrors = {
409
1744
  * 未登录
410
1745
  */
411
1746
  401: ErrorResponse;
1747
+ /**
1748
+ * 无权限
1749
+ */
1750
+ 403: ErrorResponse;
1751
+ /**
1752
+ * 资源不存在
1753
+ */
1754
+ 404: ErrorResponse;
1755
+ /**
1756
+ * 文件仍被引用
1757
+ */
1758
+ 409: {
1759
+ /**
1760
+ * 业务码,成功为 0
1761
+ */
1762
+ code: number;
1763
+ /**
1764
+ * 提示信息,失败时为错误原因
1765
+ */
1766
+ message: string;
1767
+ data: FileReferencedData;
1768
+ };
1769
+ /**
1770
+ * LLM 并发已满
1771
+ */
1772
+ 429: ErrorResponse;
412
1773
  /**
413
1774
  * 服务器内部错误
414
1775
  */
415
1776
  500: ErrorResponse;
416
1777
  };
417
- export type GetApiFilesError = GetApiFilesErrors[keyof GetApiFilesErrors];
418
- export type GetApiFilesResponses = {
1778
+ export type DeleteApiFilesByIdError = DeleteApiFilesByIdErrors[keyof DeleteApiFilesByIdErrors];
1779
+ export type DeleteApiFilesByIdResponses = {
419
1780
  /**
420
1781
  * 成功
421
1782
  */
@@ -424,24 +1785,26 @@ export type GetApiFilesResponses = {
424
1785
  * 业务码,成功为 0
425
1786
  */
426
1787
  code: number;
1788
+ /**
1789
+ * 提示信息,失败时为错误原因
1790
+ */
427
1791
  message: string;
428
- data: {
429
- items: Array<FileListItem>;
430
- total: number;
431
- };
1792
+ data: null;
432
1793
  };
433
1794
  };
434
- export type GetApiFilesResponse = GetApiFilesResponses[keyof GetApiFilesResponses];
435
- export type PostApiFilesData = {
436
- body: {
437
- files: Array<Blob | File>;
438
- scope: FileScope;
1795
+ export type DeleteApiFilesByIdResponse = DeleteApiFilesByIdResponses[keyof DeleteApiFilesByIdResponses];
1796
+ export type GetApiFilesByIdData = {
1797
+ body?: never;
1798
+ path: {
1799
+ /**
1800
+ * 资源 ID
1801
+ */
1802
+ id: string;
439
1803
  };
440
- path?: never;
441
1804
  query?: never;
442
- url: '/api/files';
1805
+ url: '/api/files/{id}';
443
1806
  };
444
- export type PostApiFilesErrors = {
1807
+ export type GetApiFilesByIdErrors = {
445
1808
  /**
446
1809
  * 请求参数无效
447
1810
  */
@@ -467,37 +1830,36 @@ export type PostApiFilesErrors = {
467
1830
  */
468
1831
  500: ErrorResponse;
469
1832
  };
470
- export type PostApiFilesError = PostApiFilesErrors[keyof PostApiFilesErrors];
471
- export type PostApiFilesResponses = {
1833
+ export type GetApiFilesByIdError = GetApiFilesByIdErrors[keyof GetApiFilesByIdErrors];
1834
+ export type GetApiFilesByIdResponses = {
472
1835
  /**
473
- * 部分或全部成功
1836
+ * 成功
474
1837
  */
475
- 201: {
1838
+ 200: {
476
1839
  /**
477
1840
  * 业务码,成功为 0
478
1841
  */
479
1842
  code: number;
1843
+ /**
1844
+ * 提示信息,失败时为错误原因
1845
+ */
480
1846
  message: string;
481
- data: {
482
- results: Array<BackendUploadResult>;
483
- };
1847
+ data: StoredFile;
484
1848
  };
485
1849
  };
486
- export type PostApiFilesResponse = PostApiFilesResponses[keyof PostApiFilesResponses];
487
- export type PostApiFilesPresignData = {
488
- body: {
489
- items: Array<{
490
- filename: string;
491
- size: number;
492
- mimeType: string;
493
- scope: FileScope;
494
- }>;
1850
+ export type GetApiFilesByIdResponse = GetApiFilesByIdResponses[keyof GetApiFilesByIdResponses];
1851
+ export type GetApiFilesByIdRawData = {
1852
+ body?: never;
1853
+ path: {
1854
+ /**
1855
+ * 资源 ID
1856
+ */
1857
+ id: string;
495
1858
  };
496
- path?: never;
497
1859
  query?: never;
498
- url: '/api/files/presign';
1860
+ url: '/api/files/{id}/raw';
499
1861
  };
500
- export type PostApiFilesPresignErrors = {
1862
+ export type GetApiFilesByIdRawErrors = {
501
1863
  /**
502
1864
  * 请求参数无效
503
1865
  */
@@ -523,32 +1885,26 @@ export type PostApiFilesPresignErrors = {
523
1885
  */
524
1886
  500: ErrorResponse;
525
1887
  };
526
- export type PostApiFilesPresignError = PostApiFilesPresignErrors[keyof PostApiFilesPresignErrors];
527
- export type PostApiFilesPresignResponses = {
1888
+ export type GetApiFilesByIdRawError = GetApiFilesByIdRawErrors[keyof GetApiFilesByIdRawErrors];
1889
+ export type GetApiFilesByIdRawResponses = {
528
1890
  /**
529
- * 成功
1891
+ * 文件二进制流,Content-Type 为文件 MIME
530
1892
  */
531
- 201: {
1893
+ 200: Blob | File;
1894
+ };
1895
+ export type GetApiFilesByIdRawResponse = GetApiFilesByIdRawResponses[keyof GetApiFilesByIdRawResponses];
1896
+ export type GetApiFilesByIdUrlData = {
1897
+ body?: never;
1898
+ path: {
532
1899
  /**
533
- * 业务码,成功为 0
1900
+ * 资源 ID
534
1901
  */
535
- code: number;
536
- message: string;
537
- data: {
538
- results: Array<PrepareUploadResult>;
539
- };
540
- };
541
- };
542
- export type PostApiFilesPresignResponse = PostApiFilesPresignResponses[keyof PostApiFilesPresignResponses];
543
- export type PostApiFilesCompleteData = {
544
- body: {
545
- ids: Array<string>;
1902
+ id: string;
546
1903
  };
547
- path?: never;
548
1904
  query?: never;
549
- url: '/api/files/complete';
1905
+ url: '/api/files/{id}/url';
550
1906
  };
551
- export type PostApiFilesCompleteErrors = {
1907
+ export type GetApiFilesByIdUrlErrors = {
552
1908
  /**
553
1909
  * 请求参数无效
554
1910
  */
@@ -574,8 +1930,8 @@ export type PostApiFilesCompleteErrors = {
574
1930
  */
575
1931
  500: ErrorResponse;
576
1932
  };
577
- export type PostApiFilesCompleteError = PostApiFilesCompleteErrors[keyof PostApiFilesCompleteErrors];
578
- export type PostApiFilesCompleteResponses = {
1933
+ export type GetApiFilesByIdUrlError = GetApiFilesByIdUrlErrors[keyof GetApiFilesByIdUrlErrors];
1934
+ export type GetApiFilesByIdUrlResponses = {
579
1935
  /**
580
1936
  * 成功
581
1937
  */
@@ -584,24 +1940,48 @@ export type PostApiFilesCompleteResponses = {
584
1940
  * 业务码,成功为 0
585
1941
  */
586
1942
  code: number;
1943
+ /**
1944
+ * 提示信息,失败时为错误原因
1945
+ */
587
1946
  message: string;
588
1947
  data: {
589
- results: Array<CompleteUploadResult>;
1948
+ /**
1949
+ * 下载地址
1950
+ */
1951
+ url: string;
590
1952
  };
591
1953
  };
592
1954
  };
593
- export type PostApiFilesCompleteResponse = PostApiFilesCompleteResponses[keyof PostApiFilesCompleteResponses];
594
- export type PostApiFilesCleanupData = {
1955
+ export type GetApiFilesByIdUrlResponse = GetApiFilesByIdUrlResponses[keyof GetApiFilesByIdUrlResponses];
1956
+ export type PostApiChatData = {
595
1957
  body: {
596
- dryRun?: boolean;
597
- olderThanHours?: number;
598
- deleteBatchSize?: number;
1958
+ /**
1959
+ * 会话 ID
1960
+ */
1961
+ conversationId: string;
1962
+ /**
1963
+ * 用户问题,与 attachments 至少传一项
1964
+ */
1965
+ content: string;
1966
+ /**
1967
+ * 图片附件,实际数量上限以 /api/chat/limits 返回的 imageMaxCount 为准
1968
+ */
1969
+ attachments?: Array<{
1970
+ /**
1971
+ * 当前用户上传且已就绪的对话图片文件 ID(scope=chat)
1972
+ */
1973
+ fileId: string;
1974
+ }>;
1975
+ /**
1976
+ * 是否以 NDJSON 事件流返回,默认 true
1977
+ */
1978
+ stream?: boolean;
599
1979
  };
600
1980
  path?: never;
601
1981
  query?: never;
602
- url: '/api/files/cleanup';
1982
+ url: '/api/chat';
603
1983
  };
604
- export type PostApiFilesCleanupErrors = {
1984
+ export type PostApiChatErrors = {
605
1985
  /**
606
1986
  * 请求参数无效
607
1987
  */
@@ -627,32 +2007,36 @@ export type PostApiFilesCleanupErrors = {
627
2007
  */
628
2008
  500: ErrorResponse;
629
2009
  };
630
- export type PostApiFilesCleanupError = PostApiFilesCleanupErrors[keyof PostApiFilesCleanupErrors];
631
- export type PostApiFilesCleanupResponses = {
2010
+ export type PostApiChatError = PostApiChatErrors[keyof PostApiChatErrors];
2011
+ export type PostApiChatResponses = {
632
2012
  /**
633
- * 成功
2013
+ * stream=true 为 NDJSON 事件;stream=false 为 JSON 信封
634
2014
  */
635
2015
  200: {
636
2016
  /**
637
2017
  * 业务码,成功为 0
638
2018
  */
639
2019
  code: number;
2020
+ /**
2021
+ * 提示信息,失败时为错误原因
2022
+ */
640
2023
  message: string;
641
- data: CleanupReport;
2024
+ data: ChatAnswer;
642
2025
  };
643
2026
  };
644
- export type PostApiFilesCleanupResponse = PostApiFilesCleanupResponses[keyof PostApiFilesCleanupResponses];
645
- export type DeleteApiFilesByIdData = {
2027
+ export type PostApiChatResponse = PostApiChatResponses[keyof PostApiChatResponses];
2028
+ export type GetApiChatLimitsData = {
646
2029
  body?: never;
647
- path: {
648
- id: string;
649
- };
650
- query?: {
651
- force?: boolean;
2030
+ path?: never;
2031
+ query: {
2032
+ /**
2033
+ * 会话 ID
2034
+ */
2035
+ conversationId: string;
652
2036
  };
653
- url: '/api/files/{id}';
2037
+ url: '/api/chat/limits';
654
2038
  };
655
- export type DeleteApiFilesByIdErrors = {
2039
+ export type GetApiChatLimitsErrors = {
656
2040
  /**
657
2041
  * 请求参数无效
658
2042
  */
@@ -661,36 +2045,78 @@ export type DeleteApiFilesByIdErrors = {
661
2045
  * 未登录
662
2046
  */
663
2047
  401: ErrorResponse;
664
- /**
665
- * 无权限
666
- */
667
- 403: ErrorResponse;
668
2048
  /**
669
2049
  * 资源不存在
670
2050
  */
671
2051
  404: ErrorResponse;
672
2052
  /**
673
- * 文件仍被引用
2053
+ * 服务器内部错误
674
2054
  */
675
- 409: {
2055
+ 500: ErrorResponse;
2056
+ };
2057
+ export type GetApiChatLimitsError = GetApiChatLimitsErrors[keyof GetApiChatLimitsErrors];
2058
+ export type GetApiChatLimitsResponses = {
2059
+ /**
2060
+ * 成功
2061
+ */
2062
+ 200: {
676
2063
  /**
677
2064
  * 业务码,成功为 0
678
2065
  */
679
2066
  code: number;
2067
+ /**
2068
+ * 提示信息,失败时为错误原因
2069
+ */
680
2070
  message: string;
681
- data: FileReferencedData;
2071
+ data: {
2072
+ /**
2073
+ * 单条消息图片数量上限
2074
+ */
2075
+ imageMaxCount: number;
2076
+ /**
2077
+ * 图片压缩最长边(像素),客户端上传前按此缩放
2078
+ */
2079
+ imageMaxEdge: number;
2080
+ welcome: RagWelcomeConfig;
2081
+ /**
2082
+ * 生效的推荐问题
2083
+ */
2084
+ recommendedQuestions: Array<string>;
2085
+ };
2086
+ };
2087
+ };
2088
+ export type GetApiChatLimitsResponse = GetApiChatLimitsResponses[keyof GetApiChatLimitsResponses];
2089
+ export type GetApiChatConversationsData = {
2090
+ body?: never;
2091
+ path?: never;
2092
+ query?: {
2093
+ /**
2094
+ * 按会话归属用户过滤,仅管理员及以上生效
2095
+ */
2096
+ userId?: string;
2097
+ /**
2098
+ * 按问答助手 ID 过滤
2099
+ */
2100
+ ragId?: number;
2101
+ /**
2102
+ * 按智能路由 ID 过滤
2103
+ */
2104
+ routerId?: number;
682
2105
  };
2106
+ url: '/api/chat/conversations';
2107
+ };
2108
+ export type GetApiChatConversationsErrors = {
683
2109
  /**
684
- * LLM 并发已满
2110
+ * 未登录
685
2111
  */
686
- 429: ErrorResponse;
2112
+ 401: ErrorResponse;
687
2113
  /**
688
2114
  * 服务器内部错误
689
2115
  */
690
2116
  500: ErrorResponse;
691
2117
  };
692
- export type DeleteApiFilesByIdError = DeleteApiFilesByIdErrors[keyof DeleteApiFilesByIdErrors];
693
- export type DeleteApiFilesByIdResponses = {
2118
+ export type GetApiChatConversationsError = GetApiChatConversationsErrors[keyof GetApiChatConversationsErrors];
2119
+ export type GetApiChatConversationsResponses = {
694
2120
  /**
695
2121
  * 成功
696
2122
  */
@@ -699,20 +2125,46 @@ export type DeleteApiFilesByIdResponses = {
699
2125
  * 业务码,成功为 0
700
2126
  */
701
2127
  code: number;
2128
+ /**
2129
+ * 提示信息,失败时为错误原因
2130
+ */
702
2131
  message: string;
703
- data: null;
2132
+ data: Array<Conversation>;
704
2133
  };
705
2134
  };
706
- export type DeleteApiFilesByIdResponse = DeleteApiFilesByIdResponses[keyof DeleteApiFilesByIdResponses];
707
- export type GetApiFilesByIdData = {
708
- body?: never;
709
- path: {
710
- id: string;
2135
+ export type GetApiChatConversationsResponse = GetApiChatConversationsResponses[keyof GetApiChatConversationsResponses];
2136
+ export type PostApiChatConversationsData = {
2137
+ body?: {
2138
+ /**
2139
+ * 会话标题
2140
+ */
2141
+ title?: string;
2142
+ /**
2143
+ * 会话归属用户 ID,默认为当前用户;指定他人时需对该用户有管理权限
2144
+ */
2145
+ userId?: string;
2146
+ /**
2147
+ * 直接绑定的问答助手 ID,与 mark 二选一
2148
+ */
2149
+ ragId?: number;
2150
+ /**
2151
+ * 直接绑定的问答助手标识,与 ragId 二选一
2152
+ */
2153
+ mark?: string;
2154
+ /**
2155
+ * 绑定的智能路由 ID,与 routerMark 二选一
2156
+ */
2157
+ routerId?: number;
2158
+ /**
2159
+ * 绑定的智能路由标识,与 routerId 二选一
2160
+ */
2161
+ routerMark?: string;
711
2162
  };
2163
+ path?: never;
712
2164
  query?: never;
713
- url: '/api/files/{id}';
2165
+ url: '/api/chat/conversations';
714
2166
  };
715
- export type GetApiFilesByIdErrors = {
2167
+ export type PostApiChatConversationsErrors = {
716
2168
  /**
717
2169
  * 请求参数无效
718
2170
  */
@@ -738,30 +2190,36 @@ export type GetApiFilesByIdErrors = {
738
2190
  */
739
2191
  500: ErrorResponse;
740
2192
  };
741
- export type GetApiFilesByIdError = GetApiFilesByIdErrors[keyof GetApiFilesByIdErrors];
742
- export type GetApiFilesByIdResponses = {
2193
+ export type PostApiChatConversationsError = PostApiChatConversationsErrors[keyof PostApiChatConversationsErrors];
2194
+ export type PostApiChatConversationsResponses = {
743
2195
  /**
744
2196
  * 成功
745
2197
  */
746
- 200: {
2198
+ 201: {
747
2199
  /**
748
2200
  * 业务码,成功为 0
749
2201
  */
750
2202
  code: number;
2203
+ /**
2204
+ * 提示信息,失败时为错误原因
2205
+ */
751
2206
  message: string;
752
- data: StoredFile;
2207
+ data: Conversation;
753
2208
  };
754
2209
  };
755
- export type GetApiFilesByIdResponse = GetApiFilesByIdResponses[keyof GetApiFilesByIdResponses];
756
- export type GetApiFilesByIdRawData = {
2210
+ export type PostApiChatConversationsResponse = PostApiChatConversationsResponses[keyof PostApiChatConversationsResponses];
2211
+ export type DeleteApiChatConversationsByIdData = {
757
2212
  body?: never;
758
2213
  path: {
2214
+ /**
2215
+ * 资源 ID
2216
+ */
759
2217
  id: string;
760
2218
  };
761
2219
  query?: never;
762
- url: '/api/files/{id}/raw';
2220
+ url: '/api/chat/conversations/{id}';
763
2221
  };
764
- export type GetApiFilesByIdRawErrors = {
2222
+ export type DeleteApiChatConversationsByIdErrors = {
765
2223
  /**
766
2224
  * 请求参数无效
767
2225
  */
@@ -787,23 +2245,36 @@ export type GetApiFilesByIdRawErrors = {
787
2245
  */
788
2246
  500: ErrorResponse;
789
2247
  };
790
- export type GetApiFilesByIdRawError = GetApiFilesByIdRawErrors[keyof GetApiFilesByIdRawErrors];
791
- export type GetApiFilesByIdRawResponses = {
2248
+ export type DeleteApiChatConversationsByIdError = DeleteApiChatConversationsByIdErrors[keyof DeleteApiChatConversationsByIdErrors];
2249
+ export type DeleteApiChatConversationsByIdResponses = {
792
2250
  /**
793
- * 文件二进制流,Content-Type 为文件 MIME
2251
+ * 成功
794
2252
  */
795
- 200: Blob | File;
2253
+ 200: {
2254
+ /**
2255
+ * 业务码,成功为 0
2256
+ */
2257
+ code: number;
2258
+ /**
2259
+ * 提示信息,失败时为错误原因
2260
+ */
2261
+ message: string;
2262
+ data: null;
2263
+ };
796
2264
  };
797
- export type GetApiFilesByIdRawResponse = GetApiFilesByIdRawResponses[keyof GetApiFilesByIdRawResponses];
798
- export type GetApiFilesByIdUrlData = {
2265
+ export type DeleteApiChatConversationsByIdResponse = DeleteApiChatConversationsByIdResponses[keyof DeleteApiChatConversationsByIdResponses];
2266
+ export type GetApiChatConversationsByIdData = {
799
2267
  body?: never;
800
2268
  path: {
2269
+ /**
2270
+ * 资源 ID
2271
+ */
801
2272
  id: string;
802
2273
  };
803
2274
  query?: never;
804
- url: '/api/files/{id}/url';
2275
+ url: '/api/chat/conversations/{id}';
805
2276
  };
806
- export type GetApiFilesByIdUrlErrors = {
2277
+ export type GetApiChatConversationsByIdErrors = {
807
2278
  /**
808
2279
  * 请求参数无效
809
2280
  */
@@ -829,8 +2300,8 @@ export type GetApiFilesByIdUrlErrors = {
829
2300
  */
830
2301
  500: ErrorResponse;
831
2302
  };
832
- export type GetApiFilesByIdUrlError = GetApiFilesByIdUrlErrors[keyof GetApiFilesByIdUrlErrors];
833
- export type GetApiFilesByIdUrlResponses = {
2303
+ export type GetApiChatConversationsByIdError = GetApiChatConversationsByIdErrors[keyof GetApiChatConversationsByIdErrors];
2304
+ export type GetApiChatConversationsByIdResponses = {
834
2305
  /**
835
2306
  * 成功
836
2307
  */
@@ -839,27 +2310,37 @@ export type GetApiFilesByIdUrlResponses = {
839
2310
  * 业务码,成功为 0
840
2311
  */
841
2312
  code: number;
2313
+ /**
2314
+ * 提示信息,失败时为错误原因
2315
+ */
842
2316
  message: string;
843
2317
  data: {
844
- url: string;
2318
+ conversation: Conversation;
2319
+ /**
2320
+ * 会话消息,按时间正序
2321
+ */
2322
+ messages: Array<Message>;
845
2323
  };
846
2324
  };
847
2325
  };
848
- export type GetApiFilesByIdUrlResponse = GetApiFilesByIdUrlResponses[keyof GetApiFilesByIdUrlResponses];
849
- export type PostApiChatData = {
2326
+ export type GetApiChatConversationsByIdResponse = GetApiChatConversationsByIdResponses[keyof GetApiChatConversationsByIdResponses];
2327
+ export type PatchApiChatConversationsByIdData = {
850
2328
  body: {
851
- conversationId: string;
852
- content: string;
853
- attachments?: Array<{
854
- fileId: string;
855
- }>;
856
- stream?: boolean;
2329
+ /**
2330
+ * 会话标题,为空时保持原标题
2331
+ */
2332
+ title?: string;
2333
+ };
2334
+ path: {
2335
+ /**
2336
+ * 资源 ID
2337
+ */
2338
+ id: string;
857
2339
  };
858
- path?: never;
859
2340
  query?: never;
860
- url: '/api/chat';
2341
+ url: '/api/chat/conversations/{id}';
861
2342
  };
862
- export type PostApiChatErrors = {
2343
+ export type PatchApiChatConversationsByIdErrors = {
863
2344
  /**
864
2345
  * 请求参数无效
865
2346
  */
@@ -885,77 +2366,31 @@ export type PostApiChatErrors = {
885
2366
  */
886
2367
  500: ErrorResponse;
887
2368
  };
888
- export type PostApiChatError = PostApiChatErrors[keyof PostApiChatErrors];
889
- export type PostApiChatResponses = {
2369
+ export type PatchApiChatConversationsByIdError = PatchApiChatConversationsByIdErrors[keyof PatchApiChatConversationsByIdErrors];
2370
+ export type PatchApiChatConversationsByIdResponses = {
890
2371
  /**
891
- * stream=true 为 NDJSON 事件;stream=false 为 JSON 信封
2372
+ * 成功
892
2373
  */
893
2374
  200: {
894
2375
  /**
895
2376
  * 业务码,成功为 0
896
2377
  */
897
2378
  code: number;
898
- message: string;
899
- data: ChatAnswer;
900
- };
901
- };
902
- export type PostApiChatResponse = PostApiChatResponses[keyof PostApiChatResponses];
903
- export type GetApiChatLimitsData = {
904
- body?: never;
905
- path?: never;
906
- query: {
907
- conversationId: string;
908
- };
909
- url: '/api/chat/limits';
910
- };
911
- export type GetApiChatLimitsErrors = {
912
- /**
913
- * 请求参数无效
914
- */
915
- 400: ErrorResponse;
916
- /**
917
- * 未登录
918
- */
919
- 401: ErrorResponse;
920
- /**
921
- * 资源不存在
922
- */
923
- 404: ErrorResponse;
924
- /**
925
- * 服务器内部错误
926
- */
927
- 500: ErrorResponse;
928
- };
929
- export type GetApiChatLimitsError = GetApiChatLimitsErrors[keyof GetApiChatLimitsErrors];
930
- export type GetApiChatLimitsResponses = {
931
- /**
932
- * 成功
933
- */
934
- 200: {
935
2379
  /**
936
- * 业务码,成功为 0
2380
+ * 提示信息,失败时为错误原因
937
2381
  */
938
- code: number;
939
2382
  message: string;
940
- data: {
941
- imageMaxCount: number;
942
- imageMaxEdge: number;
943
- welcome: RagWelcomeConfig;
944
- recommendedQuestions: Array<string>;
945
- };
2383
+ data: Conversation;
946
2384
  };
947
2385
  };
948
- export type GetApiChatLimitsResponse = GetApiChatLimitsResponses[keyof GetApiChatLimitsResponses];
949
- export type GetApiChatConversationsData = {
2386
+ export type PatchApiChatConversationsByIdResponse = PatchApiChatConversationsByIdResponses[keyof PatchApiChatConversationsByIdResponses];
2387
+ export type GetApiChatRoutersData = {
950
2388
  body?: never;
951
2389
  path?: never;
952
- query?: {
953
- userId?: string;
954
- ragId?: number;
955
- };
956
- url: '/api/chat/conversations';
2390
+ query?: never;
2391
+ url: '/api/chat/routers';
957
2392
  };
958
- export type GetApiChatConversationsErrors = {
2393
+ export type GetApiChatRoutersErrors = {
959
2394
  /**
960
2395
  * 未登录
961
2396
  */
@@ -965,8 +2400,8 @@ export type GetApiChatConversationsErrors = {
965
2400
  */
966
2401
  500: ErrorResponse;
967
2402
  };
968
- export type GetApiChatConversationsError = GetApiChatConversationsErrors[keyof GetApiChatConversationsErrors];
969
- export type GetApiChatConversationsResponses = {
2403
+ export type GetApiChatRoutersError = GetApiChatRoutersErrors[keyof GetApiChatRoutersErrors];
2404
+ export type GetApiChatRoutersResponses = {
970
2405
  /**
971
2406
  * 成功
972
2407
  */
@@ -975,23 +2410,21 @@ export type GetApiChatConversationsResponses = {
975
2410
  * 业务码,成功为 0
976
2411
  */
977
2412
  code: number;
2413
+ /**
2414
+ * 提示信息,失败时为错误原因
2415
+ */
978
2416
  message: string;
979
- data: Array<Conversation>;
2417
+ data: Array<IntentRouter>;
980
2418
  };
981
2419
  };
982
- export type GetApiChatConversationsResponse = GetApiChatConversationsResponses[keyof GetApiChatConversationsResponses];
983
- export type PostApiChatConversationsData = {
984
- body?: {
985
- title?: string;
986
- userId?: string;
987
- ragId?: number;
988
- mark?: string;
989
- };
2420
+ export type GetApiChatRoutersResponse = GetApiChatRoutersResponses[keyof GetApiChatRoutersResponses];
2421
+ export type PostApiChatRoutersData = {
2422
+ body: IntentRouterCreate;
990
2423
  path?: never;
991
2424
  query?: never;
992
- url: '/api/chat/conversations';
2425
+ url: '/api/chat/routers';
993
2426
  };
994
- export type PostApiChatConversationsErrors = {
2427
+ export type PostApiChatRoutersErrors = {
995
2428
  /**
996
2429
  * 请求参数无效
997
2430
  */
@@ -1000,25 +2433,13 @@ export type PostApiChatConversationsErrors = {
1000
2433
  * 未登录
1001
2434
  */
1002
2435
  401: ErrorResponse;
1003
- /**
1004
- * 无权限
1005
- */
1006
- 403: ErrorResponse;
1007
- /**
1008
- * 资源不存在
1009
- */
1010
- 404: ErrorResponse;
1011
- /**
1012
- * LLM 并发已满
1013
- */
1014
- 429: ErrorResponse;
1015
2436
  /**
1016
2437
  * 服务器内部错误
1017
2438
  */
1018
2439
  500: ErrorResponse;
1019
2440
  };
1020
- export type PostApiChatConversationsError = PostApiChatConversationsErrors[keyof PostApiChatConversationsErrors];
1021
- export type PostApiChatConversationsResponses = {
2441
+ export type PostApiChatRoutersError = PostApiChatRoutersErrors[keyof PostApiChatRoutersErrors];
2442
+ export type PostApiChatRoutersResponses = {
1022
2443
  /**
1023
2444
  * 成功
1024
2445
  */
@@ -1027,20 +2448,31 @@ export type PostApiChatConversationsResponses = {
1027
2448
  * 业务码,成功为 0
1028
2449
  */
1029
2450
  code: number;
2451
+ /**
2452
+ * 提示信息,失败时为错误原因
2453
+ */
1030
2454
  message: string;
1031
- data: Conversation;
2455
+ data: {
2456
+ /**
2457
+ * 新建智能路由 ID
2458
+ */
2459
+ id: number;
2460
+ };
1032
2461
  };
1033
2462
  };
1034
- export type PostApiChatConversationsResponse = PostApiChatConversationsResponses[keyof PostApiChatConversationsResponses];
1035
- export type DeleteApiChatConversationsByIdData = {
2463
+ export type PostApiChatRoutersResponse = PostApiChatRoutersResponses[keyof PostApiChatRoutersResponses];
2464
+ export type DeleteApiChatRoutersByIdData = {
1036
2465
  body?: never;
1037
2466
  path: {
2467
+ /**
2468
+ * 资源 ID
2469
+ */
1038
2470
  id: string;
1039
2471
  };
1040
2472
  query?: never;
1041
- url: '/api/chat/conversations/{id}';
2473
+ url: '/api/chat/routers/{id}';
1042
2474
  };
1043
- export type DeleteApiChatConversationsByIdErrors = {
2475
+ export type DeleteApiChatRoutersByIdErrors = {
1044
2476
  /**
1045
2477
  * 请求参数无效
1046
2478
  */
@@ -1066,8 +2498,8 @@ export type DeleteApiChatConversationsByIdErrors = {
1066
2498
  */
1067
2499
  500: ErrorResponse;
1068
2500
  };
1069
- export type DeleteApiChatConversationsByIdError = DeleteApiChatConversationsByIdErrors[keyof DeleteApiChatConversationsByIdErrors];
1070
- export type DeleteApiChatConversationsByIdResponses = {
2501
+ export type DeleteApiChatRoutersByIdError = DeleteApiChatRoutersByIdErrors[keyof DeleteApiChatRoutersByIdErrors];
2502
+ export type DeleteApiChatRoutersByIdResponses = {
1071
2503
  /**
1072
2504
  * 成功
1073
2505
  */
@@ -1076,20 +2508,26 @@ export type DeleteApiChatConversationsByIdResponses = {
1076
2508
  * 业务码,成功为 0
1077
2509
  */
1078
2510
  code: number;
2511
+ /**
2512
+ * 提示信息,失败时为错误原因
2513
+ */
1079
2514
  message: string;
1080
2515
  data: null;
1081
2516
  };
1082
2517
  };
1083
- export type DeleteApiChatConversationsByIdResponse = DeleteApiChatConversationsByIdResponses[keyof DeleteApiChatConversationsByIdResponses];
1084
- export type GetApiChatConversationsByIdData = {
2518
+ export type DeleteApiChatRoutersByIdResponse = DeleteApiChatRoutersByIdResponses[keyof DeleteApiChatRoutersByIdResponses];
2519
+ export type GetApiChatRoutersByIdData = {
1085
2520
  body?: never;
1086
2521
  path: {
2522
+ /**
2523
+ * 资源 ID
2524
+ */
1087
2525
  id: string;
1088
2526
  };
1089
2527
  query?: never;
1090
- url: '/api/chat/conversations/{id}';
2528
+ url: '/api/chat/routers/{id}';
1091
2529
  };
1092
- export type GetApiChatConversationsByIdErrors = {
2530
+ export type GetApiChatRoutersByIdErrors = {
1093
2531
  /**
1094
2532
  * 请求参数无效
1095
2533
  */
@@ -1115,8 +2553,8 @@ export type GetApiChatConversationsByIdErrors = {
1115
2553
  */
1116
2554
  500: ErrorResponse;
1117
2555
  };
1118
- export type GetApiChatConversationsByIdError = GetApiChatConversationsByIdErrors[keyof GetApiChatConversationsByIdErrors];
1119
- export type GetApiChatConversationsByIdResponses = {
2556
+ export type GetApiChatRoutersByIdError = GetApiChatRoutersByIdErrors[keyof GetApiChatRoutersByIdErrors];
2557
+ export type GetApiChatRoutersByIdResponses = {
1120
2558
  /**
1121
2559
  * 成功
1122
2560
  */
@@ -1125,25 +2563,26 @@ export type GetApiChatConversationsByIdResponses = {
1125
2563
  * 业务码,成功为 0
1126
2564
  */
1127
2565
  code: number;
2566
+ /**
2567
+ * 提示信息,失败时为错误原因
2568
+ */
1128
2569
  message: string;
1129
- data: {
1130
- conversation: Conversation;
1131
- messages: Array<Message>;
1132
- };
2570
+ data: IntentRouter;
1133
2571
  };
1134
2572
  };
1135
- export type GetApiChatConversationsByIdResponse = GetApiChatConversationsByIdResponses[keyof GetApiChatConversationsByIdResponses];
1136
- export type PatchApiChatConversationsByIdData = {
1137
- body: {
1138
- title?: string;
1139
- };
2573
+ export type GetApiChatRoutersByIdResponse = GetApiChatRoutersByIdResponses[keyof GetApiChatRoutersByIdResponses];
2574
+ export type PatchApiChatRoutersByIdData = {
2575
+ body: IntentRouterUpdate;
1140
2576
  path: {
2577
+ /**
2578
+ * 资源 ID
2579
+ */
1141
2580
  id: string;
1142
2581
  };
1143
2582
  query?: never;
1144
- url: '/api/chat/conversations/{id}';
2583
+ url: '/api/chat/routers/{id}';
1145
2584
  };
1146
- export type PatchApiChatConversationsByIdErrors = {
2585
+ export type PatchApiChatRoutersByIdErrors = {
1147
2586
  /**
1148
2587
  * 请求参数无效
1149
2588
  */
@@ -1169,8 +2608,8 @@ export type PatchApiChatConversationsByIdErrors = {
1169
2608
  */
1170
2609
  500: ErrorResponse;
1171
2610
  };
1172
- export type PatchApiChatConversationsByIdError = PatchApiChatConversationsByIdErrors[keyof PatchApiChatConversationsByIdErrors];
1173
- export type PatchApiChatConversationsByIdResponses = {
2611
+ export type PatchApiChatRoutersByIdError = PatchApiChatRoutersByIdErrors[keyof PatchApiChatRoutersByIdErrors];
2612
+ export type PatchApiChatRoutersByIdResponses = {
1174
2613
  /**
1175
2614
  * 成功
1176
2615
  */
@@ -1179,11 +2618,14 @@ export type PatchApiChatConversationsByIdResponses = {
1179
2618
  * 业务码,成功为 0
1180
2619
  */
1181
2620
  code: number;
2621
+ /**
2622
+ * 提示信息,失败时为错误原因
2623
+ */
1182
2624
  message: string;
1183
- data: Conversation;
2625
+ data: IntentRouter;
1184
2626
  };
1185
2627
  };
1186
- export type PatchApiChatConversationsByIdResponse = PatchApiChatConversationsByIdResponses[keyof PatchApiChatConversationsByIdResponses];
2628
+ export type PatchApiChatRoutersByIdResponse = PatchApiChatRoutersByIdResponses[keyof PatchApiChatRoutersByIdResponses];
1187
2629
  export type GetApiSearchData = {
1188
2630
  body?: never;
1189
2631
  path?: never;
@@ -1200,6 +2642,9 @@ export type GetApiSearchData = {
1200
2642
  * 知识库标识,与 kbId 不能同时为空
1201
2643
  */
1202
2644
  mark?: string;
2645
+ /**
2646
+ * 返回条数上限,默认 20,最大 50
2647
+ */
1203
2648
  limit?: number;
1204
2649
  };
1205
2650
  url: '/api/search';
@@ -1232,6 +2677,9 @@ export type GetApiSearchResponses = {
1232
2677
  * 业务码,成功为 0
1233
2678
  */
1234
2679
  code: number;
2680
+ /**
2681
+ * 提示信息,失败时为错误原因
2682
+ */
1235
2683
  message: string;
1236
2684
  data: Array<SearchHit>;
1237
2685
  };
@@ -1288,6 +2736,9 @@ export type PostApiSearchClickResponses = {
1288
2736
  * 业务码,成功为 0
1289
2737
  */
1290
2738
  code: number;
2739
+ /**
2740
+ * 提示信息,失败时为错误原因
2741
+ */
1291
2742
  message: string;
1292
2743
  data: null;
1293
2744
  };
@@ -1319,18 +2770,40 @@ export type GetApiKnowledgeBasesResponses = {
1319
2770
  * 业务码,成功为 0
1320
2771
  */
1321
2772
  code: number;
2773
+ /**
2774
+ * 提示信息,失败时为错误原因
2775
+ */
1322
2776
  message: string;
1323
- data: Array<KnowledgeBase>;
2777
+ data: Array<KnowledgeBaseListItem>;
1324
2778
  };
1325
2779
  };
1326
2780
  export type GetApiKnowledgeBasesResponse = GetApiKnowledgeBasesResponses[keyof GetApiKnowledgeBasesResponses];
1327
2781
  export type PostApiKnowledgeBasesData = {
1328
2782
  body: {
2783
+ /**
2784
+ * 名称
2785
+ */
1329
2786
  name: string;
2787
+ /**
2788
+ * 知识库唯一标识,不可包含逗号
2789
+ */
1330
2790
  mark: string;
2791
+ /**
2792
+ * 描述
2793
+ */
1331
2794
  description?: string | null;
2795
+ /**
2796
+ * 文档分块大小(字符),不小于 100;null 继承全局
2797
+ */
1332
2798
  chunkSize?: number | null;
2799
+ /**
2800
+ * 相邻分块重叠字符数,需小于分块大小;null 继承全局
2801
+ */
1333
2802
  chunkOverlap?: number | null;
2803
+ /**
2804
+ * 召回时可按「字段=值」等条件过滤的文档 front matter 字段名
2805
+ */
2806
+ filterFields?: Array<string>;
1334
2807
  };
1335
2808
  path?: never;
1336
2809
  query?: never;
@@ -1364,8 +2837,14 @@ export type PostApiKnowledgeBasesResponses = {
1364
2837
  * 业务码,成功为 0
1365
2838
  */
1366
2839
  code: number;
2840
+ /**
2841
+ * 提示信息,失败时为错误原因
2842
+ */
1367
2843
  message: string;
1368
2844
  data: {
2845
+ /**
2846
+ * 新建知识库 ID
2847
+ */
1369
2848
  id: number;
1370
2849
  };
1371
2850
  };
@@ -1374,6 +2853,9 @@ export type PostApiKnowledgeBasesResponse = PostApiKnowledgeBasesResponses[keyof
1374
2853
  export type DeleteApiKnowledgeBasesByIdData = {
1375
2854
  body?: never;
1376
2855
  path: {
2856
+ /**
2857
+ * 资源 ID
2858
+ */
1377
2859
  id: string;
1378
2860
  };
1379
2861
  query?: never;
@@ -1415,6 +2897,9 @@ export type DeleteApiKnowledgeBasesByIdResponses = {
1415
2897
  * 业务码,成功为 0
1416
2898
  */
1417
2899
  code: number;
2900
+ /**
2901
+ * 提示信息,失败时为错误原因
2902
+ */
1418
2903
  message: string;
1419
2904
  data: null;
1420
2905
  };
@@ -1423,6 +2908,9 @@ export type DeleteApiKnowledgeBasesByIdResponse = DeleteApiKnowledgeBasesByIdRes
1423
2908
  export type GetApiKnowledgeBasesByIdData = {
1424
2909
  body?: never;
1425
2910
  path: {
2911
+ /**
2912
+ * 资源 ID
2913
+ */
1426
2914
  id: string;
1427
2915
  };
1428
2916
  query?: never;
@@ -1464,6 +2952,9 @@ export type GetApiKnowledgeBasesByIdResponses = {
1464
2952
  * 业务码,成功为 0
1465
2953
  */
1466
2954
  code: number;
2955
+ /**
2956
+ * 提示信息,失败时为错误原因
2957
+ */
1467
2958
  message: string;
1468
2959
  data: KnowledgeBase;
1469
2960
  };
@@ -1471,13 +2962,35 @@ export type GetApiKnowledgeBasesByIdResponses = {
1471
2962
  export type GetApiKnowledgeBasesByIdResponse = GetApiKnowledgeBasesByIdResponses[keyof GetApiKnowledgeBasesByIdResponses];
1472
2963
  export type PatchApiKnowledgeBasesByIdData = {
1473
2964
  body: {
2965
+ /**
2966
+ * 名称
2967
+ */
1474
2968
  name?: string;
2969
+ /**
2970
+ * 知识库唯一标识,不可包含逗号
2971
+ */
1475
2972
  mark?: string;
2973
+ /**
2974
+ * 描述
2975
+ */
1476
2976
  description?: string | null;
2977
+ /**
2978
+ * 文档分块大小(字符),不小于 100;null 继承全局
2979
+ */
1477
2980
  chunkSize?: number | null;
2981
+ /**
2982
+ * 相邻分块重叠字符数,需小于分块大小;null 继承全局
2983
+ */
1478
2984
  chunkOverlap?: number | null;
2985
+ /**
2986
+ * 召回时可按「字段=值」等条件过滤的文档 front matter 字段名
2987
+ */
2988
+ filterFields?: Array<string>;
1479
2989
  };
1480
2990
  path: {
2991
+ /**
2992
+ * 资源 ID
2993
+ */
1481
2994
  id: string;
1482
2995
  };
1483
2996
  query?: never;
@@ -1519,11 +3032,47 @@ export type PatchApiKnowledgeBasesByIdResponses = {
1519
3032
  * 业务码,成功为 0
1520
3033
  */
1521
3034
  code: number;
3035
+ /**
3036
+ * 提示信息,失败时为错误原因
3037
+ */
1522
3038
  message: string;
1523
3039
  data: KnowledgeBase;
1524
3040
  };
1525
3041
  };
1526
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];
1527
3076
  export type GetApiRagsData = {
1528
3077
  body?: never;
1529
3078
  path?: never;
@@ -1550,6 +3099,9 @@ export type GetApiRagsResponses = {
1550
3099
  * 业务码,成功为 0
1551
3100
  */
1552
3101
  code: number;
3102
+ /**
3103
+ * 提示信息,失败时为错误原因
3104
+ */
1553
3105
  message: string;
1554
3106
  data: Array<Rag>;
1555
3107
  };
@@ -1557,22 +3109,78 @@ export type GetApiRagsResponses = {
1557
3109
  export type GetApiRagsResponse = GetApiRagsResponses[keyof GetApiRagsResponses];
1558
3110
  export type PostApiRagsData = {
1559
3111
  body: {
3112
+ /**
3113
+ * 名称
3114
+ */
1560
3115
  name: string;
3116
+ /**
3117
+ * 描述;作为智能路由候选且未填写意图时,用作意图描述
3118
+ */
1561
3119
  description?: string | null;
3120
+ /**
3121
+ * 问答助手唯一标识,可用于创建会话;不可包含逗号
3122
+ */
1562
3123
  mark?: string | null;
3124
+ /**
3125
+ * 绑定的知识库 ID
3126
+ */
1563
3127
  kbId: number;
3128
+ /**
3129
+ * 系统提示词,支持 {{context}} 检索资料、{{fallback}} 低匹配度默认回复变量;null 继承全局
3130
+ */
1564
3131
  systemPrompt?: string | null;
3132
+ /**
3133
+ * 问题拆分提示词;null 继承全局
3134
+ */
1565
3135
  splitPrompt?: string | null;
3136
+ /**
3137
+ * 是否将用户问题拆分为多个子问题分别检索;null 继承全局
3138
+ */
1566
3139
  splitQuery?: boolean | null;
3140
+ /**
3141
+ * 向量检索匹配度阈值,取值 0~1,低于阈值的结果被过滤;null 继承全局
3142
+ */
1567
3143
  scoreThreshold?: number | null;
3144
+ /**
3145
+ * 检索结果全部低于阈值时的回复文案;null 继承全局
3146
+ */
1568
3147
  lowScoreReply?: string | null;
3148
+ /**
3149
+ * 深度思考:default 使用模型默认,false 关闭,low / medium / high 为思考强度;null 继承全局
3150
+ */
1569
3151
  deepThinking?: 'default' | 'false' | 'low' | 'medium' | 'high' | null;
3152
+ /**
3153
+ * 是否开启多轮对话(携带历史上下文);null 继承全局
3154
+ */
1570
3155
  multiTurn?: boolean | null;
3156
+ /**
3157
+ * 多轮对话上下文 Token 阈值,超出后压缩历史;null 继承全局
3158
+ */
1571
3159
  contextThreshold?: number | null;
3160
+ /**
3161
+ * 每个问题向量检索的最大匹配数;null 继承全局
3162
+ */
1572
3163
  retrieveLimit?: number | null;
3164
+ /**
3165
+ * 单条消息图片数量上限;null 继承全局
3166
+ */
1573
3167
  imageMaxCount?: number | null;
3168
+ /**
3169
+ * 对话图片压缩最长边(像素);null 继承全局
3170
+ */
1574
3171
  imageMaxEdge?: number | null;
3172
+ /**
3173
+ * 文本模型供应商 ID,与 textModel 需同时填写;null 使用全局文本模型
3174
+ */
3175
+ textProviderId?: number | null;
3176
+ /**
3177
+ * 文本模型名称,与 textProviderId 需同时填写;null 使用全局文本模型
3178
+ */
3179
+ textModel?: string | null;
1575
3180
  welcome?: RagWelcomeConfig;
3181
+ /**
3182
+ * 推荐问题列表;null 继承全局
3183
+ */
1576
3184
  recommendedQuestions?: Array<string> | null;
1577
3185
  };
1578
3186
  path?: never;
@@ -1603,8 +3211,14 @@ export type PostApiRagsResponses = {
1603
3211
  * 业务码,成功为 0
1604
3212
  */
1605
3213
  code: number;
3214
+ /**
3215
+ * 提示信息,失败时为错误原因
3216
+ */
1606
3217
  message: string;
1607
3218
  data: {
3219
+ /**
3220
+ * 新建问答助手 ID
3221
+ */
1608
3222
  id: number;
1609
3223
  };
1610
3224
  };
@@ -1613,6 +3227,9 @@ export type PostApiRagsResponse = PostApiRagsResponses[keyof PostApiRagsResponse
1613
3227
  export type DeleteApiRagsByIdData = {
1614
3228
  body?: never;
1615
3229
  path: {
3230
+ /**
3231
+ * 资源 ID
3232
+ */
1616
3233
  id: string;
1617
3234
  };
1618
3235
  query?: never;
@@ -1654,6 +3271,9 @@ export type DeleteApiRagsByIdResponses = {
1654
3271
  * 业务码,成功为 0
1655
3272
  */
1656
3273
  code: number;
3274
+ /**
3275
+ * 提示信息,失败时为错误原因
3276
+ */
1657
3277
  message: string;
1658
3278
  data: null;
1659
3279
  };
@@ -1662,6 +3282,9 @@ export type DeleteApiRagsByIdResponse = DeleteApiRagsByIdResponses[keyof DeleteA
1662
3282
  export type GetApiRagsByIdData = {
1663
3283
  body?: never;
1664
3284
  path: {
3285
+ /**
3286
+ * 资源 ID
3287
+ */
1665
3288
  id: string;
1666
3289
  };
1667
3290
  query?: never;
@@ -1703,6 +3326,9 @@ export type GetApiRagsByIdResponses = {
1703
3326
  * 业务码,成功为 0
1704
3327
  */
1705
3328
  code: number;
3329
+ /**
3330
+ * 提示信息,失败时为错误原因
3331
+ */
1706
3332
  message: string;
1707
3333
  data: Rag;
1708
3334
  };
@@ -1710,25 +3336,84 @@ export type GetApiRagsByIdResponses = {
1710
3336
  export type GetApiRagsByIdResponse = GetApiRagsByIdResponses[keyof GetApiRagsByIdResponses];
1711
3337
  export type PatchApiRagsByIdData = {
1712
3338
  body: {
3339
+ /**
3340
+ * 名称
3341
+ */
1713
3342
  name?: string;
3343
+ /**
3344
+ * 描述;作为智能路由候选且未填写意图时,用作意图描述
3345
+ */
1714
3346
  description?: string | null;
3347
+ /**
3348
+ * 问答助手唯一标识,可用于创建会话;不可包含逗号
3349
+ */
1715
3350
  mark?: string | null;
3351
+ /**
3352
+ * 绑定的知识库 ID
3353
+ */
1716
3354
  kbId?: number;
3355
+ /**
3356
+ * 系统提示词,支持 {{context}} 检索资料、{{fallback}} 低匹配度默认回复变量;null 继承全局
3357
+ */
1717
3358
  systemPrompt?: string | null;
3359
+ /**
3360
+ * 问题拆分提示词;null 继承全局
3361
+ */
1718
3362
  splitPrompt?: string | null;
3363
+ /**
3364
+ * 是否将用户问题拆分为多个子问题分别检索;null 继承全局
3365
+ */
1719
3366
  splitQuery?: boolean | null;
3367
+ /**
3368
+ * 向量检索匹配度阈值,取值 0~1,低于阈值的结果被过滤;null 继承全局
3369
+ */
1720
3370
  scoreThreshold?: number | null;
3371
+ /**
3372
+ * 检索结果全部低于阈值时的回复文案;null 继承全局
3373
+ */
1721
3374
  lowScoreReply?: string | null;
3375
+ /**
3376
+ * 深度思考:default 使用模型默认,false 关闭,low / medium / high 为思考强度;null 继承全局
3377
+ */
1722
3378
  deepThinking?: 'default' | 'false' | 'low' | 'medium' | 'high' | null;
3379
+ /**
3380
+ * 是否开启多轮对话(携带历史上下文);null 继承全局
3381
+ */
1723
3382
  multiTurn?: boolean | null;
3383
+ /**
3384
+ * 多轮对话上下文 Token 阈值,超出后压缩历史;null 继承全局
3385
+ */
1724
3386
  contextThreshold?: number | null;
3387
+ /**
3388
+ * 每个问题向量检索的最大匹配数;null 继承全局
3389
+ */
1725
3390
  retrieveLimit?: number | null;
3391
+ /**
3392
+ * 单条消息图片数量上限;null 继承全局
3393
+ */
1726
3394
  imageMaxCount?: number | null;
3395
+ /**
3396
+ * 对话图片压缩最长边(像素);null 继承全局
3397
+ */
1727
3398
  imageMaxEdge?: number | null;
3399
+ /**
3400
+ * 文本模型供应商 ID,与 textModel 需同时填写;null 使用全局文本模型
3401
+ */
3402
+ textProviderId?: number | null;
3403
+ /**
3404
+ * 文本模型名称,与 textProviderId 需同时填写;null 使用全局文本模型
3405
+ */
3406
+ textModel?: string | null;
1728
3407
  welcome?: RagWelcomeConfig;
3408
+ /**
3409
+ * 推荐问题列表;null 继承全局
3410
+ */
1729
3411
  recommendedQuestions?: Array<string> | null;
1730
3412
  };
1731
3413
  path: {
3414
+ /**
3415
+ * 资源 ID
3416
+ */
1732
3417
  id: string;
1733
3418
  };
1734
3419
  query?: never;
@@ -1770,6 +3455,9 @@ export type PatchApiRagsByIdResponses = {
1770
3455
  * 业务码,成功为 0
1771
3456
  */
1772
3457
  code: number;
3458
+ /**
3459
+ * 提示信息,失败时为错误原因
3460
+ */
1773
3461
  message: string;
1774
3462
  data: Rag;
1775
3463
  };
@@ -1779,7 +3467,13 @@ export type GetApiRagsDetailData = {
1779
3467
  body?: never;
1780
3468
  path?: never;
1781
3469
  query?: {
3470
+ /**
3471
+ * 问答助手 ID,与 mark 不能同时为空
3472
+ */
1782
3473
  id?: number | null;
3474
+ /**
3475
+ * 问答助手标识,与 id 不能同时为空
3476
+ */
1783
3477
  mark?: string;
1784
3478
  };
1785
3479
  url: '/api/rags/detail';
@@ -1812,6 +3506,9 @@ export type GetApiRagsDetailResponses = {
1812
3506
  * 业务码,成功为 0
1813
3507
  */
1814
3508
  code: number;
3509
+ /**
3510
+ * 提示信息,失败时为错误原因
3511
+ */
1815
3512
  message: string;
1816
3513
  data: RagDetail;
1817
3514
  };
@@ -1856,6 +3553,9 @@ export type DeleteApiDocumentsResponses = {
1856
3553
  * 业务码,成功为 0
1857
3554
  */
1858
3555
  code: number;
3556
+ /**
3557
+ * 提示信息,失败时为错误原因
3558
+ */
1859
3559
  message: string;
1860
3560
  data: null;
1861
3561
  };
@@ -1896,6 +3596,9 @@ export type GetApiDocumentsResponses = {
1896
3596
  * 业务码,成功为 0
1897
3597
  */
1898
3598
  code: number;
3599
+ /**
3600
+ * 提示信息,失败时为错误原因
3601
+ */
1899
3602
  message: string;
1900
3603
  data: Array<DocumentSummary>;
1901
3604
  };
@@ -1903,7 +3606,13 @@ export type GetApiDocumentsResponses = {
1903
3606
  export type GetApiDocumentsResponse = GetApiDocumentsResponses[keyof GetApiDocumentsResponses];
1904
3607
  export type PostApiDocumentsData = {
1905
3608
  body?: {
3609
+ /**
3610
+ * 文档名,不能包含 /,同级不能与文件夹或文档重名
3611
+ */
1906
3612
  filename: string;
3613
+ /**
3614
+ * 所在文件夹 ID,不传或 null 表示根目录
3615
+ */
1907
3616
  folderId?: string | null;
1908
3617
  visibility?: Visibility;
1909
3618
  };
@@ -1944,6 +3653,9 @@ export type PostApiDocumentsResponses = {
1944
3653
  * 业务码,成功为 0
1945
3654
  */
1946
3655
  code: number;
3656
+ /**
3657
+ * 提示信息,失败时为错误原因
3658
+ */
1947
3659
  message: string;
1948
3660
  data: DocumentSummary;
1949
3661
  };
@@ -1988,6 +3700,9 @@ export type GetApiDocumentsTreeResponses = {
1988
3700
  * 业务码,成功为 0
1989
3701
  */
1990
3702
  code: number;
3703
+ /**
3704
+ * 提示信息,失败时为错误原因
3705
+ */
1991
3706
  message: string;
1992
3707
  data: Array<DocumentTreeNode>;
1993
3708
  };
@@ -2035,6 +3750,9 @@ export type PatchApiDocumentsByPathResponses = {
2035
3750
  * 业务码,成功为 0
2036
3751
  */
2037
3752
  code: number;
3753
+ /**
3754
+ * 提示信息,失败时为错误原因
3755
+ */
2038
3756
  message: string;
2039
3757
  data: Document;
2040
3758
  };
@@ -2043,6 +3761,9 @@ export type PatchApiDocumentsByPathResponse = PatchApiDocumentsByPathResponses[k
2043
3761
  export type DeleteApiDocumentsByIdData = {
2044
3762
  body?: never;
2045
3763
  path: {
3764
+ /**
3765
+ * 资源 ID
3766
+ */
2046
3767
  id: string;
2047
3768
  };
2048
3769
  query?: never;
@@ -2084,6 +3805,9 @@ export type DeleteApiDocumentsByIdResponses = {
2084
3805
  * 业务码,成功为 0
2085
3806
  */
2086
3807
  code: number;
3808
+ /**
3809
+ * 提示信息,失败时为错误原因
3810
+ */
2087
3811
  message: string;
2088
3812
  data: null;
2089
3813
  };
@@ -2092,9 +3816,15 @@ export type DeleteApiDocumentsByIdResponse = DeleteApiDocumentsByIdResponses[key
2092
3816
  export type GetApiDocumentsByIdData = {
2093
3817
  body?: never;
2094
3818
  path: {
3819
+ /**
3820
+ * 资源 ID
3821
+ */
2095
3822
  id: string;
2096
3823
  };
2097
3824
  query?: {
3825
+ /**
3826
+ * 访问来源,用于访问统计:docs 文档页、search 检索结果;不传记为直接访问
3827
+ */
2098
3828
  source?: 'docs' | 'search';
2099
3829
  };
2100
3830
  url: '/api/documents/{id}';
@@ -2123,6 +3853,9 @@ export type GetApiDocumentsByIdResponses = {
2123
3853
  * 业务码,成功为 0
2124
3854
  */
2125
3855
  code: number;
3856
+ /**
3857
+ * 提示信息,失败时为错误原因
3858
+ */
2126
3859
  message: string;
2127
3860
  data: Document;
2128
3861
  };
@@ -2130,13 +3863,36 @@ export type GetApiDocumentsByIdResponses = {
2130
3863
  export type GetApiDocumentsByIdResponse = GetApiDocumentsByIdResponses[keyof GetApiDocumentsByIdResponses];
2131
3864
  export type PatchApiDocumentsByIdData = {
2132
3865
  body: {
3866
+ /**
3867
+ * 文档名
3868
+ */
2133
3869
  filename?: string;
3870
+ /**
3871
+ * Markdown 正文,修改后重新分块与向量化
3872
+ */
2134
3873
  content?: string;
2135
3874
  visibility?: Visibility;
3875
+ /**
3876
+ * 分块大小(字符),不小于 100;null 继承知识库或全局
3877
+ */
2136
3878
  chunkSize?: number | null;
3879
+ /**
3880
+ * 分块重叠字符数,需小于分块大小;null 继承知识库或全局
3881
+ */
2137
3882
  chunkOverlap?: number | null;
3883
+ /**
3884
+ * 移动到的目标文件夹 ID,null 表示根目录
3885
+ */
3886
+ folderId?: string | null;
3887
+ /**
3888
+ * 在目标目录中的排序位置,从 0 开始
3889
+ */
3890
+ index?: number;
2138
3891
  };
2139
3892
  path: {
3893
+ /**
3894
+ * 资源 ID
3895
+ */
2140
3896
  id: string;
2141
3897
  };
2142
3898
  query?: never;
@@ -2178,16 +3934,80 @@ export type PatchApiDocumentsByIdResponses = {
2178
3934
  * 业务码,成功为 0
2179
3935
  */
2180
3936
  code: number;
3937
+ /**
3938
+ * 提示信息,失败时为错误原因
3939
+ */
2181
3940
  message: string;
2182
3941
  data: Document;
2183
3942
  };
2184
3943
  };
2185
3944
  export type PatchApiDocumentsByIdResponse = PatchApiDocumentsByIdResponses[keyof PatchApiDocumentsByIdResponses];
3945
+ export type PostApiDocumentsByIdCopyData = {
3946
+ body?: never;
3947
+ path: {
3948
+ /**
3949
+ * 资源 ID
3950
+ */
3951
+ id: string;
3952
+ };
3953
+ query?: never;
3954
+ url: '/api/documents/{id}/copy';
3955
+ };
3956
+ export type PostApiDocumentsByIdCopyErrors = {
3957
+ /**
3958
+ * 请求参数无效
3959
+ */
3960
+ 400: ErrorResponse;
3961
+ /**
3962
+ * 未登录
3963
+ */
3964
+ 401: ErrorResponse;
3965
+ /**
3966
+ * 无权限
3967
+ */
3968
+ 403: ErrorResponse;
3969
+ /**
3970
+ * 资源不存在
3971
+ */
3972
+ 404: ErrorResponse;
3973
+ /**
3974
+ * LLM 并发已满
3975
+ */
3976
+ 429: ErrorResponse;
3977
+ /**
3978
+ * 服务器内部错误
3979
+ */
3980
+ 500: ErrorResponse;
3981
+ };
3982
+ export type PostApiDocumentsByIdCopyError = PostApiDocumentsByIdCopyErrors[keyof PostApiDocumentsByIdCopyErrors];
3983
+ export type PostApiDocumentsByIdCopyResponses = {
3984
+ /**
3985
+ * 成功
3986
+ */
3987
+ 200: {
3988
+ /**
3989
+ * 业务码,成功为 0
3990
+ */
3991
+ code: number;
3992
+ /**
3993
+ * 提示信息,失败时为错误原因
3994
+ */
3995
+ message: string;
3996
+ data: Document;
3997
+ };
3998
+ };
3999
+ export type PostApiDocumentsByIdCopyResponse = PostApiDocumentsByIdCopyResponses[keyof PostApiDocumentsByIdCopyResponses];
2186
4000
  export type GetApiFoldersData = {
2187
4001
  body?: never;
2188
4002
  path?: never;
2189
4003
  query?: {
4004
+ /**
4005
+ * 知识库 ID,与 mark 不能同时为空
4006
+ */
2190
4007
  kbId?: number | null;
4008
+ /**
4009
+ * 知识库标识,与 kbId 不能同时为空
4010
+ */
2191
4011
  mark?: string;
2192
4012
  };
2193
4013
  url: '/api/folders';
@@ -2220,6 +4040,9 @@ export type GetApiFoldersResponses = {
2220
4040
  * 业务码,成功为 0
2221
4041
  */
2222
4042
  code: number;
4043
+ /**
4044
+ * 提示信息,失败时为错误原因
4045
+ */
2223
4046
  message: string;
2224
4047
  data: Array<Folder>;
2225
4048
  };
@@ -2227,9 +4050,18 @@ export type GetApiFoldersResponses = {
2227
4050
  export type GetApiFoldersResponse = GetApiFoldersResponses[keyof GetApiFoldersResponses];
2228
4051
  export type PostApiFoldersData = {
2229
4052
  body: {
4053
+ /**
4054
+ * 文件夹名,不能包含 /,同级不能与文件夹或文档重名
4055
+ */
2230
4056
  name: string;
4057
+ /**
4058
+ * 父文件夹 ID,不传或 null 表示根目录
4059
+ */
2231
4060
  parentId?: string | null;
2232
4061
  visibility?: Visibility;
4062
+ /**
4063
+ * 所属知识库 ID
4064
+ */
2233
4065
  kbId: number;
2234
4066
  };
2235
4067
  path?: never;
@@ -2264,6 +4096,9 @@ export type PostApiFoldersResponses = {
2264
4096
  * 业务码,成功为 0
2265
4097
  */
2266
4098
  code: number;
4099
+ /**
4100
+ * 提示信息,失败时为错误原因
4101
+ */
2267
4102
  message: string;
2268
4103
  data: Folder;
2269
4104
  };
@@ -2272,6 +4107,9 @@ export type PostApiFoldersResponse = PostApiFoldersResponses[keyof PostApiFolder
2272
4107
  export type DeleteApiFoldersByIdData = {
2273
4108
  body?: never;
2274
4109
  path: {
4110
+ /**
4111
+ * 资源 ID
4112
+ */
2275
4113
  id: string;
2276
4114
  };
2277
4115
  query?: never;
@@ -2313,6 +4151,9 @@ export type DeleteApiFoldersByIdResponses = {
2313
4151
  * 业务码,成功为 0
2314
4152
  */
2315
4153
  code: number;
4154
+ /**
4155
+ * 提示信息,失败时为错误原因
4156
+ */
2316
4157
  message: string;
2317
4158
  data: null;
2318
4159
  };
@@ -2320,11 +4161,24 @@ export type DeleteApiFoldersByIdResponses = {
2320
4161
  export type DeleteApiFoldersByIdResponse = DeleteApiFoldersByIdResponses[keyof DeleteApiFoldersByIdResponses];
2321
4162
  export type PatchApiFoldersByIdData = {
2322
4163
  body: {
4164
+ /**
4165
+ * 文件夹名,不能包含 /
4166
+ */
2323
4167
  name?: string;
4168
+ /**
4169
+ * 移动到的父文件夹 ID,null 表示根目录
4170
+ */
2324
4171
  parentId?: string | null;
2325
4172
  visibility?: Visibility;
4173
+ /**
4174
+ * 在同级中的排序位置,从 0 开始
4175
+ */
4176
+ index?: number;
2326
4177
  };
2327
4178
  path: {
4179
+ /**
4180
+ * 资源 ID
4181
+ */
2328
4182
  id: string;
2329
4183
  };
2330
4184
  query?: never;
@@ -2366,6 +4220,9 @@ export type PatchApiFoldersByIdResponses = {
2366
4220
  * 业务码,成功为 0
2367
4221
  */
2368
4222
  code: number;
4223
+ /**
4224
+ * 提示信息,失败时为错误原因
4225
+ */
2369
4226
  message: string;
2370
4227
  data: Folder;
2371
4228
  };
@@ -2374,6 +4231,9 @@ export type PatchApiFoldersByIdResponse = PatchApiFoldersByIdResponses[keyof Pat
2374
4231
  export type PostApiWorkflowsByIdInvokeData = {
2375
4232
  body: WorkflowInvokeRequest;
2376
4233
  path: {
4234
+ /**
4235
+ * 资源 ID
4236
+ */
2377
4237
  id: string;
2378
4238
  };
2379
4239
  query?: never;
@@ -2415,6 +4275,9 @@ export type PostApiWorkflowsByIdInvokeResponses = {
2415
4275
  * 业务码,成功为 0
2416
4276
  */
2417
4277
  code: number;
4278
+ /**
4279
+ * 提示信息,失败时为错误原因
4280
+ */
2418
4281
  message: string;
2419
4282
  data: WorkflowInvokeResult;
2420
4283
  };