@fv-ui/ai-chat 1.1.0 → 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/README.md +3 -1
- package/dist/index.d.ts +15 -7
- package/es/assets/fvai-idle-BhBsbPV4.gif +0 -0
- package/es/assets/fvai-thinking-C5DWvBNz.gif +0 -0
- package/es/assets/fvai-welcome-DKegGRB0.gif +0 -0
- package/es/index.mjs +31 -15
- package/lib/index.js +28 -12
- package/package.json +1 -1
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 },
|
|
@@ -7877,15 +7892,13 @@
|
|
|
7877
7892
|
}
|
|
7878
7893
|
onScroll();
|
|
7879
7894
|
}
|
|
7880
|
-
const messageRefs =
|
|
7881
|
-
function setMessageRef(el) {
|
|
7882
|
-
if (el)
|
|
7883
|
-
|
|
7884
|
-
if (i < 0) messageRefs.value.push(el);
|
|
7885
|
-
}
|
|
7895
|
+
const messageRefs = /* @__PURE__ */ new Map();
|
|
7896
|
+
function setMessageRef(id, el) {
|
|
7897
|
+
if (el) messageRefs.set(id, el);
|
|
7898
|
+
else messageRefs.delete(id);
|
|
7886
7899
|
}
|
|
7887
7900
|
function forEachChain(fn) {
|
|
7888
|
-
for (const inst of
|
|
7901
|
+
for (const inst of messageRefs.values()) fn(inst);
|
|
7889
7902
|
}
|
|
7890
7903
|
function expandThoughtChains() {
|
|
7891
7904
|
forEachChain((m) => m?.expandThoughtChain?.());
|
|
@@ -7894,7 +7907,7 @@
|
|
|
7894
7907
|
forEachChain((m) => m?.collapseThoughtChain?.());
|
|
7895
7908
|
}
|
|
7896
7909
|
vue.onBeforeUnmount(() => {
|
|
7897
|
-
messageRefs.
|
|
7910
|
+
messageRefs.clear();
|
|
7898
7911
|
});
|
|
7899
7912
|
__expose({ scrollTo, scrollToBottom, scrollToTop, expandThoughtChains, collapseThoughtChains });
|
|
7900
7913
|
return (_ctx, _cache) => {
|
|
@@ -7970,7 +7983,7 @@
|
|
|
7970
7983
|
return vue.openBlock(), vue.createBlock(_sfc_main$3, {
|
|
7971
7984
|
key: m.id,
|
|
7972
7985
|
ref_for: true,
|
|
7973
|
-
ref: setMessageRef,
|
|
7986
|
+
ref: (el) => setMessageRef(m.id, el),
|
|
7974
7987
|
message: m,
|
|
7975
7988
|
branch: branchInfo(m),
|
|
7976
7989
|
"show-actions": __props.showActions,
|
|
@@ -7986,6 +7999,7 @@
|
|
|
7986
7999
|
"user-name": __props.userName,
|
|
7987
8000
|
"assistant-name": __props.assistantName,
|
|
7988
8001
|
typing: __props.typing,
|
|
8002
|
+
"auto-collapse": __props.autoCollapse,
|
|
7989
8003
|
collapsible: __props.collapsible,
|
|
7990
8004
|
"show-duration": __props.showDuration,
|
|
7991
8005
|
"show-time": __props.showTime,
|
|
@@ -8041,7 +8055,7 @@
|
|
|
8041
8055
|
]),
|
|
8042
8056
|
key: "5"
|
|
8043
8057
|
} : void 0
|
|
8044
|
-
]), 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"]);
|
|
8045
8059
|
}),
|
|
8046
8060
|
128
|
|
8047
8061
|
/* KEYED_FRAGMENT */
|
|
@@ -8399,6 +8413,7 @@
|
|
|
8399
8413
|
senderAutosize: { type: Object, required: false, default: void 0 },
|
|
8400
8414
|
toolStepLabel: { type: Function, required: false, default: void 0 },
|
|
8401
8415
|
typing: { type: [Boolean, Object], required: false, default: false },
|
|
8416
|
+
autoCollapse: { type: Boolean, required: false, default: true },
|
|
8402
8417
|
collapsible: { type: Boolean, required: false, default: false },
|
|
8403
8418
|
showDuration: { type: Boolean, required: false, default: false },
|
|
8404
8419
|
showTime: { type: Boolean, required: false, default: true },
|
|
@@ -8747,6 +8762,7 @@
|
|
|
8747
8762
|
"user-name": __props.userName,
|
|
8748
8763
|
"assistant-name": __props.assistantName,
|
|
8749
8764
|
typing: __props.typing,
|
|
8765
|
+
"auto-collapse": __props.autoCollapse,
|
|
8750
8766
|
collapsible: __props.collapsible,
|
|
8751
8767
|
"show-duration": __props.showDuration,
|
|
8752
8768
|
"show-time": __props.showTime,
|
|
@@ -8852,7 +8868,7 @@
|
|
|
8852
8868
|
]),
|
|
8853
8869
|
key: "12"
|
|
8854
8870
|
} : void 0
|
|
8855
|
-
]), 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"]),
|
|
8856
8872
|
artifactsOn.value && artifacts.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$1, {
|
|
8857
8873
|
key: 0,
|
|
8858
8874
|
artifacts: artifacts.value,
|