@fv-ui/ai-chat 0.10.1 → 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.
package/dist/index.d.ts CHANGED
@@ -15,12 +15,145 @@ interface CreateMarkdownOptions {
15
15
  mdPlugins?: MdPlugin[];
16
16
  }
17
17
 
18
+ /**
19
+ * zh-CN 语言包(默认语言)。
20
+ * 值与各组件历史硬编码文案逐字一致(全角标点、省略号均保持),保证零配置升级无任何视觉变化。
21
+ * 结构即 LocaleMessages 源型;en-US 以 satisfies 同构对齐。
22
+ */
23
+ declare const zhCN: {
24
+ common: {
25
+ copy: string;
26
+ delete: string;
27
+ confirm: string;
28
+ cancel: string;
29
+ retry: string;
30
+ close: string;
31
+ preview: string;
32
+ clear: string;
33
+ stop: string;
34
+ send: string;
35
+ download: string;
36
+ fullscreen: string;
37
+ collapse: string;
38
+ expand: string;
39
+ };
40
+ thinking: {
41
+ start: string;
42
+ thinking: string;
43
+ end: string;
44
+ error: string;
45
+ };
46
+ sender: {
47
+ clear: string;
48
+ stop: string;
49
+ send: string;
50
+ speech: string;
51
+ recordCancel: string;
52
+ recordConfirm: string;
53
+ micUnavailable: string;
54
+ };
55
+ editorSender: {
56
+ clear: string;
57
+ stop: string;
58
+ send: string;
59
+ inputPlaceholder: string;
60
+ selectTagTitle: string;
61
+ loading: string;
62
+ tagTip: string;
63
+ };
64
+ attachments: {
65
+ add: string;
66
+ retry: string;
67
+ };
68
+ filesCard: {
69
+ remove: string;
70
+ };
71
+ conversations: {
72
+ menuLabel: string;
73
+ rename: string;
74
+ delete: string;
75
+ renameTitle: string;
76
+ renamePrompt: string;
77
+ renamePlaceholder: string;
78
+ deleteTitle: string;
79
+ deleteConfirm: string;
80
+ };
81
+ scroll: {
82
+ toBottom: string;
83
+ };
84
+ aiChat: {
85
+ modelPlaceholder: string;
86
+ adapterMissing: string;
87
+ generateFailed: string;
88
+ exportUser: string;
89
+ exportAssistant: string;
90
+ };
91
+ aiMessage: {
92
+ copy: string;
93
+ regenerate: string;
94
+ prevBranch: string;
95
+ nextBranch: string;
96
+ defaultUserName: string;
97
+ defaultAssistantName: string;
98
+ querying: string;
99
+ queried: string;
100
+ generateFailed: string;
101
+ };
102
+ aiArtifacts: {
103
+ copy: string;
104
+ download: string;
105
+ fullscreen: string;
106
+ close: string;
107
+ };
108
+ chat: {
109
+ fileTag: string;
110
+ fileImageTag: string;
111
+ filesSystemPrompt: string;
112
+ toolDuration: string;
113
+ continuePrompt: string;
114
+ };
115
+ errors: {
116
+ requestFailed: string;
117
+ sessionIdMissing: string;
118
+ noBody: string;
119
+ generateFailed: string;
120
+ recordUnsupported: string;
121
+ speechError: string;
122
+ };
123
+ };
124
+
125
+ /**
126
+ * 语言包类型:以 zh-CN 为源型推导(单一事实来源,勿手写接口——新增 key 只改 zh-CN,en 编译期报缺)。
127
+ */
128
+ type LocaleMessages = typeof zhCN;
129
+
130
+ /** en-US 语言包(satisfies LocaleMessages:key 集合与 zh-CN 编译期对齐) */
131
+ declare const enUS: LocaleMessages;
132
+
133
+ /** 一层 Partial 即够(语言包结构固定两层:分组.文案) */
134
+ type DeepPartialLocale = {
135
+ [K in keyof LocaleMessages]?: Partial<LocaleMessages[K]>;
136
+ };
137
+ /** 组件 locale prop 形态:内置语言名字符串(整包切换)或部分文案对象(在基底上深合并) */
138
+ type LocaleInput = string | DeepPartialLocale;
139
+ /**
140
+ * 全局语言设置。
141
+ * 字符串选内置包(未知回落 zh-CN);对象视为**完整语言包**(消费方自建语言的主入口,
142
+ * 与组件 prop 的"部分覆盖"语义有意不同:全局是定基准,prop 是在基准上微调)。
143
+ */
144
+ declare function configureLocale(locale: 'zh-CN' | 'en-US' | LocaleMessages): void;
145
+
18
146
  type __VLS_Props$h = {
19
147
  content: string;
20
148
  mdPlugins?: CreateMarkdownOptions['mdPlugins'];
21
149
  highlight?: (str: string, lang: string) => string;
22
150
  /** 打字机模式下由父组件控制渲染策略,本组件保留透传占位 */
23
151
  isTyping?: boolean;
152
+ /** 代码块「预览」触发语言(fence 原始 lang 命中列表时,代码块右上角注入
153
+ * data-fv-code-trigger 按钮;点击行为由消费方事件委托实现,如 AiChat 打开 Artifacts 面板) */
154
+ codeTriggerLangs?: string[];
155
+ /** 语言包:'zh-CN'/'en-US' 整包或部分文案对象(优先于祖先注入与全局设置) */
156
+ locale?: LocaleInput;
24
157
  };
25
158
  declare const __VLS_export$h: vue.DefineComponent<__VLS_Props$h, {
26
159
  getHtml: () => string;
@@ -41,6 +174,10 @@ type __VLS_Props$g = {
41
174
  interval?: number;
42
175
  suffix?: string;
43
176
  };
177
+ /** 代码块「预览」触发语言(isMarkdown 模式透传 Markdown;命中语言的代码块注入触发按钮) */
178
+ codeTriggerLangs?: string[];
179
+ /** 语言包,透传内嵌 Markdown 的代码块「预览」按钮文案 */
180
+ locale?: LocaleInput;
44
181
  };
