@opentiny/tiny-robot 0.4.2-alpha.6 → 0.4.2-alpha.8
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/action-group/index.js +4 -4
- package/dist/anchor/index.js +44 -44
- package/dist/bubble/index.js +10 -9
- package/dist/drag-overlay/index.js +1 -1
- package/dist/dropdown-menu/index.js +1 -1
- package/dist/index.d.ts +5239 -49
- package/dist/index.js +129 -118
- package/dist/index2.js +2 -2
- package/dist/index4.js +384 -321
- package/dist/index5.js +247 -240
- package/dist/index6.js +597 -547
- package/dist/index7.js +28 -28
- package/dist/index8.js +8 -8
- package/dist/layout/index.js +1243 -0
- package/dist/sender/index.js +2 -2
- package/dist/sender-actions/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +1 -1
- package/dist/suggestion-popover/index.js +1 -1
- package/dist/theme-provider/index.js +41 -32
- package/dist/useSlotRefs.js +1 -1
- package/dist/utils.js +1 -1
- package/package.json +3 -22
- package/dist/action-group/ActionGroup.vue.d.ts +0 -26
- package/dist/action-group/ActionGroupItem.vue.d.ts +0 -18
- package/dist/action-group/index.d.ts +0 -12
- package/dist/action-group/index.type.d.ts +0 -17
- package/dist/anchor/components/AnchorItem.vue.d.ts +0 -24
- package/dist/anchor/components/AnchorList.vue.d.ts +0 -20
- package/dist/anchor/components/AnchorOverlay.vue.d.ts +0 -33
- package/dist/anchor/components/AnchorSearch.vue.d.ts +0 -7
- package/dist/anchor/composables/index.d.ts +0 -5
- package/dist/anchor/composables/useActiveSync.d.ts +0 -10
- package/dist/anchor/composables/useFloatingOffset.d.ts +0 -6
- package/dist/anchor/composables/useNavController.d.ts +0 -12
- package/dist/anchor/composables/useOverlayInteractions.d.ts +0 -6
- package/dist/anchor/composables/useTargetFeedback.d.ts +0 -5
- package/dist/anchor/defaults.d.ts +0 -16
- package/dist/anchor/index.d.ts +0 -7
- package/dist/anchor/index.type.d.ts +0 -60
- package/dist/anchor/index.vue.d.ts +0 -159
- package/dist/anchor/internal.type.d.ts +0 -103
- package/dist/anchor/utils/scroll.d.ts +0 -7
- package/dist/anchor/utils/target.d.ts +0 -6
- package/dist/attachments/components/FileCard.vue.d.ts +0 -18
- package/dist/attachments/components/ImagePreview.vue.d.ts +0 -17
- package/dist/attachments/components/index.d.ts +0 -2
- package/dist/attachments/composables/index.d.ts +0 -5
- package/dist/attachments/composables/useFileCard.d.ts +0 -15
- package/dist/attachments/composables/useFileType.d.ts +0 -20
- package/dist/attachments/composables/useImagePreview.d.ts +0 -18
- package/dist/attachments/composables/useListType.d.ts +0 -11
- package/dist/attachments/index.d.ts +0 -7
- package/dist/attachments/index.type.d.ts +0 -70
- package/dist/attachments/index.vue.d.ts +0 -27
- package/dist/attachments/utils.d.ts +0 -3
- package/dist/base-popper/components/Popper.vue.d.ts +0 -28
- package/dist/base-popper/index.d.ts +0 -2
- package/dist/base-popper/index.vue.d.ts +0 -41
- package/dist/bubble/Bubble.vue.d.ts +0 -39
- package/dist/bubble/BubbleBoxWrapper.vue.d.ts +0 -22
- package/dist/bubble/BubbleContentWrapper.vue.d.ts +0 -16
- package/dist/bubble/BubbleItem.vue.d.ts +0 -36
- package/dist/bubble/BubbleList.vue.d.ts +0 -41
- package/dist/bubble/BubbleProvider.vue.d.ts +0 -18
- package/dist/bubble/composables/index.d.ts +0 -10
- package/dist/bubble/composables/useBubbleBoxRenderer.d.ts +0 -18
- package/dist/bubble/composables/useBubbleContentRenderer.d.ts +0 -18
- package/dist/bubble/composables/useBubbleStateChange.d.ts +0 -2
- package/dist/bubble/composables/useBubbleStore.d.ts +0 -16
- package/dist/bubble/composables/useContentResolver.d.ts +0 -5
- package/dist/bubble/composables/useCopyCleanup.d.ts +0 -6
- package/dist/bubble/composables/useMessageContent.d.ts +0 -5
- package/dist/bubble/composables/useMessageGroup.d.ts +0 -4
- package/dist/bubble/composables/useOmitMessageFields.d.ts +0 -12
- package/dist/bubble/composables/useToolCall.d.ts +0 -25
- package/dist/bubble/constants.d.ts +0 -42
- package/dist/bubble/index.d.ts +0 -19
- package/dist/bubble/index.type.d.ts +0 -171
- package/dist/bubble/renderers/Box.vue.d.ts +0 -18
- package/dist/bubble/renderers/Image.vue.d.ts +0 -4
- package/dist/bubble/renderers/Loading.vue.d.ts +0 -4
- package/dist/bubble/renderers/Markdown.vue.d.ts +0 -4
- package/dist/bubble/renderers/Reasoning.vue.d.ts +0 -9
- package/dist/bubble/renderers/Text.vue.d.ts +0 -4
- package/dist/bubble/renderers/Tool.vue.d.ts +0 -14
- package/dist/bubble/renderers/ToolRole.vue.d.ts +0 -4
- package/dist/bubble/renderers/Tools.vue.d.ts +0 -4
- package/dist/bubble/renderers/allRenderers.d.ts +0 -93
- package/dist/bubble/renderers/defaultRenderers.d.ts +0 -27
- package/dist/bubble/utils.d.ts +0 -7
- package/dist/chat/components/ChatConversation.vue.d.ts +0 -267
- package/dist/chat/components/ChatLauncherButton.vue.d.ts +0 -12
- package/dist/chat/components/ChatMcpTrigger.vue.d.ts +0 -30
- package/dist/chat/components/ChatThemeToggleButton.vue.d.ts +0 -6
- package/dist/chat/components/ChatWelcome.vue.d.ts +0 -14
- package/dist/chat/components/icons/IconModelAliyunBailian.vue.d.ts +0 -7
- package/dist/chat/components/icons/IconModelDeepseek.vue.d.ts +0 -7
- package/dist/chat/components/icons/index.d.ts +0 -5
- package/dist/chat/composables/useChatConversation.d.ts +0 -37
- package/dist/chat/composables/useChatMcp.d.ts +0 -29
- package/dist/chat/composables/useChatModel.d.ts +0 -27
- package/dist/chat/index.d.ts +0 -9
- package/dist/chat/index.js +0 -13902
- package/dist/chat/index.type.d.ts +0 -92
- package/dist/chat/index.vue.d.ts +0 -51
- package/dist/chat/locale.d.ts +0 -12
- package/dist/chat/mcpServers.d.ts +0 -3
- package/dist/container/index.d.ts +0 -7
- package/dist/container/index.type.d.ts +0 -20
- package/dist/container/index.vue.d.ts +0 -32
- package/dist/conversations/index.d.ts +0 -7
- package/dist/conversations/index.vue.d.ts +0 -2
- package/dist/drag-overlay/constants.d.ts +0 -17
- package/dist/drag-overlay/directives/vDropzone.d.ts +0 -14
- package/dist/drag-overlay/index.d.ts +0 -7
- package/dist/drag-overlay/index.type.d.ts +0 -105
- package/dist/drag-overlay/index.vue.d.ts +0 -20
- package/dist/dropdown-menu/composables/usePopperHover.d.ts +0 -6
- package/dist/dropdown-menu/index.d.ts +0 -7
- package/dist/dropdown-menu/index.type.d.ts +0 -42
- package/dist/dropdown-menu/index.vue.d.ts +0 -217
- package/dist/feedback/components/SourceList.vue.d.ts +0 -11
- package/dist/feedback/components/index.d.ts +0 -1
- package/dist/feedback/index.d.ts +0 -7
- package/dist/feedback/index.type.d.ts +0 -25
- package/dist/feedback/index.vue.d.ts +0 -13
- package/dist/flow-layout-buttons/index.d.ts +0 -7
- package/dist/flow-layout-buttons/index.type.d.ts +0 -35
- package/dist/flow-layout-buttons/index.vue.d.ts +0 -22
- package/dist/history/components/Empty.vue.d.ts +0 -7
- package/dist/history/components/MenuList.vue.d.ts +0 -24
- package/dist/history/composables/useRenameEditor.d.ts +0 -22
- package/dist/history/constants.d.ts +0 -1
- package/dist/history/index.d.ts +0 -7
- package/dist/history/index.type.d.ts +0 -33
- package/dist/history/index.vue.d.ts +0 -18
- package/dist/icon-button/index.d.ts +0 -7
- package/dist/icon-button/index.type.d.ts +0 -7
- package/dist/icon-button/index.vue.d.ts +0 -6
- package/dist/mcp-add-form/components/CodeEditor.vue.d.ts +0 -9
- package/dist/mcp-add-form/components/FormEditor.vue.d.ts +0 -10
- package/dist/mcp-add-form/components/index.d.ts +0 -2
- package/dist/mcp-add-form/index.d.ts +0 -7
- package/dist/mcp-add-form/index.type.d.ts +0 -19
- package/dist/mcp-add-form/index.vue.d.ts +0 -13
- package/dist/mcp-server-picker/components/NoData.vue.d.ts +0 -7
- package/dist/mcp-server-picker/components/PluginCard.vue.d.ts +0 -40
- package/dist/mcp-server-picker/components/PluginModal.vue.d.ts +0 -15
- package/dist/mcp-server-picker/components/index.d.ts +0 -3
- package/dist/mcp-server-picker/index.d.ts +0 -7
- package/dist/mcp-server-picker/index.type.d.ts +0 -99
- package/dist/mcp-server-picker/index.vue.d.ts +0 -71
- package/dist/prompts/index.d.ts +0 -12
- package/dist/prompts/index.type.d.ts +0 -59
- package/dist/prompts/prompt.vue.d.ts +0 -5
- package/dist/prompts/prompts.vue.d.ts +0 -20
- package/dist/sender/components/editor-content/index.vue.d.ts +0 -4
- package/dist/sender/components/footer/index.vue.d.ts +0 -38
- package/dist/sender/components/layouts/MultiLineLayout.vue.d.ts +0 -43
- package/dist/sender/components/layouts/SingleLineLayout.vue.d.ts +0 -32
- package/dist/sender/composables/index.d.ts +0 -7
- package/dist/sender/composables/useAutoSize.d.ts +0 -5
- package/dist/sender/composables/useEditor.d.ts +0 -13
- package/dist/sender/composables/useKeyboardShortcuts.d.ts +0 -7
- package/dist/sender/composables/useModeSwitch.d.ts +0 -4
- package/dist/sender/composables/useSenderCore.d.ts +0 -31
- package/dist/sender/composables/useSlotScope.d.ts +0 -10
- package/dist/sender/context/index.d.ts +0 -6
- package/dist/sender/context/types.d.ts +0 -7
- package/dist/sender/extensions/constants.d.ts +0 -94
- package/dist/sender/extensions/index.d.ts +0 -12
- package/dist/sender/extensions/mention/commands.d.ts +0 -20
- package/dist/sender/extensions/mention/components/mention-list.vue.d.ts +0 -18
- package/dist/sender/extensions/mention/components/mention-view.vue.d.ts +0 -19
- package/dist/sender/extensions/mention/extension.d.ts +0 -6
- package/dist/sender/extensions/mention/index.d.ts +0 -22
- package/dist/sender/extensions/mention/plugin.d.ts +0 -16
- package/dist/sender/extensions/mention/types.d.ts +0 -126
- package/dist/sender/extensions/mention/utils.d.ts +0 -34
- package/dist/sender/extensions/suggestion/extension.d.ts +0 -8
- package/dist/sender/extensions/suggestion/index.d.ts +0 -20
- package/dist/sender/extensions/suggestion/plugin.d.ts +0 -21
- package/dist/sender/extensions/suggestion/suggestion-list.vue.d.ts +0 -46
- package/dist/sender/extensions/suggestion/types.d.ts +0 -254
- package/dist/sender/extensions/suggestion/utils/filter.d.ts +0 -29
- package/dist/sender/extensions/suggestion/utils/highlight.d.ts +0 -73
- package/dist/sender/extensions/template/block/extension.d.ts +0 -6
- package/dist/sender/extensions/template/block/plugins.d.ts +0 -13
- package/dist/sender/extensions/template/block/template-block-view.vue.d.ts +0 -14
- package/dist/sender/extensions/template/commands.d.ts +0 -31
- package/dist/sender/extensions/template/extension.d.ts +0 -6
- package/dist/sender/extensions/template/index.d.ts +0 -21
- package/dist/sender/extensions/template/select/dropdown-manager.d.ts +0 -23
- package/dist/sender/extensions/template/select/extension.d.ts +0 -5
- package/dist/sender/extensions/template/select/plugins.d.ts +0 -34
- package/dist/sender/extensions/template/select/template-select-view.vue.d.ts +0 -20
- package/dist/sender/extensions/template/types.d.ts +0 -100
- package/dist/sender/extensions/template/utils.d.ts +0 -20
- package/dist/sender/extensions/utils/id-generator.d.ts +0 -16
- package/dist/sender/extensions/utils/index.d.ts +0 -7
- package/dist/sender/extensions/utils/keyboard.d.ts +0 -49
- package/dist/sender/extensions/utils/position.d.ts +0 -25
- package/dist/sender/index.d.ts +0 -136
- package/dist/sender/index.type.d.ts +0 -302
- package/dist/sender/index.vue.d.ts +0 -90
- package/dist/sender/types/base.d.ts +0 -239
- package/dist/sender/types/components.d.ts +0 -68
- package/dist/sender/types/composables.d.ts +0 -122
- package/dist/sender/types/context.d.ts +0 -132
- package/dist/sender/types/slots.d.ts +0 -67
- package/dist/sender/utils/countGraphemes.d.ts +0 -1
- package/dist/sender-actions/action-button/index.vue.d.ts +0 -23
- package/dist/sender-actions/clear-button/index.vue.d.ts +0 -2
- package/dist/sender-actions/clear-button/useClearButtonState.d.ts +0 -6
- package/dist/sender-actions/default-actions/index.vue.d.ts +0 -17
- package/dist/sender-actions/index.d.ts +0 -21
- package/dist/sender-actions/index.type.d.ts +0 -7
- package/dist/sender-actions/submit-button/index.vue.d.ts +0 -2
- package/dist/sender-actions/types/common.d.ts +0 -40
- package/dist/sender-actions/types/index.d.ts +0 -5
- package/dist/sender-actions/types/tooltip.d.ts +0 -7
- package/dist/sender-actions/upload-button/index.type.d.ts +0 -57
- package/dist/sender-actions/upload-button/index.vue.d.ts +0 -16
- package/dist/sender-actions/utils/tooltip.d.ts +0 -8
- package/dist/sender-actions/voice-button/index.type.d.ts +0 -78
- package/dist/sender-actions/voice-button/index.vue.d.ts +0 -43
- package/dist/sender-actions/voice-button/speech.types.d.ts +0 -40
- package/dist/sender-actions/voice-button/useSpeechHandler.d.ts +0 -10
- package/dist/sender-actions/voice-button/webSpeechHandler.d.ts +0 -40
- package/dist/sender-actions/word-counter/index.vue.d.ts +0 -2
- package/dist/sender-compat/index.d.ts +0 -7
- package/dist/sender-compat/index.type.d.ts +0 -91
- package/dist/sender-compat/index.vue.d.ts +0 -532
- package/dist/shared/composables/createTeleport.d.ts +0 -2
- package/dist/shared/composables/index.d.ts +0 -5
- package/dist/shared/composables/useAutoScroll.d.ts +0 -25
- package/dist/shared/composables/useSlotRefs.d.ts +0 -12
- package/dist/shared/composables/useTeleportTarget.d.ts +0 -11
- package/dist/shared/composables/useTouchDevice.d.ts +0 -3
- package/dist/shared/utils.d.ts +0 -7
- package/dist/suggestion-pills/components/PillButton.vue.d.ts +0 -16
- package/dist/suggestion-pills/components/index.d.ts +0 -1
- package/dist/suggestion-pills/index.d.ts +0 -13
- package/dist/suggestion-pills/index.type.d.ts +0 -45
- package/dist/suggestion-pills/index.vue.d.ts +0 -44
- package/dist/suggestion-popover/components/Backdrop.vue.d.ts +0 -5
- package/dist/suggestion-popover/components/Header.vue.d.ts +0 -4
- package/dist/suggestion-popover/components/Loading.vue.d.ts +0 -17
- package/dist/suggestion-popover/components/NoData.vue.d.ts +0 -17
- package/dist/suggestion-popover/components/Tooltip.vue.d.ts +0 -19
- package/dist/suggestion-popover/index.d.ts +0 -7
- package/dist/suggestion-popover/index.type.d.ts +0 -80
- package/dist/suggestion-popover/index.vue.d.ts +0 -262
- package/dist/theme-provider/constants.d.ts +0 -6
- package/dist/theme-provider/index.d.ts +0 -9
- package/dist/theme-provider/index.type.d.ts +0 -18
- package/dist/theme-provider/index.vue.d.ts +0 -32
- package/dist/theme-provider/useTheme.d.ts +0 -11
- package/dist/useTheme.js +0 -22
- package/dist/welcome/index.d.ts +0 -7
- package/dist/welcome/index.type.d.ts +0 -10
- package/dist/welcome/index.vue.d.ts +0 -18
package/dist/index6.js
CHANGED
|
@@ -1,76 +1,129 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ref as L, watch as H, toValue as k, onMounted as xe, onUnmounted as We, nextTick as ne, defineComponent as I, openBlock as v, createElementBlock as E, renderSlot as C, computed as x, unref as R, normalizeClass as G, createVNode as V, watchEffect as Z, Fragment as P, createElementVNode as B, mergeProps as O, toDisplayString as z, withDirectives as ee, vShow as te, createBlock as A, resolveDynamicComponent as J, normalizeProps as D, guardReactiveProps as U, createCommentVNode as ae, useCssModule as Ve, renderList as W, markRaw as F, inject as T, provide as M, reactive as ze, readonly as Xe, withCtx as $ } from "vue";
|
|
2
2
|
import { _ as N } from "./_plugin-vue_export-helper.js";
|
|
3
|
-
import { IconLoading as
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { IconLoading as Be, IconAtom as qe, IconArrowDown as Re, IconPlugin as me, IconError as Ze, IconCancelled as Qe } from "@opentiny/tiny-robot-svgs";
|
|
4
|
+
import { l as et, w as tt, g as nt, a as st } from "./index4.js";
|
|
5
|
+
function _e(t, e) {
|
|
6
|
+
const n = H(t, (s, a) => {
|
|
7
|
+
a === !0 && s === !1 && (e(), n());
|
|
8
|
+
});
|
|
9
|
+
return n;
|
|
10
|
+
}
|
|
11
|
+
function ot(t, e, n) {
|
|
12
|
+
const { scrollOnMount: s = !0, bottomThreshold: a = 20, scrollThrottle: i = 0 } = n ?? {}, o = L(!0);
|
|
13
|
+
let l = !1;
|
|
14
|
+
const u = /* @__PURE__ */ new Set(), f = () => st(t), { y: m, isScrolling: h, arrivedState: y } = et(f, { throttle: i }), g = (r) => r.scrollHeight - r.scrollTop - r.clientHeight <= a, c = async (r = "auto") => {
|
|
15
|
+
const d = k(f);
|
|
16
|
+
if (d && (await ne(), d.scrollTo({ top: d.scrollHeight, behavior: r }), r === "smooth" && !g(d))) {
|
|
17
|
+
const _ = _e(h, () => {
|
|
18
|
+
d.scrollTo({ top: d.scrollHeight, behavior: "auto" }), u.delete(_);
|
|
19
|
+
});
|
|
20
|
+
u.add(_);
|
|
21
|
+
}
|
|
22
|
+
}, p = () => {
|
|
23
|
+
l || !o.value || (l = !0, requestAnimationFrame(async () => {
|
|
24
|
+
l = !1, await c("auto");
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
return H(
|
|
28
|
+
m,
|
|
29
|
+
() => {
|
|
30
|
+
const r = k(f);
|
|
31
|
+
r && (o.value = g(r));
|
|
32
|
+
},
|
|
33
|
+
{ flush: "post" }
|
|
34
|
+
), tt(
|
|
35
|
+
e,
|
|
36
|
+
() => {
|
|
37
|
+
p();
|
|
38
|
+
},
|
|
39
|
+
{ flush: "post", throttle: 100 }
|
|
40
|
+
), xe(() => {
|
|
41
|
+
s && c("smooth");
|
|
42
|
+
}), We(() => {
|
|
43
|
+
u.forEach((r) => {
|
|
44
|
+
r();
|
|
45
|
+
}), u.clear();
|
|
46
|
+
}), nt("keydown", (r) => {
|
|
47
|
+
if (r.key === "End" && !o.value) {
|
|
48
|
+
const d = _e(h, () => {
|
|
49
|
+
c("auto"), u.delete(d);
|
|
50
|
+
});
|
|
51
|
+
u.add(d);
|
|
52
|
+
}
|
|
53
|
+
}), {
|
|
54
|
+
scrollToBottom: c,
|
|
55
|
+
arrivedState: y
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const Ee = Symbol("bubble-message-group"), Ce = Symbol("bubble-box-renderer-matches"), ke = Symbol("bubble-box-fallback-renderer"), Ie = Symbol("bubble-box-attributes"), Se = Symbol(
|
|
6
59
|
"bubble-box-prop-fallback-renderer"
|
|
7
|
-
),
|
|
60
|
+
), Te = Symbol("bubble-content-renderer-matches"), Ae = Symbol(
|
|
8
61
|
"bubble-content-fallback-renderer"
|
|
9
|
-
),
|
|
62
|
+
), Me = Symbol("bubble-content-attributes"), Le = Symbol(
|
|
10
63
|
"bubble-content-prop-fallback-renderer"
|
|
11
|
-
),
|
|
64
|
+
), re = Symbol("bubble-store"), $e = Symbol("bubble-event-fn"), Oe = Symbol("bubble-list-context"), K = {
|
|
12
65
|
LOADING: -1,
|
|
13
66
|
NORMAL: 0,
|
|
14
67
|
CONTENT: 10,
|
|
15
68
|
ROLE: 20
|
|
16
|
-
},
|
|
69
|
+
}, rt = {
|
|
17
70
|
class: "tr-bubble__box",
|
|
18
71
|
"data-box-type": "box"
|
|
19
|
-
},
|
|
72
|
+
}, at = /* @__PURE__ */ I({
|
|
20
73
|
__name: "Box",
|
|
21
74
|
props: {
|
|
22
75
|
placement: {},
|
|
23
76
|
shape: {}
|
|
24
77
|
},
|
|
25
78
|
setup(t) {
|
|
26
|
-
return (e, n) => (
|
|
27
|
-
|
|
79
|
+
return (e, n) => (v(), E("div", rt, [
|
|
80
|
+
C(e.$slots, "default", {}, void 0, !0)
|
|
28
81
|
]));
|
|
29
82
|
}
|
|
30
|
-
}),
|
|
83
|
+
}), le = /* @__PURE__ */ N(at, [["__scopeId", "data-v-98101726"]]), lt = ["src", "alt"], ct = /* @__PURE__ */ I({
|
|
31
84
|
__name: "Image",
|
|
32
85
|
props: {
|
|
33
86
|
message: {},
|
|
34
87
|
contentIndex: {}
|
|
35
88
|
},
|
|
36
89
|
setup(t) {
|
|
37
|
-
const e = t, n = L(!1),
|
|
38
|
-
|
|
39
|
-
n.value = !1,
|
|
90
|
+
const e = t, n = L(!1), s = L(!1), { content: a } = fe(e), i = x(() => a.value ? typeof a.value.image_url == "string" ? a.value.image_url : a.value.image_url.url : null);
|
|
91
|
+
H(i, () => {
|
|
92
|
+
n.value = !1, s.value = !1;
|
|
40
93
|
});
|
|
41
|
-
const
|
|
42
|
-
n.value = !0,
|
|
43
|
-
},
|
|
44
|
-
|
|
94
|
+
const o = () => {
|
|
95
|
+
n.value = !0, s.value = !1;
|
|
96
|
+
}, l = () => {
|
|
97
|
+
s.value = !0, n.value = !0;
|
|
45
98
|
};
|
|
46
|
-
return (u,
|
|
99
|
+
return (u, f) => {
|
|
47
100
|
var m;
|
|
48
|
-
return
|
|
49
|
-
class:
|
|
101
|
+
return v(), E("img", {
|
|
102
|
+
class: G(["tr-bubble__image", { loading: !n.value }]),
|
|
50
103
|
src: i.value,
|
|
51
|
-
alt: (m =
|
|
104
|
+
alt: (m = R(a)) == null ? void 0 : m.text,
|
|
52
105
|
loading: "lazy",
|
|
53
|
-
onLoad:
|
|
54
|
-
onError:
|
|
106
|
+
onLoad: o,
|
|
107
|
+
onError: l,
|
|
55
108
|
"data-type": "image"
|
|
56
|
-
}, null, 42,
|
|
109
|
+
}, null, 42, lt);
|
|
57
110
|
};
|
|
58
111
|
}
|
|
59
|
-
}),
|
|
112
|
+
}), Ne = /* @__PURE__ */ N(ct, [["__scopeId", "data-v-e59794cb"]]), ut = {
|
|
60
113
|
class: "tr-bubble__loading",
|
|
61
114
|
"data-type": "loading"
|
|
62
|
-
},
|
|
115
|
+
}, it = /* @__PURE__ */ I({
|
|
63
116
|
__name: "Loading",
|
|
64
117
|
props: {
|
|
65
118
|
message: {},
|
|
66
119
|
contentIndex: {}
|
|
67
120
|
},
|
|
68
121
|
setup(t) {
|
|
69
|
-
return (e, n) => (
|
|
70
|
-
|
|
122
|
+
return (e, n) => (v(), E("div", ut, [
|
|
123
|
+
V(R(Be))
|
|
71
124
|
]));
|
|
72
125
|
}
|
|
73
|
-
}),
|
|
126
|
+
}), we = /* @__PURE__ */ N(it, [["__scopeId", "data-v-bc1b5ff4"]]), dt = { class: "title" }, bt = { class: "detail" }, ft = /* @__PURE__ */ I({
|
|
74
127
|
inheritAttrs: !1,
|
|
75
128
|
__name: "Reasoning",
|
|
76
129
|
props: {
|
|
@@ -78,95 +131,101 @@ const xe = Symbol("bubble-message-group"), Re = Symbol("bubble-box-renderer-matc
|
|
|
78
131
|
contentIndex: {}
|
|
79
132
|
},
|
|
80
133
|
setup(t) {
|
|
81
|
-
const e = t, { restMessage: n, restProps:
|
|
82
|
-
|
|
83
|
-
var
|
|
84
|
-
i.value = ((
|
|
134
|
+
const e = t, { restMessage: n, restProps: s } = je(e, ["reasoning_content"]), a = ue(n, e.contentIndex), i = L(!0);
|
|
135
|
+
Z(() => {
|
|
136
|
+
var f;
|
|
137
|
+
i.value = ((f = e.message.state) == null ? void 0 : f.open) ?? !0;
|
|
85
138
|
});
|
|
86
|
-
const
|
|
87
|
-
i.value = !i.value,
|
|
139
|
+
const o = ie(), l = () => {
|
|
140
|
+
i.value = !i.value, o({
|
|
141
|
+
name: "state:update",
|
|
142
|
+
payload: {
|
|
143
|
+
key: "open",
|
|
144
|
+
value: i.value
|
|
145
|
+
}
|
|
146
|
+
});
|
|
88
147
|
}, u = L(null);
|
|
89
|
-
return
|
|
148
|
+
return H(
|
|
90
149
|
() => e.message.reasoning_content,
|
|
91
150
|
() => {
|
|
92
|
-
|
|
151
|
+
ne(() => {
|
|
93
152
|
u.value && u.value.scrollTo({
|
|
94
153
|
top: u.value.scrollHeight,
|
|
95
154
|
behavior: "smooth"
|
|
96
155
|
});
|
|
97
156
|
});
|
|
98
157
|
}
|
|
99
|
-
), (
|
|
100
|
-
var
|
|
101
|
-
return
|
|
102
|
-
|
|
158
|
+
), (f, m) => {
|
|
159
|
+
var h, y;
|
|
160
|
+
return v(), E(P, null, [
|
|
161
|
+
B("div", O({
|
|
103
162
|
class: "tr-bubble__reasoning",
|
|
104
163
|
"data-type": "reasoning"
|
|
105
|
-
},
|
|
106
|
-
|
|
164
|
+
}, f.$attrs), [
|
|
165
|
+
B("div", {
|
|
107
166
|
class: "header",
|
|
108
|
-
onClick:
|
|
167
|
+
onClick: l
|
|
109
168
|
}, [
|
|
110
|
-
|
|
111
|
-
class:
|
|
169
|
+
B("div", {
|
|
170
|
+
class: G(["icon-and-text", { thinking: (h = e.message.state) == null ? void 0 : h.thinking }])
|
|
112
171
|
}, [
|
|
113
|
-
|
|
114
|
-
|
|
172
|
+
V(R(qe)),
|
|
173
|
+
B("span", dt, z((y = e.message.state) != null && y.thinking ? "正在思考" : "已思考"), 1)
|
|
115
174
|
], 2),
|
|
116
|
-
|
|
117
|
-
class:
|
|
175
|
+
V(R(Re), {
|
|
176
|
+
class: G(["expand-icon", { "-rotate-90": !i.value }])
|
|
118
177
|
}, null, 8, ["class"])
|
|
119
178
|
]),
|
|
120
|
-
|
|
121
|
-
m[0] || (m[0] =
|
|
122
|
-
|
|
123
|
-
|
|
179
|
+
ee(B("div", bt, [
|
|
180
|
+
m[0] || (m[0] = B("div", { class: "side-border" }, [
|
|
181
|
+
B("div", { class: "dot-wrapper" }, [
|
|
182
|
+
B("div", { class: "dot" })
|
|
124
183
|
]),
|
|
125
|
-
|
|
184
|
+
B("div", { class: "border-line" })
|
|
126
185
|
], -1)),
|
|
127
|
-
|
|
186
|
+
B("p", {
|
|
128
187
|
class: "detail-content",
|
|
129
188
|
ref_key: "detailRef",
|
|
130
189
|
ref: u
|
|
131
190
|
}, z(e.message.reasoning_content), 513)
|
|
132
191
|
], 512), [
|
|
133
|
-
[
|
|
192
|
+
[te, i.value]
|
|
134
193
|
])
|
|
135
194
|
], 16),
|
|
136
|
-
(
|
|
195
|
+
(v(), A(J(R(a).renderer), D(U({ ...R(a).attributes, ...R(s) })), null, 16))
|
|
137
196
|
], 64);
|
|
138
197
|
};
|
|
139
198
|
}
|
|
140
|
-
}),
|
|
199
|
+
}), Fe = /* @__PURE__ */ N(ft, [["__scopeId", "data-v-4ddaccea"]]), pt = {
|
|
141
200
|
key: 0,
|
|
142
201
|
class: "tr-bubble__text",
|
|
143
202
|
"data-type": "text"
|
|
144
|
-
},
|
|
203
|
+
}, mt = /* @__PURE__ */ I({
|
|
145
204
|
__name: "Text",
|
|
146
205
|
props: {
|
|
147
206
|
message: {},
|
|
148
207
|
contentIndex: {}
|
|
149
208
|
},
|
|
150
209
|
setup(t) {
|
|
151
|
-
const e = t, { contentText: n } =
|
|
152
|
-
return (
|
|
210
|
+
const e = t, { contentText: n } = fe(e);
|
|
211
|
+
return (s, a) => R(n) ? (v(), E("p", pt, z(R(n)), 1)) : ae("", !0);
|
|
153
212
|
}
|
|
154
|
-
}),
|
|
213
|
+
}), ce = /* @__PURE__ */ N(mt, [["__scopeId", "data-v-93592ecb"]]), Pe = /* @__PURE__ */ I({
|
|
155
214
|
__name: "ToolRole",
|
|
156
215
|
props: {
|
|
157
216
|
message: {},
|
|
158
217
|
contentIndex: {}
|
|
159
218
|
},
|
|
160
219
|
setup(t) {
|
|
161
|
-
const e = t, n =
|
|
162
|
-
return
|
|
220
|
+
const e = t, n = be();
|
|
221
|
+
return Z(() => {
|
|
163
222
|
e.message.tool_call_id && (n.toolCallResults || (n.toolCallResults = {}), n.toolCallResults[e.message.tool_call_id] = e.message.content ?? "");
|
|
164
|
-
}), (
|
|
223
|
+
}), (s, a) => ae("", !0);
|
|
165
224
|
}
|
|
166
|
-
}),
|
|
225
|
+
}), _t = {
|
|
167
226
|
class: "tr-bubble__tool-call",
|
|
168
227
|
"data-type": "tool-call"
|
|
169
|
-
},
|
|
228
|
+
}, gt = { class: "header" }, vt = { class: "header-left" }, ht = { class: "title" }, yt = { class: "header-right" }, xt = { class: "divider" }, Bt = ["innerHTML"], Rt = /* @__PURE__ */ I({
|
|
170
229
|
__name: "Tool",
|
|
171
230
|
props: {
|
|
172
231
|
message: {},
|
|
@@ -174,97 +233,103 @@ const xe = Symbol("bubble-message-group"), Re = Symbol("bubble-box-renderer-matc
|
|
|
174
233
|
toolCallIndex: {}
|
|
175
234
|
},
|
|
176
235
|
setup(t) {
|
|
177
|
-
const e = t, { toolCall: n, toolCallWithResult:
|
|
178
|
-
["running", { text: "正在调用", icon:
|
|
179
|
-
["success", { text: "已调用", icon:
|
|
180
|
-
["failed", { text: "调用失败", icon:
|
|
181
|
-
["cancelled", { text: "已取消", icon:
|
|
182
|
-
]),
|
|
183
|
-
var
|
|
184
|
-
return i.get(((
|
|
185
|
-
}),
|
|
186
|
-
let
|
|
236
|
+
const e = t, { toolCall: n, toolCallWithResult: s, state: a } = Ut(e), i = /* @__PURE__ */ new Map([
|
|
237
|
+
["running", { text: "正在调用", icon: Be }],
|
|
238
|
+
["success", { text: "已调用", icon: me }],
|
|
239
|
+
["failed", { text: "调用失败", icon: Ze }],
|
|
240
|
+
["cancelled", { text: "已取消", icon: Qe }]
|
|
241
|
+
]), o = x(() => {
|
|
242
|
+
var d;
|
|
243
|
+
return i.get(((d = a.value) == null ? void 0 : d.status) || "") || { text: "", icon: me };
|
|
244
|
+
}), l = (d, _ = 2) => {
|
|
245
|
+
let b = "";
|
|
187
246
|
try {
|
|
188
|
-
typeof
|
|
247
|
+
typeof d == "string" ? b = JSON.stringify(JSON.parse(d), null, _) : b = JSON.stringify(d, null, _);
|
|
189
248
|
} catch {
|
|
190
249
|
}
|
|
191
|
-
return
|
|
192
|
-
}, u =
|
|
193
|
-
if (!
|
|
250
|
+
return b;
|
|
251
|
+
}, u = Ve(), f = (d) => d.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), m = (d) => {
|
|
252
|
+
if (!d)
|
|
194
253
|
return "";
|
|
195
|
-
let
|
|
196
|
-
return
|
|
254
|
+
let _ = f(d);
|
|
255
|
+
return _ = _.replace(
|
|
197
256
|
/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g,
|
|
198
|
-
(
|
|
199
|
-
let
|
|
200
|
-
return /^"/.test(
|
|
257
|
+
(b) => {
|
|
258
|
+
let S = "number";
|
|
259
|
+
return /^"/.test(b) ? S = /:$/.test(b) ? "key" : "string" : /true|false/.test(b) ? S = "boolean" : /null/.test(b) && (S = "null"), `<span class="${u[S]}">${b}</span>`;
|
|
201
260
|
}
|
|
202
|
-
),
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
top:
|
|
261
|
+
), _;
|
|
262
|
+
}, h = x(() => l(s.value, 2)), y = x(() => m(h.value)), g = L(null);
|
|
263
|
+
H(h, (d, _) => {
|
|
264
|
+
_ === "" || _ === "{}" || ne(() => {
|
|
265
|
+
g.value && g.value.scrollTo({
|
|
266
|
+
top: g.value.scrollHeight,
|
|
208
267
|
behavior: "smooth"
|
|
209
268
|
});
|
|
210
269
|
});
|
|
211
270
|
});
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
271
|
+
const c = L(!1);
|
|
272
|
+
Z(() => {
|
|
273
|
+
c.value = a.value.open ?? !1;
|
|
215
274
|
});
|
|
216
|
-
const
|
|
217
|
-
var
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
275
|
+
const p = ie(), r = () => {
|
|
276
|
+
var _, b;
|
|
277
|
+
c.value = !c.value;
|
|
278
|
+
const d = (_ = n.value) == null ? void 0 : _.id;
|
|
279
|
+
d && p({
|
|
280
|
+
name: "state:update",
|
|
281
|
+
payload: {
|
|
282
|
+
key: "toolCall",
|
|
283
|
+
value: {
|
|
284
|
+
...(b = e.message.state) == null ? void 0 : b.toolCall,
|
|
285
|
+
[d]: { ...a.value, open: c.value }
|
|
286
|
+
}
|
|
287
|
+
}
|
|
223
288
|
});
|
|
224
289
|
};
|
|
225
|
-
return (
|
|
226
|
-
var
|
|
227
|
-
return
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
(
|
|
231
|
-
class:
|
|
290
|
+
return (d, _) => {
|
|
291
|
+
var b;
|
|
292
|
+
return v(), E("div", _t, [
|
|
293
|
+
B("div", gt, [
|
|
294
|
+
B("div", vt, [
|
|
295
|
+
(v(), A(J(o.value.icon), {
|
|
296
|
+
class: G(["header-icon", `icon-${R(a).status}`])
|
|
232
297
|
}, null, 8, ["class"])),
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
298
|
+
B("span", null, [
|
|
299
|
+
B("span", null, z(o.value.text) + " ", 1),
|
|
300
|
+
B("span", ht, z(((b = R(n)) == null ? void 0 : b.function.name) || "Untitled"), 1)
|
|
236
301
|
])
|
|
237
302
|
]),
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
class:
|
|
241
|
-
onClick:
|
|
303
|
+
B("div", yt, [
|
|
304
|
+
V(R(Re), {
|
|
305
|
+
class: G(["expand-icon", { "-rotate-90": !c.value }]),
|
|
306
|
+
onClick: r
|
|
242
307
|
}, null, 8, ["class"])
|
|
243
308
|
])
|
|
244
309
|
]),
|
|
245
|
-
|
|
246
|
-
[
|
|
310
|
+
ee(B("div", xt, null, 512), [
|
|
311
|
+
[te, c.value]
|
|
247
312
|
]),
|
|
248
|
-
|
|
313
|
+
ee(B("div", {
|
|
249
314
|
class: "detail",
|
|
250
|
-
innerHTML:
|
|
315
|
+
innerHTML: y.value,
|
|
251
316
|
ref_key: "detailRef",
|
|
252
|
-
ref:
|
|
253
|
-
}, null, 8,
|
|
254
|
-
[
|
|
317
|
+
ref: g
|
|
318
|
+
}, null, 8, Bt), [
|
|
319
|
+
[te, c.value]
|
|
255
320
|
])
|
|
256
321
|
]);
|
|
257
322
|
};
|
|
258
323
|
}
|
|
259
|
-
}),
|
|
260
|
-
key:
|
|
261
|
-
number:
|
|
262
|
-
string:
|
|
263
|
-
boolean:
|
|
324
|
+
}), Et = "_key_1b448_2", Ct = "_number_1b448_6", kt = "_string_1b448_10", It = "_boolean_1b448_14", St = {
|
|
325
|
+
key: Et,
|
|
326
|
+
number: Ct,
|
|
327
|
+
string: kt,
|
|
328
|
+
boolean: It,
|
|
264
329
|
null: "_null_1b448_18"
|
|
265
|
-
},
|
|
266
|
-
$style:
|
|
267
|
-
},
|
|
330
|
+
}, Tt = {
|
|
331
|
+
$style: St
|
|
332
|
+
}, De = /* @__PURE__ */ N(Rt, [["__cssModules", Tt], ["__scopeId", "data-v-00014a8b"]]), Ue = /* @__PURE__ */ I({
|
|
268
333
|
inheritAttrs: !1,
|
|
269
334
|
__name: "Tools",
|
|
270
335
|
props: {
|
|
@@ -272,247 +337,256 @@ const xe = Symbol("bubble-message-group"), Re = Symbol("bubble-box-renderer-matc
|
|
|
272
337
|
contentIndex: {}
|
|
273
338
|
},
|
|
274
339
|
setup(t) {
|
|
275
|
-
const e = t, { restMessage: n, restProps:
|
|
276
|
-
return (i,
|
|
277
|
-
(
|
|
278
|
-
|
|
279
|
-
(
|
|
280
|
-
key:
|
|
340
|
+
const e = t, { restMessage: n, restProps: s } = je(e, ["tool_calls"]), a = ue(n, e.contentIndex);
|
|
341
|
+
return (i, o) => (v(), E(P, null, [
|
|
342
|
+
(v(), A(J(R(a).renderer), D(U({ ...R(a).attributes, ...R(s) })), null, 16)),
|
|
343
|
+
B("div", O({ class: "tr-bubble__tools" }, i.$attrs), [
|
|
344
|
+
(v(!0), E(P, null, W(e.message.tool_calls, (l, u) => (v(), A(De, O({
|
|
345
|
+
key: l.id
|
|
281
346
|
}, { ref_for: !0 }, e, { "tool-call-index": u }), null, 16, ["tool-call-index"]))), 128))
|
|
282
347
|
], 16)
|
|
283
348
|
], 64));
|
|
284
349
|
}
|
|
285
|
-
}),
|
|
350
|
+
}), He = [
|
|
286
351
|
{
|
|
287
352
|
find: (t, e) => (e == null ? void 0 : e.type) === "image_url",
|
|
288
|
-
renderer:
|
|
289
|
-
priority:
|
|
353
|
+
renderer: F(le),
|
|
354
|
+
priority: K.NORMAL,
|
|
290
355
|
attributes: { "data-box-type": "image" }
|
|
291
356
|
}
|
|
292
|
-
],
|
|
357
|
+
], Ke = [
|
|
293
358
|
{
|
|
294
359
|
find: (t) => !!t.loading,
|
|
295
|
-
renderer:
|
|
296
|
-
priority:
|
|
360
|
+
renderer: F(we),
|
|
361
|
+
priority: K.LOADING
|
|
297
362
|
},
|
|
298
363
|
{
|
|
299
364
|
find: (t) => typeof t.reasoning_content == "string" && t.reasoning_content.trim() !== "",
|
|
300
|
-
renderer:
|
|
301
|
-
priority:
|
|
365
|
+
renderer: F(Fe),
|
|
366
|
+
priority: K.NORMAL
|
|
302
367
|
},
|
|
303
368
|
{
|
|
304
369
|
find: (t) => Array.isArray(t.tool_calls) && t.tool_calls.length > 0,
|
|
305
|
-
renderer:
|
|
306
|
-
priority:
|
|
370
|
+
renderer: F(Ue),
|
|
371
|
+
priority: K.NORMAL
|
|
307
372
|
},
|
|
308
373
|
{
|
|
309
374
|
find: (t, e) => e.type === "image_url",
|
|
310
|
-
renderer:
|
|
311
|
-
priority:
|
|
375
|
+
renderer: F(Ne),
|
|
376
|
+
priority: K.CONTENT
|
|
312
377
|
},
|
|
313
378
|
{
|
|
314
379
|
find: (t) => t.role === "tool",
|
|
315
|
-
renderer:
|
|
316
|
-
priority:
|
|
380
|
+
renderer: F(Pe),
|
|
381
|
+
priority: K.ROLE
|
|
317
382
|
}
|
|
318
|
-
],
|
|
319
|
-
const e =
|
|
320
|
-
return !e && t &&
|
|
383
|
+
], Ge = F(le), Ye = F(ce), ge = Symbol("BUBBLE_CONTENT_RESOLVER_KEY"), se = (t) => {
|
|
384
|
+
const e = T(ge, void 0), n = e ?? t;
|
|
385
|
+
return !e && t && M(ge, t), n ? (a) => {
|
|
321
386
|
const i = k(n);
|
|
322
|
-
return i == null ? void 0 : i(
|
|
323
|
-
} : (
|
|
387
|
+
return i == null ? void 0 : i(a);
|
|
388
|
+
} : (a) => a.content;
|
|
324
389
|
};
|
|
325
|
-
function
|
|
326
|
-
const { boxRendererMatches: e, boxAttributes: n, fallbackBoxRenderer:
|
|
327
|
-
e &&
|
|
390
|
+
function At(t) {
|
|
391
|
+
const { boxRendererMatches: e, boxAttributes: n, fallbackBoxRenderer: s } = t;
|
|
392
|
+
e && M(Ce, e), n && M(Ie, n), s && M(ke, s);
|
|
328
393
|
}
|
|
329
|
-
function
|
|
394
|
+
function Mt(t) {
|
|
330
395
|
const { fallbackBoxRenderer: e } = t;
|
|
331
|
-
e &&
|
|
396
|
+
e && M(Se, e);
|
|
332
397
|
}
|
|
333
|
-
function
|
|
334
|
-
const n =
|
|
398
|
+
function Lt(t, e) {
|
|
399
|
+
const n = T(Ce, He), s = T(Ie, void 0), a = T(ke, void 0), i = T(Se, void 0), o = se();
|
|
335
400
|
if (typeof e == "number" && k(t).length !== 1)
|
|
336
401
|
throw new Error("[BubbleBoxRenderer] When contentIndex is a number, messages array length must be 1");
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
402
|
+
const l = (f) => {
|
|
403
|
+
if (f.length !== 1)
|
|
339
404
|
return { content: void 0, index: void 0 };
|
|
340
|
-
const m =
|
|
405
|
+
const m = o(f.at(0));
|
|
341
406
|
return {
|
|
342
407
|
content: Array.isArray(m) ? m.at(e ?? 0) : { type: "text", text: m || "" },
|
|
343
408
|
index: e ?? 0
|
|
344
409
|
};
|
|
345
|
-
}, u = (
|
|
346
|
-
return
|
|
347
|
-
const
|
|
348
|
-
const
|
|
349
|
-
if (
|
|
350
|
-
return typeof
|
|
351
|
-
})(),
|
|
352
|
-
return
|
|
353
|
-
renderer:
|
|
410
|
+
}, u = (f, m, h, y) => typeof f.attributes == "function" ? f.attributes(m, h, y) : f.attributes;
|
|
411
|
+
return x(() => {
|
|
412
|
+
const f = k(t), { content: m, index: h } = l(f), y = (() => {
|
|
413
|
+
const c = k(s);
|
|
414
|
+
if (c)
|
|
415
|
+
return typeof c == "function" ? c(f, m, h) : c;
|
|
416
|
+
})(), g = k(n).find((c) => c.find(f, m, h));
|
|
417
|
+
return g ? {
|
|
418
|
+
renderer: g.renderer,
|
|
354
419
|
attributes: {
|
|
355
|
-
...
|
|
356
|
-
...u(
|
|
420
|
+
...y,
|
|
421
|
+
...u(g, f, m, h)
|
|
357
422
|
}
|
|
358
423
|
} : {
|
|
359
|
-
renderer: k(i) || k(
|
|
360
|
-
attributes:
|
|
424
|
+
renderer: k(i) || k(a) || Ge,
|
|
425
|
+
attributes: y
|
|
361
426
|
};
|
|
362
427
|
});
|
|
363
428
|
}
|
|
364
|
-
function
|
|
365
|
-
const { contentRendererMatches: e, contentAttributes: n, fallbackContentRenderer:
|
|
366
|
-
e &&
|
|
429
|
+
function $t(t) {
|
|
430
|
+
const { contentRendererMatches: e, contentAttributes: n, fallbackContentRenderer: s } = t;
|
|
431
|
+
e && M(Te, e), n && M(Me, n), s && M(Ae, s);
|
|
367
432
|
}
|
|
368
|
-
function
|
|
433
|
+
function Ot(t) {
|
|
369
434
|
const { fallbackContentRenderer: e } = t;
|
|
370
|
-
e &&
|
|
435
|
+
e && M(Le, e);
|
|
371
436
|
}
|
|
372
|
-
function
|
|
373
|
-
const n =
|
|
374
|
-
return
|
|
375
|
-
const
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
378
|
-
return typeof
|
|
379
|
-
})(),
|
|
380
|
-
return
|
|
381
|
-
renderer:
|
|
437
|
+
function ue(t, e) {
|
|
438
|
+
const n = T(Te, Ke), s = T(Me, void 0), a = T(Ae, void 0), i = T(Le, void 0), o = se();
|
|
439
|
+
return x(() => {
|
|
440
|
+
const l = k(t), u = o(l), f = Array.isArray(u) ? u.at(e ?? 0) : { type: "text", text: u || "" }, m = (() => {
|
|
441
|
+
const y = k(s);
|
|
442
|
+
if (y)
|
|
443
|
+
return typeof y == "function" ? y(l, f, e) : y;
|
|
444
|
+
})(), h = k(n).find((y) => y.find(l, f, e));
|
|
445
|
+
return h ? {
|
|
446
|
+
renderer: h.renderer,
|
|
382
447
|
attributes: {
|
|
383
448
|
...m,
|
|
384
|
-
...
|
|
449
|
+
...h.attributes
|
|
385
450
|
}
|
|
386
451
|
} : {
|
|
387
|
-
renderer: k(i) || k(
|
|
452
|
+
renderer: k(i) || k(a) || Ye,
|
|
388
453
|
attributes: m
|
|
389
454
|
};
|
|
390
455
|
});
|
|
391
456
|
}
|
|
392
|
-
function
|
|
393
|
-
|
|
457
|
+
function Nt(t) {
|
|
458
|
+
M($e, t);
|
|
394
459
|
}
|
|
395
|
-
function
|
|
396
|
-
return
|
|
397
|
-
console.warn(`[Bubble]
|
|
460
|
+
function ie() {
|
|
461
|
+
return T($e, (t) => {
|
|
462
|
+
console.warn(`[Bubble] Event function not found for event: ${t.name}`);
|
|
398
463
|
});
|
|
399
464
|
}
|
|
400
|
-
function
|
|
401
|
-
const
|
|
465
|
+
function an() {
|
|
466
|
+
const t = ie();
|
|
467
|
+
return (e, n) => {
|
|
468
|
+
t({
|
|
469
|
+
name: "state:update",
|
|
470
|
+
payload: { key: e, value: n }
|
|
471
|
+
});
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function de(t) {
|
|
475
|
+
const e = T(re, void 0);
|
|
402
476
|
if (e)
|
|
403
477
|
return e;
|
|
404
|
-
const n =
|
|
405
|
-
return
|
|
478
|
+
const n = ze(t || {});
|
|
479
|
+
return M(re, n), n;
|
|
406
480
|
}
|
|
407
|
-
function
|
|
408
|
-
return
|
|
481
|
+
function be() {
|
|
482
|
+
return T(re, {});
|
|
409
483
|
}
|
|
410
|
-
function
|
|
411
|
-
|
|
484
|
+
function Je(t) {
|
|
485
|
+
H(
|
|
412
486
|
t,
|
|
413
|
-
(e, n,
|
|
487
|
+
(e, n, s) => {
|
|
414
488
|
if (!e) return;
|
|
415
|
-
const
|
|
489
|
+
const a = (i) => {
|
|
416
490
|
var u;
|
|
417
|
-
const
|
|
418
|
-
if (!e.contains((
|
|
491
|
+
const o = window.getSelection();
|
|
492
|
+
if (!e.contains((o == null ? void 0 : o.anchorNode) || null)) return;
|
|
419
493
|
i.preventDefault();
|
|
420
|
-
const
|
|
494
|
+
const l = (o == null ? void 0 : o.toString().replace(/\n{2,}/g, `
|
|
421
495
|
`)) || "";
|
|
422
|
-
(u = i.clipboardData) == null || u.setData("text/plain",
|
|
496
|
+
(u = i.clipboardData) == null || u.setData("text/plain", l);
|
|
423
497
|
};
|
|
424
|
-
e.addEventListener("copy",
|
|
498
|
+
e.addEventListener("copy", a), s(() => e.removeEventListener("copy", a));
|
|
425
499
|
},
|
|
426
500
|
{ immediate: !0, flush: "post" }
|
|
427
501
|
);
|
|
428
502
|
}
|
|
429
|
-
const
|
|
430
|
-
const e =
|
|
431
|
-
const
|
|
432
|
-
return Array.isArray(
|
|
433
|
-
}),
|
|
503
|
+
const fe = (t) => {
|
|
504
|
+
const e = se(), n = x(() => {
|
|
505
|
+
const a = e(t.message);
|
|
506
|
+
return Array.isArray(a) ? a.at(t.contentIndex) : { type: "text", text: a || "" };
|
|
507
|
+
}), s = x(() => n.value.type === "text" ? String(n.value.text) : "");
|
|
434
508
|
return {
|
|
435
509
|
content: n,
|
|
436
|
-
contentText:
|
|
510
|
+
contentText: s
|
|
437
511
|
};
|
|
438
512
|
};
|
|
439
|
-
function
|
|
440
|
-
|
|
513
|
+
function wt(t) {
|
|
514
|
+
M(Ee, t);
|
|
441
515
|
}
|
|
442
|
-
function
|
|
443
|
-
return
|
|
516
|
+
function Ft() {
|
|
517
|
+
return T(Ee, void 0);
|
|
444
518
|
}
|
|
445
|
-
function
|
|
446
|
-
const n =
|
|
447
|
-
const
|
|
448
|
-
return Object.fromEntries(
|
|
449
|
-
}),
|
|
519
|
+
function je(t, e) {
|
|
520
|
+
const n = x(() => {
|
|
521
|
+
const a = Object.entries(t.message).filter(([i]) => !e.includes(i));
|
|
522
|
+
return Object.fromEntries(a);
|
|
523
|
+
}), s = x(() => ({
|
|
450
524
|
...t,
|
|
451
525
|
message: n.value
|
|
452
526
|
}));
|
|
453
527
|
return {
|
|
454
528
|
restMessage: n,
|
|
455
|
-
restProps:
|
|
529
|
+
restProps: s
|
|
456
530
|
};
|
|
457
531
|
}
|
|
458
|
-
let
|
|
459
|
-
const
|
|
460
|
-
let
|
|
461
|
-
const
|
|
462
|
-
if (
|
|
463
|
-
return
|
|
532
|
+
let oe = null;
|
|
533
|
+
const Pt = () => (oe || (oe = import("./index5.js")), oe);
|
|
534
|
+
let j = null;
|
|
535
|
+
const Dt = async () => {
|
|
536
|
+
if (j)
|
|
537
|
+
return j;
|
|
464
538
|
try {
|
|
465
539
|
const [t, e] = await Promise.all([import("markdown-it"), import("dompurify")]);
|
|
466
|
-
return
|
|
540
|
+
return j = { markdown: t.default, dompurify: e.default }, j;
|
|
467
541
|
} catch {
|
|
468
|
-
return console.warn("[BubbleMarkdownRenderer] install markdown-it and dompurify to use markdown renderer"),
|
|
542
|
+
return console.warn("[BubbleMarkdownRenderer] install markdown-it and dompurify to use markdown renderer"), j = null, null;
|
|
469
543
|
}
|
|
470
|
-
},
|
|
471
|
-
const e =
|
|
472
|
-
var
|
|
473
|
-
return (
|
|
474
|
-
}), n =
|
|
475
|
-
var m,
|
|
476
|
-
let
|
|
477
|
-
|
|
478
|
-
const
|
|
544
|
+
}, ve = ["running", "success", "failed", "cancelled"], Ut = (t) => {
|
|
545
|
+
const e = x(() => {
|
|
546
|
+
var o, l;
|
|
547
|
+
return (l = (o = t.message) == null ? void 0 : o.tool_calls) == null ? void 0 : l[t.toolCallIndex];
|
|
548
|
+
}), n = be(), s = x(() => {
|
|
549
|
+
var m, h, y;
|
|
550
|
+
let o = n.toolCallDefaultStatus;
|
|
551
|
+
o && !ve.includes(o) && (o = void 0);
|
|
552
|
+
const l = n.toolCallDefaultOpen;
|
|
479
553
|
let u = {
|
|
480
|
-
status:
|
|
481
|
-
open:
|
|
554
|
+
status: o,
|
|
555
|
+
open: l
|
|
482
556
|
};
|
|
483
|
-
const
|
|
484
|
-
if (
|
|
485
|
-
const
|
|
486
|
-
if (
|
|
487
|
-
const { status:
|
|
488
|
-
|
|
557
|
+
const f = (m = e.value) == null ? void 0 : m.id;
|
|
558
|
+
if (f) {
|
|
559
|
+
const g = (y = (h = t.message.state) == null ? void 0 : h.toolCall) == null ? void 0 : y[f];
|
|
560
|
+
if (g) {
|
|
561
|
+
const { status: c, open: p, ...r } = g;
|
|
562
|
+
c && ve.includes(c) && (u.status = c), p !== void 0 && (u.open = p), u = { ...u, ...r };
|
|
489
563
|
}
|
|
490
564
|
}
|
|
491
565
|
return u;
|
|
492
|
-
}),
|
|
493
|
-
var
|
|
494
|
-
const
|
|
495
|
-
if (
|
|
496
|
-
return (u = n.toolCallResults) == null ? void 0 : u[
|
|
566
|
+
}), a = x(() => {
|
|
567
|
+
var l, u;
|
|
568
|
+
const o = (l = e.value) == null ? void 0 : l.id;
|
|
569
|
+
if (o)
|
|
570
|
+
return (u = n.toolCallResults) == null ? void 0 : u[o];
|
|
497
571
|
}), i = L({});
|
|
498
|
-
return
|
|
572
|
+
return Z(() => {
|
|
499
573
|
var u;
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
const m =
|
|
574
|
+
const o = (u = e.value) == null ? void 0 : u.function.arguments, l = a.value;
|
|
575
|
+
Pt().then(({ jsonrepair: f }) => {
|
|
576
|
+
const m = f(typeof o == "string" ? o || "{}" : JSON.stringify(o));
|
|
503
577
|
i.value = {
|
|
504
578
|
arguments: JSON.parse(m),
|
|
505
|
-
result:
|
|
579
|
+
result: l ? JSON.parse(f(l || "{}")) : void 0
|
|
506
580
|
};
|
|
507
|
-
}).catch((
|
|
508
|
-
console.warn(
|
|
581
|
+
}).catch((f) => {
|
|
582
|
+
console.warn(f);
|
|
509
583
|
});
|
|
510
584
|
}), {
|
|
511
585
|
toolCall: e,
|
|
512
|
-
toolCallWithResult:
|
|
513
|
-
state:
|
|
586
|
+
toolCallWithResult: Xe(i),
|
|
587
|
+
state: s
|
|
514
588
|
};
|
|
515
|
-
},
|
|
589
|
+
}, he = /* @__PURE__ */ I({
|
|
516
590
|
__name: "BubbleBoxWrapper",
|
|
517
591
|
props: {
|
|
518
592
|
role: {},
|
|
@@ -522,40 +596,48 @@ const Ft = async () => {
|
|
|
522
596
|
contentIndex: {}
|
|
523
597
|
},
|
|
524
598
|
setup(t) {
|
|
525
|
-
const e = t, n =
|
|
526
|
-
return (
|
|
599
|
+
const e = t, n = Lt(() => e.messages, e.contentIndex);
|
|
600
|
+
return (s, a) => (v(), A(J(R(n).renderer), O(R(n).attributes, {
|
|
527
601
|
"data-role": e.role,
|
|
528
602
|
"data-placement": e.placement,
|
|
529
603
|
"data-shape": e.shape
|
|
530
604
|
}), {
|
|
531
|
-
default:
|
|
532
|
-
|
|
605
|
+
default: $(() => [
|
|
606
|
+
C(s.$slots, "default")
|
|
533
607
|
]),
|
|
534
608
|
_: 3
|
|
535
609
|
}, 16, ["data-role", "data-placement", "data-shape"]));
|
|
536
610
|
}
|
|
537
|
-
}),
|
|
611
|
+
}), ye = /* @__PURE__ */ I({
|
|
538
612
|
__name: "BubbleContentWrapper",
|
|
539
613
|
props: {
|
|
540
614
|
message: {},
|
|
541
615
|
contentIndex: {}
|
|
542
616
|
},
|
|
543
|
-
emits: ["state-change"],
|
|
617
|
+
emits: ["state-change", "bubble-event"],
|
|
544
618
|
setup(t, { emit: e }) {
|
|
545
|
-
const n = t,
|
|
546
|
-
...
|
|
619
|
+
const n = t, s = ue(() => n.message, n.contentIndex), a = x(() => ({
|
|
620
|
+
...s.value.attributes,
|
|
547
621
|
message: n.message,
|
|
548
622
|
contentIndex: n.contentIndex
|
|
549
623
|
})), i = e;
|
|
550
|
-
return
|
|
551
|
-
i("
|
|
552
|
-
|
|
553
|
-
value: u,
|
|
624
|
+
return Nt((l) => {
|
|
625
|
+
if (i("bubble-event", {
|
|
626
|
+
...l,
|
|
554
627
|
contentIndex: n.contentIndex
|
|
555
|
-
})
|
|
556
|
-
|
|
628
|
+
}), l.name === "state:update") {
|
|
629
|
+
const u = l.payload;
|
|
630
|
+
if (!u || typeof u != "object" || !("key" in u) || typeof u.key != "string" || !("value" in u))
|
|
631
|
+
return;
|
|
632
|
+
i("state-change", {
|
|
633
|
+
key: u.key,
|
|
634
|
+
value: u.value,
|
|
635
|
+
contentIndex: n.contentIndex
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
}), (l, u) => (v(), A(J(R(s).renderer), D(U(a.value)), null, 16));
|
|
557
639
|
}
|
|
558
|
-
}),
|
|
640
|
+
}), Ht = ["data-role", "data-placement"], Kt = { class: "tr-bubble__body" }, Gt = { class: "tr-bubble__content" }, Yt = { class: "tr-bubble__after" }, Jt = /* @__PURE__ */ I({
|
|
559
641
|
__name: "Bubble",
|
|
560
642
|
props: {
|
|
561
643
|
content: {},
|
|
@@ -576,168 +658,116 @@ const Ft = async () => {
|
|
|
576
658
|
fallbackBoxRenderer: {},
|
|
577
659
|
fallbackContentRenderer: {}
|
|
578
660
|
},
|
|
579
|
-
emits: ["state-change"],
|
|
661
|
+
emits: ["state-change", "bubble-event"],
|
|
580
662
|
setup(t, { emit: e }) {
|
|
581
|
-
const n = t,
|
|
582
|
-
|
|
583
|
-
const i =
|
|
584
|
-
var
|
|
585
|
-
if ((
|
|
586
|
-
return
|
|
587
|
-
const { role:
|
|
588
|
-
return [{ role:
|
|
589
|
-
}), u = (
|
|
590
|
-
const
|
|
591
|
-
return Array.isArray(
|
|
663
|
+
const n = t, s = se(() => n.contentResolver), a = e;
|
|
664
|
+
de();
|
|
665
|
+
const i = Ft(), o = x(() => k(i)), l = x(() => {
|
|
666
|
+
var Q;
|
|
667
|
+
if ((Q = o.value) != null && Q.messages.length)
|
|
668
|
+
return o.value.messages;
|
|
669
|
+
const { role: g, content: c, reasoning_content: p, tool_calls: r, tool_call_id: d, name: _, id: b, loading: S, state: w } = n;
|
|
670
|
+
return [{ role: g, content: c, reasoning_content: p, tool_calls: r, tool_call_id: d, name: _, id: b, loading: S, state: w }];
|
|
671
|
+
}), u = (g) => {
|
|
672
|
+
const c = s(g);
|
|
673
|
+
return Array.isArray(c) ? c : [{ type: "text", text: c || "" }];
|
|
592
674
|
};
|
|
593
|
-
|
|
594
|
-
const
|
|
595
|
-
if (n.contentRenderMode === "split" &&
|
|
596
|
-
const
|
|
597
|
-
if (Array.isArray(
|
|
598
|
-
return
|
|
675
|
+
Mt({ fallbackBoxRenderer: () => n.fallbackBoxRenderer }), Ot({ fallbackContentRenderer: () => n.fallbackContentRenderer });
|
|
676
|
+
const f = x(() => l.value.length === 0 ? !0 : n.hidden), m = x(() => {
|
|
677
|
+
if (n.contentRenderMode === "split" && l.value.length === 1) {
|
|
678
|
+
const g = s(l.value.at(0));
|
|
679
|
+
if (Array.isArray(g))
|
|
680
|
+
return g;
|
|
599
681
|
}
|
|
600
682
|
return null;
|
|
601
|
-
}),
|
|
602
|
-
return
|
|
683
|
+
}), h = T(Oe, !1), y = L(null);
|
|
684
|
+
return h || Je(y), (g, c) => ee((v(), E("div", {
|
|
603
685
|
class: "tr-bubble",
|
|
604
686
|
ref_key: "bubbleRef",
|
|
605
|
-
ref:
|
|
687
|
+
ref: y,
|
|
606
688
|
"data-role": n.role,
|
|
607
689
|
"data-placement": n.placement
|
|
608
690
|
}, [
|
|
609
|
-
|
|
610
|
-
messages:
|
|
691
|
+
C(g.$slots, "prefix", {
|
|
692
|
+
messages: l.value,
|
|
611
693
|
role: t.role
|
|
612
694
|
}, void 0, !0),
|
|
613
|
-
|
|
614
|
-
n.avatar ? (
|
|
695
|
+
B("div", Kt, [
|
|
696
|
+
n.avatar ? (v(), A(J(n.avatar), {
|
|
615
697
|
key: 0,
|
|
616
|
-
class:
|
|
617
|
-
}, null, 8, ["class"])) :
|
|
618
|
-
|
|
619
|
-
m.value ? (
|
|
620
|
-
key:
|
|
698
|
+
class: G(["tr-bubble__avatar", g.$style["tr-bubble__avatar"]])
|
|
699
|
+
}, null, 8, ["class"])) : ae("", !0),
|
|
700
|
+
B("div", Gt, [
|
|
701
|
+
m.value ? (v(!0), E(P, { key: 0 }, W(m.value, (p, r) => (v(), A(he, {
|
|
702
|
+
key: r,
|
|
621
703
|
class: "tr-bubble__box",
|
|
622
704
|
role: n.role,
|
|
623
705
|
placement: n.placement,
|
|
624
706
|
shape: n.shape,
|
|
625
|
-
messages:
|
|
626
|
-
"content-index":
|
|
707
|
+
messages: l.value,
|
|
708
|
+
"content-index": r
|
|
627
709
|
}, {
|
|
628
|
-
default:
|
|
629
|
-
|
|
630
|
-
message:
|
|
631
|
-
"content-index":
|
|
632
|
-
onStateChange:
|
|
710
|
+
default: $(() => [
|
|
711
|
+
V(ye, {
|
|
712
|
+
message: l.value.at(0),
|
|
713
|
+
"content-index": r,
|
|
714
|
+
onStateChange: c[0] || (c[0] = (d) => a("state-change", { ...d, messageIndex: 0 })),
|
|
715
|
+
onBubbleEvent: c[1] || (c[1] = (d) => a("bubble-event", { ...d, messageIndex: 0 }))
|
|
633
716
|
}, null, 8, ["message", "content-index"]),
|
|
634
|
-
|
|
635
|
-
messages:
|
|
717
|
+
C(g.$slots, "content-footer", {
|
|
718
|
+
messages: l.value,
|
|
636
719
|
role: n.role,
|
|
637
|
-
contentIndex:
|
|
720
|
+
contentIndex: r
|
|
638
721
|
}, void 0, !0)
|
|
639
722
|
]),
|
|
640
723
|
_: 2
|
|
641
|
-
}, 1032, ["role", "placement", "shape", "messages", "content-index"]))), 128)) : (
|
|
724
|
+
}, 1032, ["role", "placement", "shape", "messages", "content-index"]))), 128)) : (v(), A(he, {
|
|
642
725
|
key: 1,
|
|
643
726
|
role: n.role,
|
|
644
727
|
placement: n.placement,
|
|
645
728
|
shape: n.shape,
|
|
646
|
-
messages:
|
|
729
|
+
messages: l.value
|
|
647
730
|
}, {
|
|
648
|
-
default:
|
|
649
|
-
(
|
|
650
|
-
key: `message-${
|
|
731
|
+
default: $(() => [
|
|
732
|
+
(v(!0), E(P, null, W(l.value, (p, r) => (v(), E(P, {
|
|
733
|
+
key: `message-${r}`
|
|
651
734
|
}, [
|
|
652
|
-
(
|
|
653
|
-
key: `content-${
|
|
654
|
-
message:
|
|
655
|
-
"content-index":
|
|
656
|
-
onStateChange: (
|
|
657
|
-
|
|
735
|
+
(v(!0), E(P, null, W(u(p), (d, _) => (v(), A(ye, {
|
|
736
|
+
key: `content-${_}`,
|
|
737
|
+
message: p,
|
|
738
|
+
"content-index": _,
|
|
739
|
+
onStateChange: (b) => a("state-change", { ...b, messageIndex: r }),
|
|
740
|
+
onBubbleEvent: (b) => a("bubble-event", { ...b, messageIndex: r })
|
|
741
|
+
}, null, 8, ["message", "content-index", "onStateChange", "onBubbleEvent"]))), 128))
|
|
658
742
|
], 64))), 128)),
|
|
659
|
-
|
|
660
|
-
messages:
|
|
743
|
+
C(g.$slots, "content-footer", {
|
|
744
|
+
messages: l.value,
|
|
661
745
|
role: n.role
|
|
662
746
|
}, void 0, !0)
|
|
663
747
|
]),
|
|
664
748
|
_: 3
|
|
665
749
|
}, 8, ["role", "placement", "shape", "messages"]))
|
|
666
750
|
]),
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
messages:
|
|
751
|
+
B("div", Yt, [
|
|
752
|
+
C(g.$slots, "after", {
|
|
753
|
+
messages: l.value,
|
|
670
754
|
role: t.role
|
|
671
755
|
}, void 0, !0)
|
|
672
756
|
])
|
|
673
757
|
]),
|
|
674
|
-
|
|
675
|
-
messages:
|
|
758
|
+
C(g.$slots, "suffix", {
|
|
759
|
+
messages: l.value,
|
|
676
760
|
role: t.role
|
|
677
761
|
}, void 0, !0)
|
|
678
|
-
], 8,
|
|
679
|
-
[
|
|
762
|
+
], 8, Ht)), [
|
|
763
|
+
[te, !f.value]
|
|
680
764
|
]);
|
|
681
765
|
}
|
|
682
|
-
}),
|
|
766
|
+
}), jt = {
|
|
683
767
|
"tr-bubble__avatar": "_tr-bubble__avatar_1r87c_2"
|
|
684
|
-
},
|
|
685
|
-
$style:
|
|
686
|
-
},
|
|
687
|
-
function ge(t, e) {
|
|
688
|
-
const n = U(t, (o, r) => {
|
|
689
|
-
r === !0 && o === !1 && (e(), n());
|
|
690
|
-
});
|
|
691
|
-
return n;
|
|
692
|
-
}
|
|
693
|
-
function jt(t, e, n) {
|
|
694
|
-
const { scrollOnMount: o = !0, bottomThreshold: r = 20, scrollThrottle: i = 0 } = n ?? {}, s = L(!0);
|
|
695
|
-
let a = !1;
|
|
696
|
-
const u = /* @__PURE__ */ new Set(), b = () => nt(t), { y: m, isScrolling: p, arrivedState: f } = Qe(b, { throttle: i }), l = (c) => c.scrollHeight - c.scrollTop - c.clientHeight <= r, d = async (c = "auto") => {
|
|
697
|
-
const _ = k(b);
|
|
698
|
-
if (_ && (await ee(), _.scrollTo({ top: _.scrollHeight, behavior: c }), c === "smooth" && !l(_))) {
|
|
699
|
-
const v = ge(p, () => {
|
|
700
|
-
_.scrollTo({ top: _.scrollHeight, behavior: "auto" }), u.delete(v);
|
|
701
|
-
});
|
|
702
|
-
u.add(v);
|
|
703
|
-
}
|
|
704
|
-
}, h = () => {
|
|
705
|
-
a || !s.value || (a = !0, requestAnimationFrame(async () => {
|
|
706
|
-
a = !1, await d("auto");
|
|
707
|
-
}));
|
|
708
|
-
};
|
|
709
|
-
return U(
|
|
710
|
-
m,
|
|
711
|
-
() => {
|
|
712
|
-
const c = k(b);
|
|
713
|
-
c && (s.value = l(c));
|
|
714
|
-
},
|
|
715
|
-
{ flush: "post" }
|
|
716
|
-
), et(
|
|
717
|
-
e,
|
|
718
|
-
() => {
|
|
719
|
-
h();
|
|
720
|
-
},
|
|
721
|
-
{ flush: "post", throttle: 100 }
|
|
722
|
-
), ve(() => {
|
|
723
|
-
o && d("smooth");
|
|
724
|
-
}), Ve(() => {
|
|
725
|
-
u.forEach((c) => {
|
|
726
|
-
c();
|
|
727
|
-
}), u.clear();
|
|
728
|
-
}), tt("keydown", (c) => {
|
|
729
|
-
if (c.key === "End" && !s.value) {
|
|
730
|
-
const _ = ge(p, () => {
|
|
731
|
-
d("auto"), u.delete(_);
|
|
732
|
-
});
|
|
733
|
-
u.add(_);
|
|
734
|
-
}
|
|
735
|
-
}), {
|
|
736
|
-
scrollToBottom: d,
|
|
737
|
-
arrivedState: f
|
|
738
|
-
};
|
|
739
|
-
}
|
|
740
|
-
const Wt = /* @__PURE__ */ S({
|
|
768
|
+
}, Wt = {
|
|
769
|
+
$style: jt
|
|
770
|
+
}, Y = /* @__PURE__ */ N(Jt, [["__cssModules", Wt], ["__scopeId", "data-v-d68ceaad"]]), Vt = /* @__PURE__ */ I({
|
|
741
771
|
__name: "BubbleItem",
|
|
742
772
|
props: {
|
|
743
773
|
messageGroup: {},
|
|
@@ -745,31 +775,32 @@ const Wt = /* @__PURE__ */ S({
|
|
|
745
775
|
contentRenderMode: {},
|
|
746
776
|
contentResolver: { type: Function }
|
|
747
777
|
},
|
|
748
|
-
emits: ["state-change"],
|
|
778
|
+
emits: ["state-change", "bubble-event"],
|
|
749
779
|
setup(t, { emit: e }) {
|
|
750
|
-
const n = t,
|
|
751
|
-
return
|
|
780
|
+
const n = t, s = e;
|
|
781
|
+
return wt(() => n.messageGroup), (a, i) => (v(), A(Y, O(t.roleConfig, {
|
|
752
782
|
role: t.messageGroup.role,
|
|
753
783
|
"content-render-mode": t.contentRenderMode,
|
|
754
784
|
"content-resolver": t.contentResolver,
|
|
755
|
-
onStateChange: i[0] || (i[0] = (
|
|
785
|
+
onStateChange: i[0] || (i[0] = (o) => s("state-change", o)),
|
|
786
|
+
onBubbleEvent: i[1] || (i[1] = (o) => s("bubble-event", o))
|
|
756
787
|
}), {
|
|
757
|
-
prefix:
|
|
758
|
-
|
|
788
|
+
prefix: $((o) => [
|
|
789
|
+
C(a.$slots, "prefix", D(U(o)))
|
|
759
790
|
]),
|
|
760
|
-
suffix:
|
|
761
|
-
|
|
791
|
+
suffix: $((o) => [
|
|
792
|
+
C(a.$slots, "suffix", D(U(o)))
|
|
762
793
|
]),
|
|
763
|
-
"content-footer":
|
|
764
|
-
|
|
794
|
+
"content-footer": $((o) => [
|
|
795
|
+
C(a.$slots, "content-footer", D(U(o)))
|
|
765
796
|
]),
|
|
766
|
-
after:
|
|
767
|
-
|
|
797
|
+
after: $((o) => [
|
|
798
|
+
C(a.$slots, "after", D(U(o)))
|
|
768
799
|
]),
|
|
769
800
|
_: 3
|
|
770
801
|
}, 16, ["role", "content-render-mode", "content-resolver"]));
|
|
771
802
|
}
|
|
772
|
-
}), zt = /* @__PURE__ */
|
|
803
|
+
}), zt = /* @__PURE__ */ I({
|
|
773
804
|
__name: "BubbleList",
|
|
774
805
|
props: {
|
|
775
806
|
messages: {},
|
|
@@ -781,110 +812,128 @@ const Wt = /* @__PURE__ */ S({
|
|
|
781
812
|
contentResolver: { type: Function, default: (t) => t.content },
|
|
782
813
|
autoScroll: { type: Boolean }
|
|
783
814
|
},
|
|
784
|
-
emits: ["state-change"],
|
|
815
|
+
emits: ["state-change", "bubble-event"],
|
|
785
816
|
setup(t, { expose: e, emit: n }) {
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
const i = (
|
|
789
|
-
var
|
|
790
|
-
return
|
|
791
|
-
},
|
|
792
|
-
let
|
|
817
|
+
const s = t, a = n;
|
|
818
|
+
de(), M(Oe, !0);
|
|
819
|
+
const i = (c) => {
|
|
820
|
+
var p, r;
|
|
821
|
+
return c ? !!((r = (p = s.roleConfigs) == null ? void 0 : p[c]) != null && r.hidden) : !1;
|
|
822
|
+
}, o = L(null);
|
|
823
|
+
let l = async () => {
|
|
793
824
|
};
|
|
794
|
-
if (
|
|
795
|
-
const
|
|
796
|
-
var
|
|
825
|
+
if (s.autoScroll) {
|
|
826
|
+
const c = x(() => s.messages.at(-1)), { scrollToBottom: p } = ot(o, () => {
|
|
827
|
+
var r, d;
|
|
797
828
|
return [
|
|
798
|
-
|
|
799
|
-
(
|
|
800
|
-
(d =
|
|
829
|
+
s.messages.length,
|
|
830
|
+
(r = c.value) == null ? void 0 : r.content,
|
|
831
|
+
(d = c.value) == null ? void 0 : d.reasoning_content
|
|
801
832
|
];
|
|
802
833
|
});
|
|
803
|
-
|
|
834
|
+
l = p, H(
|
|
804
835
|
() => {
|
|
805
|
-
var
|
|
806
|
-
return (
|
|
836
|
+
var r;
|
|
837
|
+
return (r = c.value) == null ? void 0 : r.role;
|
|
807
838
|
},
|
|
808
|
-
async (
|
|
809
|
-
|
|
839
|
+
async (r) => {
|
|
840
|
+
r === "user" && (await ne(), p("smooth"));
|
|
810
841
|
}
|
|
811
842
|
);
|
|
812
843
|
}
|
|
813
|
-
|
|
814
|
-
const u = (
|
|
815
|
-
const
|
|
816
|
-
let
|
|
817
|
-
for (const [d,
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
role:
|
|
821
|
-
messages: [
|
|
822
|
-
messageIndexes: [d]
|
|
823
|
-
|
|
824
|
-
}), l = v;
|
|
844
|
+
Je(o);
|
|
845
|
+
const u = (c) => {
|
|
846
|
+
const p = [];
|
|
847
|
+
let r = !1;
|
|
848
|
+
for (const [d, _] of c.entries()) {
|
|
849
|
+
const b = p[p.length - 1], S = _.role || "", w = i(_.role);
|
|
850
|
+
b && (r && w || b.role === S && r === w) ? (b.messages.push(_), b.messageIndexes.push(d)) : p.push({
|
|
851
|
+
role: S,
|
|
852
|
+
messages: [_],
|
|
853
|
+
messageIndexes: [d]
|
|
854
|
+
}), r = w;
|
|
825
855
|
}
|
|
826
|
-
return
|
|
827
|
-
},
|
|
828
|
-
const
|
|
856
|
+
return p;
|
|
857
|
+
}, f = (c, p) => {
|
|
858
|
+
const r = [];
|
|
829
859
|
let d = !1;
|
|
830
|
-
for (const [
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
!
|
|
834
|
-
|
|
835
|
-
d ===
|
|
836
|
-
role:
|
|
837
|
-
messages: [
|
|
838
|
-
messageIndexes: [
|
|
839
|
-
|
|
840
|
-
}), d = O;
|
|
860
|
+
for (const [_, b] of c.entries()) {
|
|
861
|
+
const S = r[r.length - 1], w = b.role === p, Q = b.role || "", pe = i(b.role);
|
|
862
|
+
S && // divider 消息(分割角色)永远不与任何组进行合并
|
|
863
|
+
!w && // divider 组(分割角色)不允许被追加消息,确保 divider 组永远只有 1 条 message
|
|
864
|
+
S.role !== p && // hidden / 非 hidden 分组隔离
|
|
865
|
+
d === pe ? (S.messages.push(b), S.messageIndexes.push(_)) : r.push({
|
|
866
|
+
role: w ? p : Q,
|
|
867
|
+
messages: [b],
|
|
868
|
+
messageIndexes: [_]
|
|
869
|
+
}), d = pe;
|
|
841
870
|
}
|
|
842
|
-
return
|
|
843
|
-
}, m =
|
|
871
|
+
return r;
|
|
872
|
+
}, m = x(() => s.messages.length === 0 ? [] : typeof s.groupStrategy == "function" ? s.groupStrategy(s.messages, s.dividerRole) : s.groupStrategy === "consecutive" ? u(s.messages) : f(s.messages, s.dividerRole)), h = (c, p) => {
|
|
873
|
+
const r = c.messageIndexes[p];
|
|
874
|
+
if (r === void 0) {
|
|
875
|
+
console.warn(
|
|
876
|
+
"[BubbleList] Missing messageIndexes mapping; event was not emitted. Ensure custom groupStrategy returns messageIndexes aligned with messages.",
|
|
877
|
+
{
|
|
878
|
+
messageIndex: p,
|
|
879
|
+
messageIndexes: c.messageIndexes
|
|
880
|
+
}
|
|
881
|
+
);
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
return r;
|
|
885
|
+
}, y = (c, p) => {
|
|
886
|
+
const r = h(c, p.messageIndex);
|
|
887
|
+
r !== void 0 && a("state-change", { ...p, messageIndex: r });
|
|
888
|
+
}, g = (c, p) => {
|
|
889
|
+
const r = h(c, p.messageIndex);
|
|
890
|
+
r !== void 0 && a("bubble-event", { ...p, messageIndex: r });
|
|
891
|
+
};
|
|
844
892
|
return e({
|
|
845
|
-
scrollToBottom:
|
|
846
|
-
}), (
|
|
893
|
+
scrollToBottom: l
|
|
894
|
+
}), (c, p) => (v(), E("div", {
|
|
847
895
|
class: "tr-bubble-list",
|
|
848
896
|
ref_key: "listRef",
|
|
849
|
-
ref:
|
|
897
|
+
ref: o
|
|
850
898
|
}, [
|
|
851
|
-
(
|
|
852
|
-
var
|
|
853
|
-
return
|
|
899
|
+
(v(!0), E(P, null, W(m.value, (r, d) => {
|
|
900
|
+
var _;
|
|
901
|
+
return v(), A(Vt, {
|
|
854
902
|
key: d,
|
|
855
|
-
role:
|
|
856
|
-
"role-config": (
|
|
857
|
-
"message-group":
|
|
858
|
-
"content-render-mode":
|
|
859
|
-
"content-resolver":
|
|
860
|
-
onStateChange: (
|
|
903
|
+
role: r.role || s.fallbackRole,
|
|
904
|
+
"role-config": (_ = s.roleConfigs) == null ? void 0 : _[r.role || s.fallbackRole],
|
|
905
|
+
"message-group": r,
|
|
906
|
+
"content-render-mode": s.contentRenderMode,
|
|
907
|
+
"content-resolver": s.contentResolver,
|
|
908
|
+
onStateChange: (b) => y(r, b),
|
|
909
|
+
onBubbleEvent: (b) => g(r, b)
|
|
861
910
|
}, {
|
|
862
|
-
prefix:
|
|
863
|
-
|
|
864
|
-
messageIndexes:
|
|
911
|
+
prefix: $((b) => [
|
|
912
|
+
C(c.$slots, "prefix", O({ ref_for: !0 }, b, {
|
|
913
|
+
messageIndexes: r.messageIndexes
|
|
865
914
|
}), void 0, !0)
|
|
866
915
|
]),
|
|
867
|
-
suffix:
|
|
868
|
-
|
|
869
|
-
messageIndexes:
|
|
916
|
+
suffix: $((b) => [
|
|
917
|
+
C(c.$slots, "suffix", O({ ref_for: !0 }, b, {
|
|
918
|
+
messageIndexes: r.messageIndexes
|
|
870
919
|
}), void 0, !0)
|
|
871
920
|
]),
|
|
872
|
-
"content-footer":
|
|
873
|
-
|
|
874
|
-
messageIndexes:
|
|
921
|
+
"content-footer": $((b) => [
|
|
922
|
+
C(c.$slots, "content-footer", O({ ref_for: !0 }, b, {
|
|
923
|
+
messageIndexes: r.messageIndexes
|
|
875
924
|
}), void 0, !0)
|
|
876
925
|
]),
|
|
877
|
-
after:
|
|
878
|
-
|
|
879
|
-
messageIndexes:
|
|
926
|
+
after: $((b) => [
|
|
927
|
+
C(c.$slots, "after", O({ ref_for: !0 }, b, {
|
|
928
|
+
messageIndexes: r.messageIndexes
|
|
880
929
|
}), void 0, !0)
|
|
881
930
|
]),
|
|
882
931
|
_: 2
|
|
883
|
-
}, 1032, ["role", "role-config", "message-group", "content-render-mode", "content-resolver", "onStateChange"]);
|
|
932
|
+
}, 1032, ["role", "role-config", "message-group", "content-render-mode", "content-resolver", "onStateChange", "onBubbleEvent"]);
|
|
884
933
|
}), 128))
|
|
885
934
|
], 512));
|
|
886
935
|
}
|
|
887
|
-
}),
|
|
936
|
+
}), X = /* @__PURE__ */ N(zt, [["__scopeId", "data-v-1d84cbfe"]]), q = /* @__PURE__ */ I({
|
|
888
937
|
__name: "BubbleProvider",
|
|
889
938
|
props: {
|
|
890
939
|
boxRendererMatches: {},
|
|
@@ -897,82 +946,83 @@ const Wt = /* @__PURE__ */ S({
|
|
|
897
946
|
},
|
|
898
947
|
setup(t) {
|
|
899
948
|
const e = t;
|
|
900
|
-
|
|
901
|
-
const n =
|
|
902
|
-
return
|
|
949
|
+
de(e.store);
|
|
950
|
+
const n = x(() => (e.boxRendererMatches || []).concat(He).sort((o, l) => (o.priority ?? 0) - (l.priority ?? 0))), s = x(() => (e.contentRendererMatches || []).concat(Ke).sort((o, l) => (o.priority ?? 0) - (l.priority ?? 0))), a = x(() => e.fallbackBoxRenderer || Ge), i = x(() => e.fallbackContentRenderer || Ye);
|
|
951
|
+
return At({
|
|
903
952
|
boxRendererMatches: n,
|
|
904
953
|
boxAttributes: () => e.boxAttributes,
|
|
905
|
-
fallbackBoxRenderer:
|
|
906
|
-
}),
|
|
907
|
-
contentRendererMatches:
|
|
954
|
+
fallbackBoxRenderer: a
|
|
955
|
+
}), $t({
|
|
956
|
+
contentRendererMatches: s,
|
|
908
957
|
contentAttributes: () => e.contentAttributes,
|
|
909
958
|
fallbackContentRenderer: i
|
|
910
|
-
}), (
|
|
959
|
+
}), (o, l) => C(o.$slots, "default");
|
|
911
960
|
}
|
|
912
|
-
}),
|
|
961
|
+
}), Xt = ["innerHTML"], qt = /* @__PURE__ */ I({
|
|
913
962
|
__name: "Markdown",
|
|
914
963
|
props: {
|
|
915
964
|
message: {},
|
|
916
965
|
contentIndex: {}
|
|
917
966
|
},
|
|
918
967
|
setup(t) {
|
|
919
|
-
const e = t, { contentText: n } =
|
|
920
|
-
|
|
921
|
-
|
|
968
|
+
const e = t, { contentText: n } = fe(e), s = L(null);
|
|
969
|
+
xe(async () => {
|
|
970
|
+
s.value = await Dt();
|
|
922
971
|
});
|
|
923
|
-
const { mdConfig:
|
|
924
|
-
return
|
|
925
|
-
if (
|
|
926
|
-
const { markdown:
|
|
927
|
-
|
|
972
|
+
const { mdConfig: a, dompurifyConfig: i } = be(), o = L("");
|
|
973
|
+
return Z(() => {
|
|
974
|
+
if (s.value) {
|
|
975
|
+
const { markdown: l, dompurify: u } = s.value, f = l(a || {}).render(n.value);
|
|
976
|
+
o.value = u.sanitize(f, i);
|
|
928
977
|
}
|
|
929
|
-
}), (
|
|
978
|
+
}), (l, u) => o.value ? (v(), E("div", {
|
|
930
979
|
key: 0,
|
|
931
980
|
class: "tr-bubble__markdown markdown-body",
|
|
932
981
|
"data-type": "markdown",
|
|
933
|
-
innerHTML:
|
|
934
|
-
}, null, 8,
|
|
982
|
+
innerHTML: o.value
|
|
983
|
+
}, null, 8, Xt)) : (v(), A(ce, D(O({ key: 1 }, e)), null, 16));
|
|
935
984
|
}
|
|
936
|
-
}),
|
|
937
|
-
Box:
|
|
938
|
-
Image:
|
|
939
|
-
Loading:
|
|
940
|
-
Markdown:
|
|
941
|
-
Reasoning:
|
|
942
|
-
Text:
|
|
943
|
-
Tool:
|
|
944
|
-
ToolRole:
|
|
945
|
-
Tools:
|
|
985
|
+
}), Zt = /* @__PURE__ */ N(qt, [["__scopeId", "data-v-eb1c196f"]]), ln = {
|
|
986
|
+
Box: le,
|
|
987
|
+
Image: Ne,
|
|
988
|
+
Loading: we,
|
|
989
|
+
Markdown: Zt,
|
|
990
|
+
Reasoning: Fe,
|
|
991
|
+
Text: ce,
|
|
992
|
+
Tool: De,
|
|
993
|
+
ToolRole: Pe,
|
|
994
|
+
Tools: Ue
|
|
946
995
|
};
|
|
947
|
-
|
|
948
|
-
const Zt = function(t) {
|
|
949
|
-
t.component(G.name, G);
|
|
950
|
-
};
|
|
951
|
-
G.install = Zt;
|
|
952
|
-
const an = G;
|
|
953
|
-
V.name = "TrBubbleList";
|
|
996
|
+
Y.name = "TrBubble";
|
|
954
997
|
const Qt = function(t) {
|
|
955
|
-
t.component(
|
|
998
|
+
t.component(Y.name, Y);
|
|
956
999
|
};
|
|
957
|
-
|
|
958
|
-
const
|
|
959
|
-
X.name = "
|
|
1000
|
+
Y.install = Qt;
|
|
1001
|
+
const cn = Y;
|
|
1002
|
+
X.name = "TrBubbleList";
|
|
960
1003
|
const en = function(t) {
|
|
961
1004
|
t.component(X.name, X);
|
|
962
1005
|
};
|
|
963
1006
|
X.install = en;
|
|
964
|
-
const
|
|
1007
|
+
const un = X;
|
|
1008
|
+
q.name = "TrBubbleProvider";
|
|
1009
|
+
const tn = function(t) {
|
|
1010
|
+
t.component(q.name, q);
|
|
1011
|
+
};
|
|
1012
|
+
q.install = tn;
|
|
1013
|
+
const dn = q;
|
|
965
1014
|
export {
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1015
|
+
cn as B,
|
|
1016
|
+
un as a,
|
|
1017
|
+
dn as b,
|
|
1018
|
+
K as c,
|
|
1019
|
+
ln as d,
|
|
1020
|
+
Lt as e,
|
|
1021
|
+
ue as f,
|
|
1022
|
+
ie as g,
|
|
1023
|
+
an as h,
|
|
1024
|
+
fe as i,
|
|
1025
|
+
je as j,
|
|
1026
|
+
Ut as k,
|
|
1027
|
+
ot as u
|
|
978
1028
|
};
|