@fv-ui/ai-chat 0.9.1 → 0.9.2

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
@@ -134,7 +134,7 @@ declare var __VLS_1$9: {};
134
134
  declare var __VLS_10$1: {};
135
135
  declare var __VLS_12$1: {};
136
136
  declare var __VLS_14: {};
137
- declare var __VLS_32$1: {};
137
+ declare var __VLS_32: {};
138
138
  type __VLS_Slots$e = {} & {
139
139
  avatar?: (props: typeof __VLS_1$9) => any;
140
140
  } & {
@@ -144,7 +144,7 @@ type __VLS_Slots$e = {} & {
144
144
  } & {
145
145
  content?: (props: typeof __VLS_14) => any;
146
146
  } & {
147
- footer?: (props: typeof __VLS_32$1) => any;
147
+ footer?: (props: typeof __VLS_32) => any;
148
148
  };
149
149
  declare const __VLS_base$e: vue.DefineComponent<__VLS_Props$f, {
150
150
  interrupt: typeof interrupt;
@@ -822,16 +822,16 @@ type __VLS_Props$a = {
822
822
  /** 切换门控:start 起始态不可切换;thinking 中可展开查看思考流,end/error 后可自由收起展开 */
823
823
  declare function toggle(): void;
824
824
  declare var __VLS_1$6: {};
825
- declare var __VLS_36$1: {};
826
- declare var __VLS_38$1: {};
825
+ declare var __VLS_36$2: {};
826
+ declare var __VLS_38: {};
827
827
  declare var __VLS_51: {};
828
828
  declare var __VLS_53: {};
829
829
  type __VLS_Slots$9 = {} & {
830
830
  'status-icon'?: (props: typeof __VLS_1$6) => any;
831
831
  } & {
832
- label?: (props: typeof __VLS_36$1) => any;
832
+ label?: (props: typeof __VLS_36$2) => any;
833
833
  } & {
834
- arrow?: (props: typeof __VLS_38$1) => any;
834
+ arrow?: (props: typeof __VLS_38) => any;
835
835
  } & {
836
836
  error?: (props: typeof __VLS_51) => any;
837
837
  } & {
@@ -908,13 +908,13 @@ type __VLS_Props$8 = {
908
908
  };
909
909
  declare var __VLS_1$5: {};
910
910
  declare var __VLS_24$1: {};
911
- declare var __VLS_26$1: {};
911
+ declare var __VLS_26: {};
912
912
  type __VLS_Slots$7 = {} & {
913
913
  icon?: (props: typeof __VLS_1$5) => any;
914
914
  } & {
915
915
  name?: (props: typeof __VLS_24$1) => any;
916
916
  } & {
917
- description?: (props: typeof __VLS_26$1) => any;
917
+ description?: (props: typeof __VLS_26) => any;
918
918
  };
919
919
  declare const __VLS_base$7: vue.DefineComponent<__VLS_Props$8, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<__VLS_Props$8> & Readonly<{}>, {
920
920
  name: string;
@@ -1522,43 +1522,43 @@ declare function scrollToBottom(smooth?: boolean): void;
1522
1522
  /** 回到顶部:与 scrollToBottom 同款 try/catch 回落(happy-dom 旧版 scrollTo(options) 可能缺实现) */
1523
1523
  declare function scrollToTop(): void;
1524
1524
  declare var __VLS_1$1: {};
1525
- declare var __VLS_26: {
1525
+ declare var __VLS_27$1: {
1526
1526
  message: MessageNode;
1527
1527
  };
1528
- declare var __VLS_29$1: {
1528
+ declare var __VLS_30$1: {
1529
1529
  message: MessageNode;
1530
1530
  };
1531
- declare var __VLS_32: {};
1532
- declare var __VLS_35: {};
1533
- declare var __VLS_38: {
1531
+ declare var __VLS_33$2: {};
1532
+ declare var __VLS_36$1: {};
1533
+ declare var __VLS_39$1: {
1534
1534
  message: MessageNode;
1535
1535
  };
1536
- declare var __VLS_41: {
1536
+ declare var __VLS_42$1: {
1537
1537
  message: MessageNode;
1538
1538
  };
1539
- declare var __VLS_49: {
1539
+ declare var __VLS_50: {
1540
1540
  scrollToBottom: typeof scrollToBottom;
1541
1541
  awayFromBottom: boolean;
1542
1542
  };
1543
- declare var __VLS_65: {};
1543
+ declare var __VLS_66: {};
1544
1544
  type __VLS_Slots$2 = {} & {
1545
1545
  empty?: (props: typeof __VLS_1$1) => any;
1546
1546
  } & {
1547
- 'message-avatar'?: (props: typeof __VLS_26) => any;
1547
+ 'message-avatar'?: (props: typeof __VLS_27$1) => any;
1548
1548
  } & {
1549
- 'message-actions'?: (props: typeof __VLS_29$1) => any;
1549
+ 'message-actions'?: (props: typeof __VLS_30$1) => any;
1550
1550
  } & {
1551
- 'user-avatar'?: (props: typeof __VLS_32) => any;
1551
+ 'user-avatar'?: (props: typeof __VLS_33$2) => any;
1552
1552
  } & {
1553
- 'assistant-avatar'?: (props: typeof __VLS_35) => any;
1553
+ 'assistant-avatar'?: (props: typeof __VLS_36$1) => any;
1554
1554
  } & {
1555
- 'user-name'?: (props: typeof __VLS_38) => any;
1555
+ 'user-name'?: (props: typeof __VLS_39$1) => any;
1556
1556
  } & {
1557
- 'assistant-name'?: (props: typeof __VLS_41) => any;
1557
+ 'assistant-name'?: (props: typeof __VLS_42$1) => any;
1558
1558
  } & {
1559
- 'scroll-button'?: (props: typeof __VLS_49) => any;
1559
+ 'scroll-button'?: (props: typeof __VLS_50) => any;
1560
1560
  } & {
1561
- 'scroll-button-icon'?: (props: typeof __VLS_65) => any;
1561
+ 'scroll-button-icon'?: (props: typeof __VLS_66) => any;
1562
1562
  };
1563
1563
  declare const __VLS_base$2: vue.DefineComponent<__VLS_Props$3, {
1564
1564
  scrollToBottom: typeof scrollToBottom;
@@ -1865,7 +1865,7 @@ declare var __VLS_33: {
1865
1865
  message: MessageNode;
1866
1866
  files: ChatFile[];
1867
1867
  };
1868
- declare var __VLS_67: {
1868
+ declare var __VLS_71: {
1869
1869
  message: MessageNode;
1870
1870
  };
1871
1871
  type __VLS_Slots = {} & {
@@ -1881,15 +1881,17 @@ type __VLS_Slots = {} & {
1881
1881
  } & {
1882
1882
  'message-files'?: (props: typeof __VLS_33) => any;
1883
1883
  } & {
1884
- 'message-actions'?: (props: typeof __VLS_67) => any;
1884
+ 'message-actions'?: (props: typeof __VLS_71) => any;
1885
1885
  };
1886
1886
  declare const __VLS_base: vue.DefineComponent<__VLS_Props$1, {
1887
1887
  message: vue.ComputedRef<MessageNode>;
1888
1888
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
1889
+ typing: () => any;
1889
1890
  copy: (message: MessageNode) => any;
1890
1891
  regenerate: (message: MessageNode) => any;
1891
1892
  "branch-change": (dir: BranchDirection, message: MessageNode) => any;
1892
1893
  }, string, vue.PublicProps, Readonly<__VLS_Props$1> & Readonly<{
1894
+ onTyping?: (() => any) | undefined;
1893
1895
  onCopy?: ((message: MessageNode) => any) | undefined;
1894
1896
  onRegenerate?: ((message: MessageNode) => any) | undefined;
1895
1897
  "onBranch-change"?: ((dir: BranchDirection, message: MessageNode) => any) | undefined;
package/es/index.mjs CHANGED
@@ -6086,7 +6086,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6086
6086
  autoCollapse: { type: Boolean, required: false, default: true },
6087
6087
  typing: { type: [Boolean, Object], required: false, default: false }
6088
6088
  },
6089
- emits: ["copy", "regenerate", "branch-change"],
6089
+ emits: ["copy", "regenerate", "branch-change", "typing"],
6090
6090
  setup(__props, { expose: __expose, emit: __emit }) {
6091
6091
  const props = __props;
6092
6092
  const emit = __emit;
@@ -6255,7 +6255,8 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6255
6255
  key: 0,
6256
6256
  content: __props.message.reasoning ?? "",
6257
6257
  "is-markdown": "",
6258
- typing: __props.typing
6258
+ typing: __props.typing,
6259
+ onWriting: _cache[0] || (_cache[0] = ($event) => emit("typing"))
6259
6260
  }, null, 8, ["content", "typing"])) : (openBlock(), createBlock(_sfc_main$i, {
6260
6261
  key: 1,
6261
6262
  content: __props.message.reasoning ?? ""
@@ -6276,7 +6277,8 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6276
6277
  key: 1,
6277
6278
  content: __props.message.content,
6278
6279
  "is-markdown": "",
6279
- typing: __props.typing
6280
+ typing: __props.typing,
6281
+ onWriting: _cache[1] || (_cache[1] = ($event) => emit("typing"))
6280
6282
  }, null, 8, ["content", "typing"])) : __props.message.content ? (openBlock(), createBlock(_sfc_main$i, {
6281
6283
  key: 2,
6282
6284
  content: __props.message.content
@@ -6407,7 +6409,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6407
6409
  class: "fv-msg-action",
6408
6410
  disabled: __props.branch.index <= 1,
6409
6411
  "aria-label": "\u4E0A\u4E00\u5206\u652F",
6410
- onClick: _cache[0] || (_cache[0] = ($event) => onBranch("prev"))
6412
+ onClick: _cache[2] || (_cache[2] = ($event) => onBranch("prev"))
6411
6413
  }, {
6412
6414
  default: withCtx(() => [
6413
6415
  createVNode(unref(ElIcon), null, {
@@ -6434,7 +6436,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6434
6436
  class: "fv-msg-action",
6435
6437
  disabled: __props.branch.index >= __props.branch.count,
6436
6438
  "aria-label": "\u4E0B\u4E00\u5206\u652F",
6437
- onClick: _cache[1] || (_cache[1] = ($event) => onBranch("next"))
6439
+ onClick: _cache[3] || (_cache[3] = ($event) => onBranch("next"))
6438
6440
  }, {
6439
6441
  default: withCtx(() => [
6440
6442
  createVNode(unref(ElIcon), null, {
@@ -6492,6 +6494,9 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
6492
6494
  setup(__props, { expose: __expose, emit: __emit }) {
6493
6495
  const props = __props;
6494
6496
  const emit = __emit;
6497
+ function onChildTyping() {
6498
+ followIfPinned();
6499
+ }
6495
6500
  const isEmpty = computed(() => props.messages.length === 0);
6496
6501
  const scrollRef = ref(null);
6497
6502
  function distanceFromBottom() {
@@ -6640,6 +6645,7 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
6640
6645
  "user-name": __props.userName,
6641
6646
  "assistant-name": __props.assistantName,
6642
6647
  typing: __props.typing,
6648
+ onTyping: onChildTyping,
6643
6649
  onCopy,
6644
6650
  onRegenerate,
6645
6651
  onBranchChange: onBranch
package/lib/index.js CHANGED
@@ -6102,7 +6102,7 @@ ${fileParts.join("\n")}` });
6102
6102
  autoCollapse: { type: Boolean, required: false, default: true },
6103
6103
  typing: { type: [Boolean, Object], required: false, default: false }
6104
6104
  },
6105
- emits: ["copy", "regenerate", "branch-change"],
6105
+ emits: ["copy", "regenerate", "branch-change", "typing"],
6106
6106
  setup(__props, { expose: __expose, emit: __emit }) {
6107
6107
  const props = __props;
6108
6108
  const emit = __emit;
@@ -6271,7 +6271,8 @@ ${fileParts.join("\n")}` });
6271
6271
  key: 0,
6272
6272
  content: __props.message.reasoning ?? "",
6273
6273
  "is-markdown": "",
6274
- typing: __props.typing
6274
+ typing: __props.typing,
6275
+ onWriting: _cache[0] || (_cache[0] = ($event) => emit("typing"))
6275
6276
  }, null, 8, ["content", "typing"])) : (vue.openBlock(), vue.createBlock(_sfc_main$i, {
6276
6277
  key: 1,
6277
6278
  content: __props.message.reasoning ?? ""
@@ -6292,7 +6293,8 @@ ${fileParts.join("\n")}` });
6292
6293
  key: 1,
6293
6294
  content: __props.message.content,
6294
6295
  "is-markdown": "",
6295
- typing: __props.typing
6296
+ typing: __props.typing,
6297
+ onWriting: _cache[1] || (_cache[1] = ($event) => emit("typing"))
6296
6298
  }, null, 8, ["content", "typing"])) : __props.message.content ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
6297
6299
  key: 2,
6298
6300
  content: __props.message.content
@@ -6423,7 +6425,7 @@ ${fileParts.join("\n")}` });
6423
6425
  class: "fv-msg-action",
6424
6426
  disabled: __props.branch.index <= 1,
6425
6427
  "aria-label": "\u4E0A\u4E00\u5206\u652F",
6426
- onClick: _cache[0] || (_cache[0] = ($event) => onBranch("prev"))
6428
+ onClick: _cache[2] || (_cache[2] = ($event) => onBranch("prev"))
6427
6429
  }, {
6428
6430
  default: vue.withCtx(() => [
6429
6431
  vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
@@ -6450,7 +6452,7 @@ ${fileParts.join("\n")}` });
6450
6452
  class: "fv-msg-action",
6451
6453
  disabled: __props.branch.index >= __props.branch.count,
6452
6454
  "aria-label": "\u4E0B\u4E00\u5206\u652F",
6453
- onClick: _cache[1] || (_cache[1] = ($event) => onBranch("next"))
6455
+ onClick: _cache[3] || (_cache[3] = ($event) => onBranch("next"))
6454
6456
  }, {
6455
6457
  default: vue.withCtx(() => [
6456
6458
  vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
@@ -6508,6 +6510,9 @@ ${fileParts.join("\n")}` });
6508
6510
  setup(__props, { expose: __expose, emit: __emit }) {
6509
6511
  const props = __props;
6510
6512
  const emit = __emit;
6513
+ function onChildTyping() {
6514
+ followIfPinned();
6515
+ }
6511
6516
  const isEmpty = vue.computed(() => props.messages.length === 0);
6512
6517
  const scrollRef = vue.ref(null);
6513
6518
  function distanceFromBottom() {
@@ -6656,6 +6661,7 @@ ${fileParts.join("\n")}` });
6656
6661
  "user-name": __props.userName,
6657
6662
  "assistant-name": __props.assistantName,
6658
6663
  typing: __props.typing,
6664
+ onTyping: onChildTyping,
6659
6665
  onCopy,
6660
6666
  onRegenerate,
6661
6667
  onBranchChange: onBranch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fv-ui/ai-chat",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "基于 Vue3 + Element Plus 的 AI 对话组件库",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",