45
182
  declare function interrupt$1(): void;
46
183
  declare function continueTy$1(): void;
@@ -182,6 +319,7 @@ declare const __VLS_base$e: vue.DefineComponent<__VLS_Props$f, {
182
319
  onWriting?: (() => any) | undefined;
183
320
  "onAvatar-error"?: ((event: Event) => any) | undefined;
184
321
  }>, {
322
+ loading: boolean;
185
323
  content: string;
186
324
  isMarkdown: boolean;
187
325
  isFog: boolean | {
@@ -191,7 +329,6 @@ declare const __VLS_base$e: vue.DefineComponent<__VLS_Props$f, {
191
329
  typing: boolean | TypingConfig;
192
330
  shape: "round" | "corner";
193
331
  placement: "start" | "end";
194
- loading: boolean;
195
332
  variant: "filled" | "borderless" | "outlined" | "shadow";
196
333
  avatar: string;
197
334
  avatarSize: number | "" | "default" | "small" | "large";
@@ -246,6 +383,8 @@ type __VLS_Props$e = {
246
383
  * - number[]:仅指定索引上抛(无效索引过滤并 console.warn)
247
384
  */
248
385
  triggerIndices?: 'only-last' | 'all' | number[];
386
+ /** 语言配置:内置语言名(如 'en-US')或部分文案对象(深合并覆盖) */
387
+ locale?: LocaleInput;
249
388
  };
250
389
  declare function scrollToTop$1(): void;
251
390
  declare function scrollToBottom$1(): void;
@@ -291,6 +430,7 @@ declare const __VLS_base$d: vue.DefineComponent<__VLS_Props$e, {
291
430
  }, string, vue.PublicProps, Readonly<__VLS_Props$e> & Readonly<{
292
431
  onComplete?: ((instance: unknown, index: number) => any) | undefined;
293
432
  }>, {
433
+ locale: LocaleInput;
294
434
  list: BubbleListItemProps[];
295
435
  maxHeight: string;
296
436
  alwaysShowScrollbar: boolean;
@@ -323,7 +463,7 @@ type __VLS_Props$d = {
323
463
  minRows?: number;
324
464
  maxRows?: number;
325
465
  };
326
- /** 输入字数上限:超限截断(det-oms 约定 ≤8000);缺省不限制 */
466
+ /** 输入字数上限:超限截断(Fv 系后端约定 ≤8000);缺省不限制 */
327
467
  maxlength?: number;
328
468
  /** 提交按键模式 */
329
469
  submitType?: 'enter' | 'shiftEnter' | 'cmdOrCtrlEnter' | 'altEnter';
@@ -359,6 +499,8 @@ type __VLS_Props$d = {
359
499
  allowSpeech?: boolean;
360
500
  /** 允许空内容提交(附件场景:只发文件不输文字时提交按钮保持可点) */
361
501
  allowEmptySubmit?: boolean;
502
+ /** 语言包:'zh-CN'/'en-US' 整包或部分文案对象(优先于祖先注入与全局设置) */
503
+ locale?: LocaleInput;
362
504
  };
363
505
  declare function submit$1(): void;
364
506
  declare function cancel$1(): void;
@@ -401,27 +543,27 @@ declare const __VLS_base$c: vue.DefineComponent<__VLS_Props$d, {
401
543
  openHeader: typeof openHeader$2;
402
544
  closeHeader: typeof closeHeader$2;
403
545
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
546
+ cancel: () => any;
404
547
  submit: (value: string) => any;
405
548
  trigger: (keyword: string, visible: boolean) => any;
406
549
  "update:modelValue": (value: string) => any;
407
- cancel: () => any;
408
550
  change: (value: string) => any;
409
551
  "recording-change": (recording: boolean) => any;
410
552
  "paste-file": (file: File) => any;
411
553
  "update:triggerPopoverVisible": (value: boolean) => any;
412
554
  }, string, vue.PublicProps, Readonly<__VLS_Props$d> & Readonly<{
555
+ onCancel?: (() => any) | undefined;
413
556
  onSubmit?: ((value: string) => any) | undefined;
414
557
  onTrigger?: ((keyword: string, visible: boolean) => any) | undefined;
415
558
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
416
- onCancel?: (() => any) | undefined;
417
559
  onChange?: ((value: string) => any) | undefined;
418
560
  "onRecording-change"?: ((recording: boolean) => any) | undefined;
419
561
  "onPaste-file"?: ((file: File) => any) | undefined;
420
562
  "onUpdate:triggerPopoverVisible"?: ((value: boolean) => any) | undefined;
421
563
  }>, {
564
+ loading: boolean;
422
565
  shadow: boolean;
423
566
  round: boolean;
424
- loading: boolean;
425
567
  variant: "default" | "updown";
426
568
  disabled: boolean;
427
569
  modelValue: string;
@@ -480,6 +622,8 @@ type __VLS_Props$c = {
480
622
  customTrigger?: MentionCustomTrigger[];
481
623
  /** 异步候选:存在时防抖 300ms 拉取(后端负责过滤) */
482
624
  asyncMatchFun?: (search: string) => Promise<MentionUserInfo[]>;
625
+ /** 语言包:'zh-CN'/'en-US' 整包或部分文案对象(优先于祖先注入与全局设置) */
626
+ locale?: LocaleInput;
483
627
  };
484
628
  declare function submit(): void;
485
629
  declare function cancel(): void;
@@ -509,26 +653,27 @@ declare const __VLS_base$b: vue.DefineComponent<__VLS_Props$c, {
509
653
  setUserTag: typeof setUserTag$1;
510
654
  setCustomTag: typeof setCustomTag$1;
511
655
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
656
+ cancel: () => any;
512
657
  submit: (value: string) => any;
513
658
  trigger: (keyword: string, visible: boolean) => any;
514
659
  "update:modelValue": (value: string) => any;
515
- cancel: () => any;
516
660
  change: (value: string) => any;
517
661
  "recording-change": (recording: boolean) => any;
518
662
  "paste-file": (file: File) => any;
519
663
  "update:triggerPopoverVisible": (value: boolean) => any;
520
664
  "show-at-dialog": (visible: boolean) => any;
521
665
  }, string, vue.PublicProps, Readonly<__VLS_Props$c> & Readonly<{
666
+ onCancel?: (() => any) | undefined;
522
667
  onSubmit?: ((value: string) => any) | undefined;
523
668
  onTrigger?: ((keyword: string, visible: boolean) => any) | undefined;
524
669
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
525
- onCancel?: (() => any) | undefined;
526
670
  onChange?: ((value: string) => any) | undefined;
527
671
  "onRecording-change"?: ((recording: boolean) => any) | undefined;
528
672
  "onPaste-file"?: ((file: File) => any) | undefined;
529
673
  "onUpdate:triggerPopoverVisible"?: ((value: boolean) => any) | undefined;
530
674
  "onShow-at-dialog"?: ((visible: boolean) => any) | undefined;
531
675
  }>, {
676
+ locale: LocaleInput;
532
677
  modelValue: string;
533
678
  userList: MentionUserInfo[];
534
679
  customTrigger: MentionCustomTrigger[];
@@ -659,6 +804,8 @@ type __VLS_Props$b = {
659
804
  asyncMatchFun?: (search: string) => Promise<EditorUser[]>;
660
805
  /** 自定义弹窗:true 时不弹内置选择弹窗,仅上抛 show-select-dialog 由外部接管 */
661
806
  customDialog?: boolean;
807
+ /** 语言包:'zh-CN'/'en-US' 整包或部分文案对象(优先于祖先注入与全局设置) */
808
+ locale?: LocaleInput;
662
809
  };
663
810
  /**
664
811
  * 编辑器 API:state 为数据源,insert/update/delete/append 为对外操作面。
@@ -758,15 +905,15 @@ declare const __VLS_base$a: vue.DefineComponent<__VLS_Props$b, {
758
905
  opNode: typeof opNode;
759
906
  chatState: typeof chatState;
760
907
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
761
- submit: (payload: SubmitResult) => any;
762
908
  cancel: () => any;
909
+ submit: (payload: SubmitResult) => any;
763
910
  change: (payload: SubmitResult) => any;
764
911
  "show-at-dialog": (visible: boolean) => any;
765
912
  "show-select-dialog": (visible: boolean) => any;
766
913
  "show-tag-dialog": (visible: boolean) => any;
767
914
  }, string, vue.PublicProps, Readonly<__VLS_Props$b> & Readonly<{
768
- onSubmit?: ((payload: SubmitResult) => any) | undefined;
769
915
  onCancel?: (() => any) | undefined;
916
+ onSubmit?: ((payload: SubmitResult) => any) | undefined;
770
917
  onChange?: ((payload: SubmitResult) => any) | undefined;
771
918
  "onShow-at-dialog"?: ((visible: boolean) => any) | undefined;
772
919
  "onShow-select-dialog"?: ((visible: boolean) => any) | undefined;
@@ -802,7 +949,7 @@ type ThinkingStatus = 'start' | 'thinking' | 'end' | 'error';
802
949
  type __VLS_Props$a = {
803
950
  /** 展开/收起(v-model) */
804
951
  modelValue?: boolean;
805
- /** 思考内容(#content 插槽常嵌 XMarkdown/Typewriter 渲染思考流) */
952
+ /** 思考内容(#content 插槽常嵌 FvMarkdown/Typewriter 渲染思考流) */
806
953
  content?: string;
807
954
  /** 思考状态:start 起始 / thinking 思考中 / end 完成 / error 出错 */
808
955
  status?: ThinkingStatus;
@@ -818,6 +965,8 @@ type __VLS_Props$a = {
818
965
  color?: string;
819
966
  /** 背景色 */
820
967
  backgroundColor?: string;
968
+ /** 语言包:'zh-CN'/'en-US' 整包或部分文案对象(优先于祖先注入与全局设置) */
969
+ locale?: LocaleInput;
821
970
  };
822
971
  /** 切换门控:start 起始态不可切换;thinking 中可展开查看思考流,end/error 后可自由收起展开 */
823
972
  declare function toggle(): void;
@@ -874,13 +1023,13 @@ interface ThoughtChainItem {
874
1023
  /** 追加到链项的修饰类(如 is-text 标记文案步,消费方可定制样式) */
875
1024
  class?: string;
876
1025
  /** 打字机:思考文案步流式期间逐字打出(正文同款;透传 FvTypewriter typing 配置)。
877
- * 标记移除(消息落定)后打完积压即回落静态渲染,恢复折叠测量 */
1026
+ * 新步追加/本步封口时剩余文字一次性冲刷出完;标记移除(消息落定)后回落静态,恢复折叠测量 */
878
1027
  typing?: boolean | {
879
1028
  step?: number;
880
1029
  interval?: number;
881
1030
  };
882
1031
  /** 思考段步已封口(text 步专用):tool 事件/正文 delta 到达时由数据层置位,
883
- * 该步后续不再增长;与打字完成态联合判定提前回落静态 */
1032
+ * 该步后续不再增长;仍在打字时剩余文字直接冲刷出完(一次性回落静态) */
884
1033
  closed?: boolean;
885
1034
  }
886
1035
  type __VLS_Props$9 = {
@@ -890,6 +1039,8 @@ type __VLS_Props$9 = {
890
1039
  direction?: 'vertical' | 'horizontal';
891
1040
  /** 长文案展开/收起开关(默认关闭:超长 title 原样全量展示;开启后超 3 行截断 + 行尾「展开」) */
892
1041
  collapsible?: boolean;
1042
+ /** 语言包:'zh-CN'/'en-US' 整包或部分文案对象(优先于祖先注入与全局设置) */
1043
+ locale?: LocaleInput;
893
1044
  };
894
1045
  declare var __VLS_45$1: {
895
1046
  item: ThoughtChainItem;
@@ -1000,6 +1151,8 @@ type __VLS_Props$6 = {
1000
1151
  imageSize?: string;
1001
1152
  /** 删除回调:右上删除按钮点击时调用 */
1002
1153
  onDelete?: () => void;
1154
+ /** 语言配置:内置语言名(如 'en-US')或部分文案对象(深合并覆盖) */
1155
+ locale?: LocaleInput;
1003
1156
  };
1004
1157
  declare var __VLS_1$3: {};
1005
1158
  type __VLS_Slots$5 = {} & {
@@ -1008,6 +1161,7 @@ type __VLS_Slots$5 = {} & {
1008
1161
  declare const __VLS_base$5: vue.DefineComponent<__VLS_Props$6, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<__VLS_Props$6> & Readonly<{}>, {
1009
1162
  url: string;
1010
1163
  name: string;
1164
+ locale: LocaleInput;
1011
1165
  size: number | string;
1012
1166
  status: "loading" | "success" | "error";
1013
1167
  fileType: "image" | "file";
@@ -1047,6 +1201,8 @@ type __VLS_Props$5 = {
1047
1201
  beforeUpload?: (file: File) => boolean | Promise<boolean>;
1048
1202
  /** 布局:inline(默认)按钮+列表+提示一行;triggerOnly 只渲染回形针按钮;listOnly 只渲染文件列表 */
1049
1203
  layout?: 'inline' | 'triggerOnly' | 'listOnly';
1204
+ /** 语言配置:内置语言名(如 'en-US')或部分文案对象(深合并覆盖) */
1205
+ locale?: LocaleInput;
1050
1206
  };
1051
1207
  /** 重传:error 项重新置为 loading(具体上传由外部接线,这里只驱动状态流转) */
1052
1208
  declare function retry(item: AttachmentItem): void;
@@ -1078,6 +1234,7 @@ declare const __VLS_base$4: vue.DefineComponent<__VLS_Props$5, {
1078
1234
  onChange?: ((list: object[]) => any) | undefined;
1079
1235
  onExceed?: ((file: File) => any) | undefined;
1080
1236
  }>, {
1237
+ locale: LocaleInput;
1081
1238
  modelValue: object[];
1082
1239
  accept: string;
1083
1240
  tip: string;
@@ -1121,6 +1278,8 @@ type __VLS_Props$4 = {
1121
1278
  loading?: boolean;
1122
1279
  /** 是否还有更早分页(缺省 false 表示一次性全量,不触发 load-more) */
1123
1280
  hasMore?: boolean;
1281
+ /** 语言配置:内置语言名(如 'en-US')或部分文案对象(深合并覆盖) */
1282
+ locale?: LocaleInput;
1124
1283
  };
1125
1284
  declare function handleMenuCommand(cmd: {
1126
1285
  item: ConversationItem;
@@ -1171,6 +1330,7 @@ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$4, {
1171
1330
  "onLoad-more"?: (() => any) | undefined;
1172
1331
  }>, {
1173
1332
  loading: boolean;
1333
+ locale: LocaleInput;
1174
1334
  items: ConversationItem[];
1175
1335
  active: string | number;
1176
1336
  showBuiltInMenuType: "hover" | "always";
@@ -1224,7 +1384,7 @@ interface ChatAdapterHandlers {
1224
1384
  * 与 message_start 的首轮 GENERATING 行 id 可能不同(多轮工具循环),UI 落库/对账以它为准
1225
1385
  */
1226
1386
  onBackendMessageId?(id: string): void;
1227
- /** 工具调用轨迹事件(可选):det-oms 风格 tool{status:start|done} */
1387
+ /** 工具调用轨迹事件(可选):Fv 系通用 tool{status:start|done} */
1228
1388
  onTool?(ev: {
1229
1389
  toolName: string;
1230
1390
  status: 'start' | 'done';
@@ -1259,24 +1419,25 @@ interface OpenAIAdapterConfig {
1259
1419
  declare function OpenAIAdapter(config: OpenAIAdapterConfig): ChatAdapter;
1260
1420
 
1261
1421
  /**
1262
- * det-oms(`/api/ai-chat/*`)风格聊天适配器:六事件 SSE 协议
1422
+ * Fv 系后端通用聊天适配器(`/api/ai-chat/*`):六事件 SSE 协议
1263
1423
  * (message_start / tool / delta / reasoning / message_end / error),POST `/message/send`。
1264
- * V57 起新增 reasoning 思考事件(载荷 {text} 与 delta 同构,多轮每轮都推,无思考轮不推)。
1265
- * 协议细节见 det-oms 前端接入文档 §4;本适配器负责协议解析与事件分发,
1424
+ * 适用于 Fv 各项目组返回此结构的后端;V57 起新增 reasoning 思考事件
1425
+ * (载荷 {text} 与 delta 同构,多轮每轮都推,无思考轮不推)。
1426
+ * 本适配器负责协议解析与事件分发,
1266
1427
  * 会话管理(列表/归档/删除等)由消费方直接调后端,不经此适配器。
1267
1428
  */
1268
1429
  /** send 请求体(sessionId 由工厂按当前会话惰性注入) */
1269
- interface DetOmsSendBody {
1430
+ interface FvCommonSendBody {
1270
1431
  sessionId: string;
1271
1432
  content: string;
1272
1433
  }
1273
- /** 工具事件载荷(det-oms SSE `tool` 事件 data) */
1274
- interface DetOmsToolEvent {
1434
+ /** 工具事件载荷(SSE `tool` 事件 data) */
1435
+ interface FvCommonToolEvent {
1275
1436
  toolName: string;
1276
1437
  status: 'start' | 'done';
1277
1438
  }
1278
1439
  /** 会话列表项(`/session/list` records 行;total 等 IPage 字段为字符串需 parseInt) */
1279
- interface DetOmsSessionItem {
1440
+ interface FvCommonSessionItem {
1280
1441
  id: string;
1281
1442
  title: string;
1282
1443
  titleSource?: 'AUTO' | 'MANUAL';
@@ -1289,7 +1450,7 @@ interface DetOmsSessionItem {
1289
1450
  updatedTime?: string;
1290
1451
  }
1291
1452
  /** 历史/详情消息行(assistant 行 toolCalls 为 JSON 字符串,消费方自行 JSON.parse) */
1292
- interface DetOmsMessage {
1453
+ interface FvCommonMessage {
1293
1454
  id: string;
1294
1455
  seq: number;
1295
1456
  role: 'user' | 'assistant' | 'tool';
@@ -1311,16 +1472,16 @@ interface DetOmsMessage {
1311
1472
  createdTime?: string;
1312
1473
  }
1313
1474
  /** 会话详情出参(`/session/detail`) */
1314
- interface DetOmsSessionDetail {
1315
- session: DetOmsSessionItem;
1316
- messages: DetOmsMessage[];
1475
+ interface FvCommonSessionDetail {
1476
+ session: FvCommonSessionItem;
1477
+ messages: FvCommonMessage[];
1317
1478
  }
1318
1479
  /** 消息 history 分页出参(`/message/history`) */
1319
- interface DetOmsMessagePage {
1320
- messages: DetOmsMessage[];
1480
+ interface FvCommonMessagePage {
1481
+ messages: FvCommonMessage[];
1321
1482
  hasMore: boolean;
1322
1483
  }
1323
- interface DetOmsChatAdapterConfig {
1484
+ interface FvCommonAdapterConfig {
1324
1485
  /** 服务根地址,如 https://host 或 /api(内部拼接 /ai-chat/message/send) */
1325
1486
  baseURL: string;
1326
1487
  /** 请求头(如 { Authorization: 'Bearer ' + token }),每次 send 惰性取用 */
@@ -1331,18 +1492,18 @@ interface DetOmsChatAdapterConfig {
1331
1492
  errorMessages?: Record<number, string>;
1332
1493
  }
1333
1494
  /** 带业务码的错误:同步段 JSON 错误(90601/90602/90603/90105)与 SSE error 事件统一走此形态 */
1334
- declare class DetOmsError extends Error {
1495
+ declare class FvCommonError extends Error {
1335
1496
  code?: number | string;
1336
1497
  constructor(message: string, code?: number | string);
1337
1498
  }
1338
1499
  /**
1339
- * det-oms 聊天适配器:消费五事件 SSE。
1500
+ * Fv 系通用聊天适配器:消费六事件 SSE。
1340
1501
  * 同步段失败(会话不存在/单飞行闸/未启用/参数校验)发生在 SSE 建立前,
1341
1502
  * 响应是普通 JSON 错误——此处按 Content-Type 分流,命中 errorMessages 时用映射文案。
1342
1503
  * 消息三角色里的 tool 行(toolCallId 配对)是会话管理端的落库形态,
1343
1504
  * 流式期间只有 tool{status} 事件(无 tool 行),由 onTool 上抛给消费方展示工具状态。
1344
1505
  */
1345
- declare function DetOmsChatAdapter(config: DetOmsChatAdapterConfig): ChatAdapter;
1506
+ declare function FvCommonAdapter(config: FvCommonAdapterConfig): ChatAdapter;
1346
1507
 
1347
1508
  /**
1348
1509
  * 会话/消息持久化适配器。
@@ -1387,7 +1548,7 @@ type MessageRole = 'user' | 'assistant';
1387
1548
  /** 消息生命周期状态 */
1388
1549
  type MessageStatus = 'pending' | 'streaming' | 'done' | 'error';
1389
1550
  /**
1390
- * 工具调用轨迹项(det-oms 风格):assistant 行 toolCalls 展开后的单个工具调用。
1551
+ * 工具调用轨迹项(Fv 系通用):assistant 行 toolCalls 展开后的单个工具调用。
1391
1552
  * 兼容 OpenAI function calling 形状(type/function.name/function.arguments)。
1392
1553
  */
1393
1554
  interface ToolCallItem {
@@ -1419,7 +1580,7 @@ interface ChatFile {
1419
1580
  type?: 'image' | 'file';
1420
1581
  }
1421
1582
  /**
1422
- * 工具调用轨迹步骤(det-oms 风格):流式 tool 事件与历史 tool 行展开后的单步。
1583
+ * 工具调用轨迹步骤(Fv 系通用):流式 tool 事件与历史 tool 行展开后的单步。
1423
1584
  * status 与 ThoughtChain 链项一致(loading 转圈/success 勾/error 叉)。
1424
1585
  */
1425
1586
  interface ToolStepItem {
@@ -1453,7 +1614,7 @@ interface MessageNode {
1453
1614
  content: string;
1454
1615
  /** 思考链全文(流式期间由包装层追加) */
1455
1616
  reasoning?: string;
1456
- /** 工具调用轨迹(det-oms 流式 tool 事件累积/历史 tool 行展开;AiMessage 以 ThoughtChain 渲染) */
1617
+ /** 工具调用轨迹(Fv 系流式 tool 事件累积/历史 tool 行展开;AiMessage 以 ThoughtChain 渲染) */
1457
1618
  toolSteps?: ToolStepItem[];
1458
1619
  /** 附件列表 */
1459
1620
  files?: ChatFile[];
@@ -1461,9 +1622,9 @@ interface MessageNode {
1461
1622
  modelIdx?: number;
1462
1623
  /** 生成模型名 */
1463
1624
  model?: string;
1464
- /** 后端消息行 id(det-oms 等带会话管理后端):流式 message_end 时回填,UI 落库/对账锚定用 */
1625
+ /** 后端消息行 id(Fv 系带会话管理后端):流式 message_end 时回填,UI 落库/对账锚定用 */
1465
1626
  backendId?: string;
1466
- /** 中间轮工具调用列表(JSON 字符串或已展开数组;det-oms assistant 行 toolCalls 非空即中间轮) */
1627
+ /** 中间轮工具调用列表(JSON 字符串或已展开数组;Fv 系 assistant 行 toolCalls 非空即中间轮) */
1467
1628
  toolCalls?: string | ToolCallItem[];
1468
1629
  /** 父节点 id,根消息为 null */
1469
1630
  parentId: string | null;
@@ -1557,6 +1718,11 @@ type __VLS_Props$3 = {
1557
1718
  };
1558
1719
  /** 思考链长文案展开/收起开关(透传 AiMessage→ThoughtChain;默认关闭) */
1559
1720
  collapsible?: boolean;
1721
+ /** 代码块「预览」触发语言(透传 AiMessage→Markdown;命中语言的代码块右上角注入按钮,
1722
+ * 点击行为由消费方事件委托实现,如 AiChat 打开 Artifacts 面板) */
1723
+ codeTriggerLangs?: string[];
1724
+ /** 语言包:'zh-CN'/'en-US' 整包或部分文案对象(优先于祖先注入与全局设置) */
1725
+ locale?: LocaleInput;
1560
1726
  };
1561
1727
  declare function scrollToBottom(smooth?: boolean): void;
1562
1728
  /** 回到顶部:与 scrollToBottom 同款 try/catch 回落(happy-dom 旧版 scrollTo(options) 可能缺实现) */
@@ -1570,7 +1736,7 @@ declare var __VLS_30$1: {
1570
1736
  };
1571
1737
  declare var __VLS_33$1: {};
1572
1738
  declare var __VLS_36$1: {
1573
- status: "done" | "error" | "thinking";
1739
+ status: "thinking" | "error" | "done";
1574
1740
  message: MessageNode;
1575
1741
  };
1576
1742
  declare var __VLS_39$1: {
@@ -1607,14 +1773,14 @@ declare const __VLS_base$2: vue.DefineComponent<__VLS_Props$3, {
1607
1773
  scrollToBottom: typeof scrollToBottom;
1608
1774
  scrollToTop: typeof scrollToTop;
1609
1775
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
1610
- select: (item: AiMessagesSuggestion) => any;
1611
1776
  copy: (message: MessageNode) => any;
1612
1777
  regenerate: (message: MessageNode) => any;
1778
+ select: (item: AiMessagesSuggestion) => any;
1613
1779
  "branch-change": (dir: BranchDirection, message: MessageNode) => any;
1614
1780
  }, string, vue.PublicProps, Readonly<__VLS_Props$3> & Readonly<{
1615
- onSelect?: ((item: AiMessagesSuggestion) => any) | undefined;
1616
1781
  onCopy?: ((message: MessageNode) => any) | undefined;
1617
1782
  onRegenerate?: ((message: MessageNode) => any) | undefined;
1783
+ onSelect?: ((item: AiMessagesSuggestion) => any) | undefined;
1618
1784
  "onBranch-change"?: ((dir: BranchDirection, message: MessageNode) => any) | undefined;
1619
1785
  }>, {
1620
1786
  name: string;
@@ -1654,9 +1820,22 @@ type __VLS_WithSlots$2<T, S> = T & {
1654
1820
  /** 建议项(空态 Prompts)——空接口再导出仅为语义命名,保留 */
1655
1821
  interface AiChatSuggestion extends AiMessagesSuggestion {
1656
1822
  }
1657
- /** 可选特性开关 */
1823
+ /** Artifacts 特性配置(features.artifacts 传对象时生效) */
1824
+ interface AiChatArtifactsOptions {
1825
+ /** 面板宽度(css 值,如 '520px' / '40%';默认 420px) */
1826
+ width?: string;
1827
+ /** 面板最小宽度(默认 360px) */
1828
+ minWidth?: string;
1829
+ /** 面板最大宽度(默认 60%,防窄屏挤占消息区) */
1830
+ maxWidth?: string;
1831
+ /** 检测到 artifact 自动打开面板(默认 true;关闭后仅经代码块「预览」按钮/ref.openArtifact 手动打开) */
1832
+ autoOpen?: boolean;
1833
+ /** 消息中 html/svg 代码块右上角显示「预览」按钮(默认 true;点击打开对应 artifact 面板) */
1834
+ codeBlockTrigger?: boolean;
1835
+ }
1836
+ /** 可选特性开关(artifacts 传 true 用默认配置,传对象自定义) */
1658
1837
  interface AiChatFeatures {
1659
- artifacts?: boolean;
1838
+ artifacts?: boolean | AiChatArtifactsOptions;
1660
1839
  tts?: boolean;
1661
1840
  queue?: boolean;
1662
1841
  continueGenerate?: boolean;
@@ -1730,6 +1909,8 @@ type __VLS_Props$2 = {
1730
1909
  attachmentLimit?: number;
1731
1910
  /** 主题:light/dark/auto(注入 html dark class) */
1732
1911
  theme?: 'light' | 'dark' | 'auto';
1912
+ /** 语言包:'zh-CN'/'en-US' 整包或部分文案对象;解析后向整框后代注入(后代仍可用自身 locale prop 覆盖) */
1913
+ locale?: LocaleInput;
1733
1914
  };
1734
1915
  /** 停止生成:生成在途时置位 stopped(空闲时无待收口轮次,不置位避免残留误吞下一轮),再中止在途请求 */
1735
1916
  declare function stop(): void;
@@ -1752,7 +1933,7 @@ declare var __VLS_27: {
1752
1933
  };
1753
1934
  declare var __VLS_30: {};
1754
1935
  declare var __VLS_33: {
1755
- status: "done" | "error" | "thinking";
1936
+ status: "thinking" | "error" | "done";
1756
1937
  message: MessageNode;
1757
1938
  };
1758
1939
  declare var __VLS_36: {
@@ -1798,10 +1979,10 @@ declare const __VLS_base$1: vue.DefineComponent<__VLS_Props$2, {
1798
1979
  exportTxt: typeof exportTxt;
1799
1980
  openArtifact: typeof openArtifact;
1800
1981
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
1982
+ send: (text: string, files?: ChatFile[] | undefined) => any;
1801
1983
  error: (err: Error, message?: MessageNode | undefined) => any;
1802
1984
  "branch-change": (dir: BranchDirection, message: MessageNode) => any;
1803
1985
  "update:messages": (value: MessageNode[]) => any;
1804
- send: (text: string, files?: ChatFile[] | undefined) => any;
1805
1986
  "message-complete": (message: MessageNode) => any;
1806
1987
  "attachment-exceed": (file: File) => any;
1807
1988
  "tool-event": (ev: {
@@ -1809,10 +1990,10 @@ declare const __VLS_base$1: vue.DefineComponent<__VLS_Props$2, {
1809
1990
  status: "start" | "done";
1810
1991
  }) => any;
1811
1992
  }, string, vue.PublicProps, Readonly<__VLS_Props$2> & Readonly<{
1993
+ onSend?: ((text: string, files?: ChatFile[] | undefined) => any) | undefined;
1812
1994
  onError?: ((err: Error, message?: MessageNode | undefined) => any) | undefined;
1813
1995
  "onBranch-change"?: ((dir: BranchDirection, message: MessageNode) => any) | undefined;
1814
1996
  "onUpdate:messages"?: ((value: MessageNode[]) => any) | undefined;
1815
- onSend?: ((text: string, files?: ChatFile[] | undefined) => any) | undefined;
1816
1997
  "onMessage-complete"?: ((message: MessageNode) => any) | undefined;
1817
1998
  "onAttachment-exceed"?: ((file: File) => any) | undefined;
1818
1999
  "onTool-event"?: ((ev: {
@@ -1905,13 +2086,18 @@ type __VLS_Props$1 = {
1905
2086
  };
1906
2087
  /** 思考链长文案展开/收起开关(透传 ThoughtChain collapsible;默认关闭,超长 title 原样全量展示) */
1907
2088
  collapsible?: boolean;
2089
+ /** 代码块「预览」触发语言(透传 Markdown/Typewriter;命中语言的代码块右上角注入按钮,
2090
+ * 点击行为由消费方事件委托实现,如 AiChat 打开 Artifacts 面板) */
2091
+ codeTriggerLangs?: string[];
2092
+ /** 语言包:'zh-CN'/'en-US' 整包或部分文案对象(优先于祖先注入与全局设置) */
2093
+ locale?: LocaleInput;
1908
2094
  };
1909
2095
  declare var __VLS_1: {
1910
2096
  message: MessageNode;
1911
2097
  };
1912
2098
  declare var __VLS_3: {};
1913
2099
  declare var __VLS_16: {
1914
- status: "done" | "error" | "thinking";
2100
+ status: "thinking" | "error" | "done";
1915
2101
  message: MessageNode;
1916
2102
  };
1917
2103
  declare var __VLS_18: {
@@ -1945,14 +2131,14 @@ type __VLS_Slots = {} & {
1945
2131
  declare const __VLS_base: vue.DefineComponent<__VLS_Props$1, {
1946
2132
  message: vue.ComputedRef<MessageNode>;
1947
2133
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
1948
- typing: () => any;
1949
2134
  copy: (message: MessageNode) => any;
1950
2135
  regenerate: (message: MessageNode) => any;
2136
+ typing: () => any;
1951
2137
  "branch-change": (dir: BranchDirection, message: MessageNode) => any;
1952
2138
  }, string, vue.PublicProps, Readonly<__VLS_Props$1> & Readonly<{
1953
- onTyping?: (() => any) | undefined;
1954
2139
  onCopy?: ((message: MessageNode) => any) | undefined;
1955
2140
  onRegenerate?: ((message: MessageNode) => any) | undefined;
2141
+ onTyping?: (() => any) | undefined;
1956
2142
  "onBranch-change"?: ((dir: BranchDirection, message: MessageNode) => any) | undefined;
1957
2143
  }>, {
1958
2144
  typing: boolean | {
@@ -1998,6 +2184,14 @@ type __VLS_Props = {
1998
2184
  artifacts: AiArtifactItem[];
1999
2185
  /** 当前展示的 artifact key;为空时面板隐藏 */
2000
2186
  activeKey?: string;
2187
+ /** 面板宽度(css width 值,如 '520px' / '40%';默认 420px,受 maxWidth 钳制) */
2188
+ width?: string;
2189
+ /** 面板最小宽度(css 值;默认 360px,窄容器下不小于该值) */
2190
+ minWidth?: string;
2191
+ /** 面板最大宽度(css 值;默认 60%,防窄屏挤占消息区) */
2192
+ maxWidth?: string;
2193
+ /** 语言包:'zh-CN'/'en-US' 整包或部分文案对象(优先于祖先注入与全局设置) */
2194
+ locale?: LocaleInput;
2001
2195
  };
2002
2196
  declare function open(key: string): void;
2003
2197
  declare function close(): void;
@@ -2005,16 +2199,19 @@ declare const __VLS_export: vue.DefineComponent<__VLS_Props, {
2005
2199
  open: typeof open;
2006
2200
  close: typeof close;
2007
2201
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
2008
- change: (key: string) => any;
2009
2202
  close: () => any;
2203
+ change: (key: string) => any;
2010
2204
  navigate: (href: string) => any;
2011
2205
  }, string, vue.PublicProps, Readonly<__VLS_Props> & Readonly<{
2012
- onChange?: ((key: string) => any) | undefined;
2013
2206
  onClose?: (() => any) | undefined;
2207
+ onChange?: ((key: string) => any) | undefined;
2014
2208
  onNavigate?: ((href: string) => any) | undefined;
2015
2209
  }>, {
2210
+ width: string;
2211
+ maxWidth: string;
2016
2212
  artifacts: AiArtifactItem[];
2017
2213
  activeKey: string;
2214
+ minWidth: string;
2018
2215
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
2019
2216
  declare const _default: typeof __VLS_export;
2020
2217
 
@@ -2131,13 +2328,16 @@ interface UseChatOptions {
2131
2328
  messages?: Record<string, MessageNode>;
2132
2329
  currentId?: string | null;
2133
2330
  };
2134
- /** 工具调用轨迹事件透传(det-oms 风格 tool{status}):展示「正在查询库存…」等中间态 */
2331
+ /** 工具调用轨迹事件透传(Fv 系通用 tool{status}):展示「正在查询库存…」等中间态 */
2135
2332
  onToolEvent?: (ev: {
2136
2333
  toolName: string;
2137
2334
  status: 'start' | 'done';
2138
2335
  }) => void;
2139
2336
  /** 工具名 → 步骤展示名(流式 toolSteps 的 title;缺省原样使用 toolName) */
2140
2337
  toolStepLabel?: (toolName: string) => string;
2338
+ /** 语言包工厂(惰性取用,与 toolStepLabel 同语义;附件 system prompt/工具用时/续写 prompt
2339
+ * 在产生时取值——语言切换只影响之后的请求,已落库数据不回溯);缺省读全局 */
2340
+ locale?: () => LocaleMessages;
2141
2341
  }
2142
2342
  /** 待发送队列项 */
2143
2343
  interface QueueItem {
@@ -2186,5 +2386,5 @@ declare function createMessageTree(initial?: {
2186
2386
 
2187
2387
  declare const version = "0.1.0";
2188
2388
 
2189
- export { DetOmsChatAdapter, DetOmsError, _default as FvAiArtifacts, _default$2 as FvAiChat, _default$1 as FvAiMessage, _default$3 as FvAiMessages, _default$5 as FvAttachments, _default$f as FvBubble, _default$e as FvBubbleList, _default$4 as FvConversations, _default$b as FvEditorSender, _default$6 as FvFilesCard, _default$h as FvMarkdown, _default$c as FvMentionSender, _default$7 as FvPrompts, _default$d as FvSender, _default$a as FvThinking, _default$9 as FvThoughtChain, _default$g as FvTypewriter, _default$8 as FvWelcome, OpenAIAdapter, XRequest, createLocalStorageAdapter, createMemoryAdapter, createMessageTree, createSSEParser, useChat, useMessages, useRecord, useSend, useXStream, version };
2190
- export type { AdapterChatMessage, AiArtifactItem, AiChatFeatures, AiChatSuggestion, AiMessageBranchInfo, AiMessagesSuggestion, BranchDirection, ChatAdapter, ChatAdapterHandlers, ChatAdapterRequest, ChatFile, DetOmsChatAdapterConfig, DetOmsMessage, DetOmsMessagePage, DetOmsSendBody, DetOmsSessionDetail, DetOmsSessionItem, DetOmsToolEvent, MessageNode, MessageNodeInput, MessageRole, MessageStatus, MessageTree, MessageUsage, OpenAIAdapterConfig, QueueItem, RawUsage, SSEEvent, SSEParser, SendOptions, StorageAdapter, ToolCallItem, ToolStepItem, UseChatOptions, UseChatReturn, UseMessagesReturn, UseRecordReturn, UseSendReturn, UseXStreamReturn };
2389
+ export { _default as FvAiArtifacts, _default$2 as FvAiChat, _default$1 as FvAiMessage, _default$3 as FvAiMessages, _default$5 as FvAttachments, _default$f as FvBubble, _default$e as FvBubbleList, FvCommonAdapter, FvCommonError, _default$4 as FvConversations, _default$b as FvEditorSender, _default$6 as FvFilesCard, _default$h as FvMarkdown, _default$c as FvMentionSender, _default$7 as FvPrompts, _default$d as FvSender, _default$a as FvThinking, _default$9 as FvThoughtChain, _default$g as FvTypewriter, _default$8 as FvWelcome, OpenAIAdapter, XRequest, configureLocale, createLocalStorageAdapter, createMemoryAdapter, createMessageTree, createSSEParser, enUS, useChat, useMessages, useRecord, useSend, useXStream, version, zhCN };
2390
+ export type { AdapterChatMessage, AiArtifactItem, AiChatArtifactsOptions, AiChatFeatures, AiChatSuggestion, AiMessageBranchInfo, AiMessagesSuggestion, BranchDirection, ChatAdapter, ChatAdapterHandlers, ChatAdapterRequest, ChatFile, DeepPartialLocale, FvCommonAdapterConfig, FvCommonMessage, FvCommonMessagePage, FvCommonSendBody, FvCommonSessionDetail, FvCommonSessionItem, FvCommonToolEvent, LocaleInput, LocaleMessages, MessageNode, MessageNodeInput, MessageRole, MessageStatus, MessageTree, MessageUsage, OpenAIAdapterConfig, QueueItem, RawUsage, SSEEvent, SSEParser, SendOptions, StorageAdapter, ToolCallItem, ToolStepItem, UseChatOptions, UseChatReturn, UseMessagesReturn, UseRecordReturn, UseSendReturn, UseXStreamReturn };