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