@fv-ui/ai-chat 1.1.0 → 1.1.1

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/es/index.mjs CHANGED
@@ -7861,15 +7861,13 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
7861
7861
  }
7862
7862
  onScroll();
7863
7863
  }
7864
- const messageRefs = ref([]);
7865
- function setMessageRef(el) {
7866
- if (el) {
7867
- const i = messageRefs.value.indexOf(el);
7868
- if (i < 0) messageRefs.value.push(el);
7869
- }
7864
+ const messageRefs = /* @__PURE__ */ new Map();
7865
+ function setMessageRef(id, el) {
7866
+ if (el) messageRefs.set(id, el);
7867
+ else messageRefs.delete(id);
7870
7868
  }
7871
7869
  function forEachChain(fn) {
7872
- for (const inst of [...messageRefs.value]) fn(inst);
7870
+ for (const inst of messageRefs.values()) fn(inst);
7873
7871
  }
7874
7872
  function expandThoughtChains() {
7875
7873
  forEachChain((m) => m?.expandThoughtChain?.());
@@ -7878,7 +7876,7 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
7878
7876
  forEachChain((m) => m?.collapseThoughtChain?.());
7879
7877
  }
7880
7878
  onBeforeUnmount(() => {
7881
- messageRefs.value = [];
7879
+ messageRefs.clear();
7882
7880
  });
7883
7881
  __expose({ scrollTo, scrollToBottom, scrollToTop, expandThoughtChains, collapseThoughtChains });
7884
7882
  return (_ctx, _cache) => {
@@ -7954,7 +7952,7 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
7954
7952
  return openBlock(), createBlock(_sfc_main$3, {
7955
7953
  key: m.id,
7956
7954
  ref_for: true,
7957
- ref: setMessageRef,
7955
+ ref: (el) => setMessageRef(m.id, el),
7958
7956
  message: m,
7959
7957
  branch: branchInfo(m),
7960
7958
  "show-actions": __props.showActions,
package/lib/index.js CHANGED
@@ -7877,15 +7877,13 @@
7877
7877
  }
7878
7878
  onScroll();
7879
7879
  }
7880
- const messageRefs = vue.ref([]);
7881
- function setMessageRef(el) {
7882
- if (el) {
7883
- const i = messageRefs.value.indexOf(el);
7884
- if (i < 0) messageRefs.value.push(el);
7885
- }
7880
+ const messageRefs = /* @__PURE__ */ new Map();
7881
+ function setMessageRef(id, el) {
7882
+ if (el) messageRefs.set(id, el);
7883
+ else messageRefs.delete(id);
7886
7884
  }
7887
7885
  function forEachChain(fn) {
7888
- for (const inst of [...messageRefs.value]) fn(inst);
7886
+ for (const inst of messageRefs.values()) fn(inst);
7889
7887
  }
7890
7888
  function expandThoughtChains() {
7891
7889
  forEachChain((m) => m?.expandThoughtChain?.());
@@ -7894,7 +7892,7 @@
7894
7892
  forEachChain((m) => m?.collapseThoughtChain?.());
7895
7893
  }
7896
7894
  vue.onBeforeUnmount(() => {
7897
- messageRefs.value = [];
7895
+ messageRefs.clear();
7898
7896
  });
7899
7897
  __expose({ scrollTo, scrollToBottom, scrollToTop, expandThoughtChains, collapseThoughtChains });
7900
7898
  return (_ctx, _cache) => {
@@ -7970,7 +7968,7 @@
7970
7968
  return vue.openBlock(), vue.createBlock(_sfc_main$3, {
7971
7969
  key: m.id,
7972
7970
  ref_for: true,
7973
- ref: setMessageRef,
7971
+ ref: (el) => setMessageRef(m.id, el),
7974
7972
  message: m,
7975
7973
  branch: branchInfo(m),
7976
7974
  "show-actions": __props.showActions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fv-ui/ai-chat",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "基于 Vue3 + Element Plus 的 AI 对话组件库",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",