@fv-ui/ai-chat 1.1.1 → 1.1.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/lib/index.js CHANGED
@@ -7205,6 +7205,17 @@
7205
7205
  function collapseThoughtChain() {
7206
7206
  setThoughtChainExpanded(false);
7207
7207
  }
7208
+ const contentTypewriterRef = vue.ref(null);
7209
+ function maybeCollapseOnDone() {
7210
+ if (!props.autoCollapse) return;
7211
+ if (props.message.status !== "done") return;
7212
+ const tw = contentTypewriterRef.value;
7213
+ if (tw ? tw.isTyping : props.typing && wasStreaming.value && props.message.content) return;
7214
+ collapseThoughtChain();
7215
+ }
7216
+ vue.watch(() => props.message.status, (s) => {
7217
+ if (s === "done") maybeCollapseOnDone();
7218
+ });
7208
7219
  const showChainHeader = vue.computed(() => !hasToolSteps.value || toolChainItems.value.length > 1);
7209
7220
  const toolStepCount = vue.computed(
7210
7221
  () => (props.message.toolSteps ?? []).filter((s) => s.kind !== "text").length
@@ -7504,11 +7515,14 @@
7504
7515
  /* TEXT */
7505
7516
  )) : useTypewriter.value && __props.message.content ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
7506
7517
  key: 1,
7518
+ ref_key: "contentTypewriterRef",
7519
+ ref: contentTypewriterRef,
7507
7520
  content: __props.message.content,
7508
7521
  "is-markdown": "",
7509
7522
  typing: __props.typing,
7510
7523
  "code-trigger-langs": __props.codeTriggerLangs,
7511
- onWriting: _cache[3] || (_cache[3] = ($event) => emit("typing"))
7524
+ onWriting: _cache[3] || (_cache[3] = ($event) => emit("typing")),
7525
+ onFinish: maybeCollapseOnDone
7512
7526
  }, null, 8, ["content", "typing", "code-trigger-langs"])) : __props.message.content ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
7513
7527
  key: 2,
7514
7528
  content: __props.message.content,
@@ -7738,6 +7752,7 @@
7738
7752
  userName: { type: String, required: false, default: "" },
7739
7753
  assistantName: { type: String, required: false, default: "" },
7740
7754
  typing: { type: [Boolean, Object], required: false, default: false },
7755
+ autoCollapse: { type: Boolean, required: false, default: true },
7741
7756
  collapsible: { type: Boolean, required: false, default: false },
7742
7757
  showDuration: { type: Boolean, required: false, default: false },
7743
7758
  codeTriggerLangs: { type: Array, required: false },
@@ -7984,6 +7999,7 @@
7984
7999
  "user-name": __props.userName,
7985
8000
  "assistant-name": __props.assistantName,
7986
8001
  typing: __props.typing,
8002
+ "auto-collapse": __props.autoCollapse,
7987
8003
  collapsible: __props.collapsible,
7988
8004
  "show-duration": __props.showDuration,
7989
8005
  "show-time": __props.showTime,
@@ -8039,7 +8055,7 @@
8039
8055
  ]),
8040
8056
  key: "5"
8041
8057
  } : void 0
8042
- ]), 1032, ["message", "branch", "show-actions", "show-branch-switch", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "assistant-avatar-scale", "avatar-circle", "user-name", "assistant-name", "typing", "collapsible", "show-duration", "show-time", "time-format", "code-trigger-langs"]);
8058
+ ]), 1032, ["message", "branch", "show-actions", "show-branch-switch", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "assistant-avatar-scale", "avatar-circle", "user-name", "assistant-name", "typing", "auto-collapse", "collapsible", "show-duration", "show-time", "time-format", "code-trigger-langs"]);
8043
8059
  }),
8044
8060
  128
8045
8061
  /* KEYED_FRAGMENT */
@@ -8397,6 +8413,7 @@
8397
8413
  senderAutosize: { type: Object, required: false, default: void 0 },
8398
8414
  toolStepLabel: { type: Function, required: false, default: void 0 },
8399
8415
  typing: { type: [Boolean, Object], required: false, default: false },
8416
+ autoCollapse: { type: Boolean, required: false, default: true },
8400
8417
  collapsible: { type: Boolean, required: false, default: false },
8401
8418
  showDuration: { type: Boolean, required: false, default: false },
8402
8419
  showTime: { type: Boolean, required: false, default: true },
@@ -8745,6 +8762,7 @@
8745
8762
  "user-name": __props.userName,
8746
8763
  "assistant-name": __props.assistantName,
8747
8764
  typing: __props.typing,
8765
+ "auto-collapse": __props.autoCollapse,
8748
8766
  collapsible: __props.collapsible,
8749
8767
  "show-duration": __props.showDuration,
8750
8768
  "show-time": __props.showTime,
@@ -8850,7 +8868,7 @@
8850
8868
  ]),
8851
8869
  key: "12"
8852
8870
  } : void 0
8853
- ]), 1032, ["messages", "nodes", "name", "suggestions", "suggestions-wrap", "show-scroll-button", "scroll-button-threshold", "scroll-threshold", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "assistant-avatar-scale", "avatar-circle", "user-name", "assistant-name", "typing", "collapsible", "show-duration", "show-time", "time-format", "code-trigger-langs"]),
8871
+ ]), 1032, ["messages", "nodes", "name", "suggestions", "suggestions-wrap", "show-scroll-button", "scroll-button-threshold", "scroll-threshold", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "assistant-avatar-scale", "avatar-circle", "user-name", "assistant-name", "typing", "auto-collapse", "collapsible", "show-duration", "show-time", "time-format", "code-trigger-langs"]),
8854
8872
  artifactsOn.value && artifacts.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$1, {
8855
8873
  key: 0,
8856
8874
  artifacts: artifacts.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fv-ui/ai-chat",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "基于 Vue3 + Element Plus 的 AI 对话组件库",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",