@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.
Files changed (287) hide show
  1. package/dist/attachments/index.js +261 -258
  2. package/dist/dropdown-menu/index.js +1 -1
  3. package/dist/extension-manager/index.js +473 -0
  4. package/dist/floating-ui.dom.js +970 -0
  5. package/dist/index.d.ts +5949 -51
  6. package/dist/index.js +116 -103
  7. package/dist/index4.js +2 -2
  8. package/dist/index6.js +441 -431
  9. package/dist/index8.js +87 -102
  10. package/dist/layout/index.js +1 -1
  11. package/dist/model-selector/index.js +1002 -0
  12. package/dist/sender/index.js +1232 -2114
  13. package/dist/style.css +1 -1
  14. package/dist/suggestion-pills/index.js +1 -1
  15. package/dist/suggestion-popover/index.js +37 -36
  16. package/dist/theme-provider/index.js +41 -32
  17. package/dist/useSenderContentRegistration.js +8 -0
  18. package/dist/useSlotRefs.js +1 -1
  19. package/dist/useTeleportTarget.js +25 -0
  20. package/dist/utils.js +1 -1
  21. package/package.json +4 -23
  22. package/README.md +0 -192
  23. package/README.zh-CN.md +0 -192
  24. package/dist/action-group/ActionGroup.vue.d.ts +0 -26
  25. package/dist/action-group/ActionGroupItem.vue.d.ts +0 -18
  26. package/dist/action-group/index.d.ts +0 -12
  27. package/dist/action-group/index.type.d.ts +0 -17
  28. package/dist/anchor/components/AnchorItem.vue.d.ts +0 -24
  29. package/dist/anchor/components/AnchorList.vue.d.ts +0 -20
  30. package/dist/anchor/components/AnchorOverlay.vue.d.ts +0 -33
  31. package/dist/anchor/components/AnchorSearch.vue.d.ts +0 -7
  32. package/dist/anchor/composables/index.d.ts +0 -5
  33. package/dist/anchor/composables/useActiveSync.d.ts +0 -10
  34. package/dist/anchor/composables/useFloatingOffset.d.ts +0 -6
  35. package/dist/anchor/composables/useNavController.d.ts +0 -12
  36. package/dist/anchor/composables/useOverlayInteractions.d.ts +0 -6
  37. package/dist/anchor/composables/useTargetFeedback.d.ts +0 -5
  38. package/dist/anchor/defaults.d.ts +0 -16
  39. package/dist/anchor/index.d.ts +0 -7
  40. package/dist/anchor/index.type.d.ts +0 -60
  41. package/dist/anchor/index.vue.d.ts +0 -159
  42. package/dist/anchor/internal.type.d.ts +0 -103
  43. package/dist/anchor/utils/scroll.d.ts +0 -7
  44. package/dist/anchor/utils/target.d.ts +0 -6
  45. package/dist/attachments/components/FileCard.vue.d.ts +0 -18
  46. package/dist/attachments/components/ImagePreview.vue.d.ts +0 -17
  47. package/dist/attachments/components/index.d.ts +0 -2
  48. package/dist/attachments/composables/index.d.ts +0 -5
  49. package/dist/attachments/composables/useFileCard.d.ts +0 -15
  50. package/dist/attachments/composables/useFileType.d.ts +0 -20
  51. package/dist/attachments/composables/useImagePreview.d.ts +0 -18
  52. package/dist/attachments/composables/useListType.d.ts +0 -11
  53. package/dist/attachments/index.d.ts +0 -7
  54. package/dist/attachments/index.type.d.ts +0 -70
  55. package/dist/attachments/index.vue.d.ts +0 -27
  56. package/dist/attachments/utils.d.ts +0 -3
  57. package/dist/base-popper/components/Popper.vue.d.ts +0 -28
  58. package/dist/base-popper/index.d.ts +0 -2
  59. package/dist/base-popper/index.vue.d.ts +0 -41
  60. package/dist/bubble/Bubble.vue.d.ts +0 -47
  61. package/dist/bubble/BubbleBoxWrapper.vue.d.ts +0 -22
  62. package/dist/bubble/BubbleContentWrapper.vue.d.ts +0 -22
  63. package/dist/bubble/BubbleItem.vue.d.ts +0 -44
  64. package/dist/bubble/BubbleList.vue.d.ts +0 -43
  65. package/dist/bubble/BubbleProvider.vue.d.ts +0 -18
  66. package/dist/bubble/composables/index.d.ts +0 -11
  67. package/dist/bubble/composables/useBubbleBoxRenderer.d.ts +0 -18
  68. package/dist/bubble/composables/useBubbleContentRenderer.d.ts +0 -18
  69. package/dist/bubble/composables/useBubbleEvent.d.ts +0 -3
  70. package/dist/bubble/composables/useBubbleStateChange.d.ts +0 -1
  71. package/dist/bubble/composables/useBubbleStore.d.ts +0 -16
  72. package/dist/bubble/composables/useContentResolver.d.ts +0 -5
  73. package/dist/bubble/composables/useCopyCleanup.d.ts +0 -6
  74. package/dist/bubble/composables/useMessageContent.d.ts +0 -5
  75. package/dist/bubble/composables/useMessageGroup.d.ts +0 -4
  76. package/dist/bubble/composables/useOmitMessageFields.d.ts +0 -12
  77. package/dist/bubble/composables/useToolCall.d.ts +0 -25
  78. package/dist/bubble/constants.d.ts +0 -42
  79. package/dist/bubble/index.d.ts +0 -19
  80. package/dist/bubble/index.type.d.ts +0 -185
  81. package/dist/bubble/renderers/Box.vue.d.ts +0 -18
  82. package/dist/bubble/renderers/Image.vue.d.ts +0 -4
  83. package/dist/bubble/renderers/Loading.vue.d.ts +0 -4
  84. package/dist/bubble/renderers/Markdown.vue.d.ts +0 -4
  85. package/dist/bubble/renderers/Reasoning.vue.d.ts +0 -9
  86. package/dist/bubble/renderers/Text.vue.d.ts +0 -4
  87. package/dist/bubble/renderers/Tool.vue.d.ts +0 -14
  88. package/dist/bubble/renderers/ToolRole.vue.d.ts +0 -4
  89. package/dist/bubble/renderers/Tools.vue.d.ts +0 -4
  90. package/dist/bubble/renderers/allRenderers.d.ts +0 -93
  91. package/dist/bubble/renderers/defaultRenderers.d.ts +0 -27
  92. package/dist/bubble/utils.d.ts +0 -7
  93. package/dist/chat/components/ChatConversation.vue.d.ts +0 -305
  94. package/dist/chat/components/ChatLauncherButton.vue.d.ts +0 -12
  95. package/dist/chat/components/ChatMcpTrigger.vue.d.ts +0 -30
  96. package/dist/chat/components/ChatThemeToggleButton.vue.d.ts +0 -6
  97. package/dist/chat/components/ChatWelcome.vue.d.ts +0 -14
  98. package/dist/chat/components/icons/IconModelAliyunBailian.vue.d.ts +0 -7
  99. package/dist/chat/components/icons/IconModelDeepseek.vue.d.ts +0 -7
  100. package/dist/chat/components/icons/index.d.ts +0 -5
  101. package/dist/chat/composables/useChatConversation.d.ts +0 -37
  102. package/dist/chat/composables/useChatMcp.d.ts +0 -29
  103. package/dist/chat/composables/useChatModel.d.ts +0 -27
  104. package/dist/chat/index.d.ts +0 -9
  105. package/dist/chat/index.js +0 -13904
  106. package/dist/chat/index.type.d.ts +0 -92
  107. package/dist/chat/index.vue.d.ts +0 -51
  108. package/dist/chat/locale.d.ts +0 -12
  109. package/dist/chat/mcpServers.d.ts +0 -3
  110. package/dist/container/index.d.ts +0 -7
  111. package/dist/container/index.type.d.ts +0 -20
  112. package/dist/container/index.vue.d.ts +0 -32
  113. package/dist/conversations/index.d.ts +0 -7
  114. package/dist/conversations/index.vue.d.ts +0 -2
  115. package/dist/drag-overlay/constants.d.ts +0 -17
  116. package/dist/drag-overlay/directives/vDropzone.d.ts +0 -14
  117. package/dist/drag-overlay/index.d.ts +0 -7
  118. package/dist/drag-overlay/index.type.d.ts +0 -105
  119. package/dist/drag-overlay/index.vue.d.ts +0 -20
  120. package/dist/dropdown-menu/composables/usePopperHover.d.ts +0 -6
  121. package/dist/dropdown-menu/index.d.ts +0 -7
  122. package/dist/dropdown-menu/index.type.d.ts +0 -42
  123. package/dist/dropdown-menu/index.vue.d.ts +0 -217
  124. package/dist/feedback/components/SourceList.vue.d.ts +0 -11
  125. package/dist/feedback/components/index.d.ts +0 -1
  126. package/dist/feedback/index.d.ts +0 -7
  127. package/dist/feedback/index.type.d.ts +0 -25
  128. package/dist/feedback/index.vue.d.ts +0 -13
  129. package/dist/flow-layout-buttons/index.d.ts +0 -7
  130. package/dist/flow-layout-buttons/index.type.d.ts +0 -35
  131. package/dist/flow-layout-buttons/index.vue.d.ts +0 -22
  132. package/dist/history/components/Empty.vue.d.ts +0 -7
  133. package/dist/history/components/MenuList.vue.d.ts +0 -24
  134. package/dist/history/composables/useRenameEditor.d.ts +0 -22
  135. package/dist/history/constants.d.ts +0 -1
  136. package/dist/history/index.d.ts +0 -7
  137. package/dist/history/index.type.d.ts +0 -33
  138. package/dist/history/index.vue.d.ts +0 -18
  139. package/dist/icon-button/index.d.ts +0 -7
  140. package/dist/icon-button/index.type.d.ts +0 -7
  141. package/dist/icon-button/index.vue.d.ts +0 -6
  142. package/dist/layout/Layout.vue.d.ts +0 -246
  143. package/dist/layout/LayoutAsideToggle.vue.d.ts +0 -20
  144. package/dist/layout/LayoutProxyScrollbar.vue.d.ts +0 -6
  145. package/dist/layout/components/AsideContent.vue.d.ts +0 -35
  146. package/dist/layout/components/AsideResizeTrigger.vue.d.ts +0 -20
  147. package/dist/layout/components/FloatingDragBar.vue.d.ts +0 -18
  148. package/dist/layout/components/FloatingResizeTrigger.vue.d.ts +0 -17
  149. package/dist/layout/components/FloatingResizeTriggers.vue.d.ts +0 -14
  150. package/dist/layout/components/LayoutSurface.vue.d.ts +0 -41
  151. package/dist/layout/composables/useLayoutAsideStates.d.ts +0 -21
  152. package/dist/layout/composables/useLayoutContext.d.ts +0 -4
  153. package/dist/layout/composables/usePointerDrag.d.ts +0 -19
  154. package/dist/layout/index.d.ts +0 -22
  155. package/dist/layout/index.type.d.ts +0 -111
  156. package/dist/layout/internal.type.d.ts +0 -43
  157. package/dist/layout/utils/asideEventEmitters.d.ts +0 -6
  158. package/dist/layout/utils/asidePresets.d.ts +0 -5
  159. package/dist/layout/utils/cssLength.d.ts +0 -2
  160. package/dist/layout/utils/domInteraction.d.ts +0 -1
  161. package/dist/layout/utils/number.d.ts +0 -1
  162. package/dist/layout/utils/surfaceGeometry.d.ts +0 -87
  163. package/dist/layout/utils/surfaceResize.d.ts +0 -10
  164. package/dist/mcp-add-form/components/CodeEditor.vue.d.ts +0 -9
  165. package/dist/mcp-add-form/components/FormEditor.vue.d.ts +0 -10
  166. package/dist/mcp-add-form/components/index.d.ts +0 -2
  167. package/dist/mcp-add-form/index.d.ts +0 -7
  168. package/dist/mcp-add-form/index.type.d.ts +0 -19
  169. package/dist/mcp-add-form/index.vue.d.ts +0 -13
  170. package/dist/mcp-server-picker/components/NoData.vue.d.ts +0 -7
  171. package/dist/mcp-server-picker/components/PluginCard.vue.d.ts +0 -40
  172. package/dist/mcp-server-picker/components/PluginModal.vue.d.ts +0 -15
  173. package/dist/mcp-server-picker/components/index.d.ts +0 -3
  174. package/dist/mcp-server-picker/index.d.ts +0 -7
  175. package/dist/mcp-server-picker/index.type.d.ts +0 -99
  176. package/dist/mcp-server-picker/index.vue.d.ts +0 -71
  177. package/dist/prompts/index.d.ts +0 -12
  178. package/dist/prompts/index.type.d.ts +0 -59
  179. package/dist/prompts/prompt.vue.d.ts +0 -5
  180. package/dist/prompts/prompts.vue.d.ts +0 -20
  181. package/dist/sender/components/editor-content/index.vue.d.ts +0 -4
  182. package/dist/sender/components/footer/index.vue.d.ts +0 -38
  183. package/dist/sender/components/layouts/MultiLineLayout.vue.d.ts +0 -43
  184. package/dist/sender/components/layouts/SingleLineLayout.vue.d.ts +0 -32
  185. package/dist/sender/composables/index.d.ts +0 -7
  186. package/dist/sender/composables/useAutoSize.d.ts +0 -5
  187. package/dist/sender/composables/useEditor.d.ts +0 -13
  188. package/dist/sender/composables/useKeyboardShortcuts.d.ts +0 -7
  189. package/dist/sender/composables/useModeSwitch.d.ts +0 -4
  190. package/dist/sender/composables/useSenderCore.d.ts +0 -31
  191. package/dist/sender/composables/useSlotScope.d.ts +0 -10
  192. package/dist/sender/context/index.d.ts +0 -6
  193. package/dist/sender/context/types.d.ts +0 -7
  194. package/dist/sender/extensions/constants.d.ts +0 -94
  195. package/dist/sender/extensions/index.d.ts +0 -12
  196. package/dist/sender/extensions/mention/commands.d.ts +0 -20
  197. package/dist/sender/extensions/mention/components/mention-list.vue.d.ts +0 -18
  198. package/dist/sender/extensions/mention/components/mention-view.vue.d.ts +0 -19
  199. package/dist/sender/extensions/mention/extension.d.ts +0 -6
  200. package/dist/sender/extensions/mention/index.d.ts +0 -22
  201. package/dist/sender/extensions/mention/plugin.d.ts +0 -16
  202. package/dist/sender/extensions/mention/types.d.ts +0 -126
  203. package/dist/sender/extensions/mention/utils.d.ts +0 -34
  204. package/dist/sender/extensions/suggestion/extension.d.ts +0 -8
  205. package/dist/sender/extensions/suggestion/index.d.ts +0 -20
  206. package/dist/sender/extensions/suggestion/plugin.d.ts +0 -21
  207. package/dist/sender/extensions/suggestion/suggestion-list.vue.d.ts +0 -46
  208. package/dist/sender/extensions/suggestion/types.d.ts +0 -254
  209. package/dist/sender/extensions/suggestion/utils/filter.d.ts +0 -29
  210. package/dist/sender/extensions/suggestion/utils/highlight.d.ts +0 -73
  211. package/dist/sender/extensions/template/block/extension.d.ts +0 -6
  212. package/dist/sender/extensions/template/block/plugins.d.ts +0 -13
  213. package/dist/sender/extensions/template/block/template-block-view.vue.d.ts +0 -14
  214. package/dist/sender/extensions/template/commands.d.ts +0 -31
  215. package/dist/sender/extensions/template/extension.d.ts +0 -6
  216. package/dist/sender/extensions/template/index.d.ts +0 -21
  217. package/dist/sender/extensions/template/select/dropdown-manager.d.ts +0 -23
  218. package/dist/sender/extensions/template/select/extension.d.ts +0 -5
  219. package/dist/sender/extensions/template/select/plugins.d.ts +0 -34
  220. package/dist/sender/extensions/template/select/template-select-view.vue.d.ts +0 -20
  221. package/dist/sender/extensions/template/types.d.ts +0 -100
  222. package/dist/sender/extensions/template/utils.d.ts +0 -20
  223. package/dist/sender/extensions/utils/id-generator.d.ts +0 -16
  224. package/dist/sender/extensions/utils/index.d.ts +0 -7
  225. package/dist/sender/extensions/utils/keyboard.d.ts +0 -49
  226. package/dist/sender/extensions/utils/position.d.ts +0 -25
  227. package/dist/sender/index.d.ts +0 -139
  228. package/dist/sender/index.type.d.ts +0 -311
  229. package/dist/sender/index.vue.d.ts +0 -93
  230. package/dist/sender/types/base.d.ts +0 -239
  231. package/dist/sender/types/components.d.ts +0 -68
  232. package/dist/sender/types/composables.d.ts +0 -122
  233. package/dist/sender/types/context.d.ts +0 -138
  234. package/dist/sender/types/slots.d.ts +0 -67
  235. package/dist/sender/utils/countGraphemes.d.ts +0 -1
  236. package/dist/sender-actions/action-button/index.vue.d.ts +0 -23
  237. package/dist/sender-actions/clear-button/index.vue.d.ts +0 -2
  238. package/dist/sender-actions/clear-button/useClearButtonState.d.ts +0 -6
  239. package/dist/sender-actions/default-actions/index.vue.d.ts +0 -17
  240. package/dist/sender-actions/index.d.ts +0 -21
  241. package/dist/sender-actions/index.type.d.ts +0 -7
  242. package/dist/sender-actions/submit-button/index.vue.d.ts +0 -2
  243. package/dist/sender-actions/types/common.d.ts +0 -40
  244. package/dist/sender-actions/types/index.d.ts +0 -5
  245. package/dist/sender-actions/types/tooltip.d.ts +0 -7
  246. package/dist/sender-actions/upload-button/index.type.d.ts +0 -57
  247. package/dist/sender-actions/upload-button/index.vue.d.ts +0 -16
  248. package/dist/sender-actions/utils/tooltip.d.ts +0 -8
  249. package/dist/sender-actions/voice-button/index.type.d.ts +0 -78
  250. package/dist/sender-actions/voice-button/index.vue.d.ts +0 -43
  251. package/dist/sender-actions/voice-button/speech.types.d.ts +0 -40
  252. package/dist/sender-actions/voice-button/useSpeechHandler.d.ts +0 -10
  253. package/dist/sender-actions/voice-button/webSpeechHandler.d.ts +0 -40
  254. package/dist/sender-actions/word-counter/index.vue.d.ts +0 -2
  255. package/dist/sender-compat/index.d.ts +0 -7
  256. package/dist/sender-compat/index.type.d.ts +0 -91
  257. package/dist/sender-compat/index.vue.d.ts +0 -538
  258. package/dist/shared/composables/createTeleport.d.ts +0 -2
  259. package/dist/shared/composables/index.d.ts +0 -6
  260. package/dist/shared/composables/useAutoScroll.d.ts +0 -25
  261. package/dist/shared/composables/useControllableState.d.ts +0 -20
  262. package/dist/shared/composables/useSlotRefs.d.ts +0 -12
  263. package/dist/shared/composables/useTeleportTarget.d.ts +0 -11
  264. package/dist/shared/composables/useTouchDevice.d.ts +0 -3
  265. package/dist/shared/utils.d.ts +0 -7
  266. package/dist/suggestion-pills/components/PillButton.vue.d.ts +0 -16
  267. package/dist/suggestion-pills/components/index.d.ts +0 -1
  268. package/dist/suggestion-pills/index.d.ts +0 -13
  269. package/dist/suggestion-pills/index.type.d.ts +0 -45
  270. package/dist/suggestion-pills/index.vue.d.ts +0 -44
  271. package/dist/suggestion-popover/components/Backdrop.vue.d.ts +0 -5
  272. package/dist/suggestion-popover/components/Header.vue.d.ts +0 -4
  273. package/dist/suggestion-popover/components/Loading.vue.d.ts +0 -17
  274. package/dist/suggestion-popover/components/NoData.vue.d.ts +0 -17
  275. package/dist/suggestion-popover/components/Tooltip.vue.d.ts +0 -19
  276. package/dist/suggestion-popover/index.d.ts +0 -7
  277. package/dist/suggestion-popover/index.type.d.ts +0 -80
  278. package/dist/suggestion-popover/index.vue.d.ts +0 -262
  279. package/dist/theme-provider/constants.d.ts +0 -6
  280. package/dist/theme-provider/index.d.ts +0 -9
  281. package/dist/theme-provider/index.type.d.ts +0 -18
  282. package/dist/theme-provider/index.vue.d.ts +0 -32
  283. package/dist/theme-provider/useTheme.d.ts +0 -11
  284. package/dist/useTheme.js +0 -22
  285. package/dist/welcome/index.d.ts +0 -7
  286. package/dist/welcome/index.type.d.ts +0 -10
  287. package/dist/welcome/index.vue.d.ts +0 -18
package/dist/index6.js CHANGED
@@ -1,50 +1,50 @@
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
- import { _ as N } from "./_plugin-vue_export-helper.js";
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";
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 = H(t, (s, a) => {
7
- a === !0 && s === !1 && (e(), n());
6
+ const n = U(t, (o, l) => {
7
+ l === !0 && o === !1 && (e(), n());
8
8
  });
9
9
  return n;
10
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(_);
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
- }, p = () => {
23
- l || !o.value || (l = !0, requestAnimationFrame(async () => {
24
- l = !1, await c("auto");
22
+ }, f = () => {
23
+ a || !r.value || (a = !0, requestAnimationFrame(async () => {
24
+ a = !1, await c("auto");
25
25
  }));
26
26
  };
27
- return H(
28
- m,
27
+ return U(
28
+ _,
29
29
  () => {
30
- const r = k(f);
31
- r && (o.value = g(r));
30
+ const s = k(p);
31
+ s && (r.value = m(s));
32
32
  },
33
33
  { flush: "post" }
34
- ), tt(
34
+ ), nt(
35
35
  e,
36
36
  () => {
37
- p();
37
+ f();
38
38
  },
39
39
  { flush: "post", throttle: 100 }
40
40
  ), xe(() => {
41
- s && c("smooth");
41
+ o && c("smooth");
42
42
  }), We(() => {
43
- u.forEach((r) => {
44
- r();
43
+ u.forEach((s) => {
44
+ s();
45
45
  }), u.clear();
46
- }), nt("keydown", (r) => {
47
- if (r.key === "End" && !o.value) {
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"), Oe = Symbol("bubble-list-context"), K = {
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
- }, rt = {
69
+ }, at = {
70
70
  class: "tr-bubble__box",
71
71
  "data-box-type": "box"
72
- }, at = /* @__PURE__ */ I({
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", rt, [
79
+ return (e, n) => (v(), E("div", at, [
80
80
  C(e.$slots, "default", {}, void 0, !0)
81
81
  ]));
82
82
  }
83
- }), le = /* @__PURE__ */ N(at, [["__scopeId", "data-v-98101726"]]), lt = ["src", "alt"], ct = /* @__PURE__ */ I({
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 = 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;
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 o = () => {
95
- n.value = !0, s.value = !1;
96
- }, l = () => {
97
- s.value = !0, n.value = !0;
94
+ const r = () => {
95
+ n.value = !0, o.value = !1;
96
+ }, a = () => {
97
+ o.value = !0, n.value = !0;
98
98
  };
99
- return (u, f) => {
100
- var m;
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: (m = R(a)) == null ? void 0 : m.text,
104
+ alt: (_ = R(l)) == null ? void 0 : _.text,
105
105
  loading: "lazy",
106
- onLoad: o,
107
- onError: l,
106
+ onLoad: r,
107
+ onError: a,
108
108
  "data-type": "image"
109
- }, null, 42, lt);
109
+ }, null, 42, ct);
110
110
  };
111
111
  }
112
- }), Ne = /* @__PURE__ */ N(ct, [["__scopeId", "data-v-e59794cb"]]), ut = {
112
+ }), Oe = /* @__PURE__ */ O(ut, [["__scopeId", "data-v-e59794cb"]]), it = {
113
113
  class: "tr-bubble__loading",
114
114
  "data-type": "loading"
115
- }, it = /* @__PURE__ */ I({
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", ut, [
122
+ return (e, n) => (v(), E("div", it, [
123
123
  V(R(Be))
124
124
  ]));
125
125
  }
126
- }), we = /* @__PURE__ */ N(it, [["__scopeId", "data-v-bc1b5ff4"]]), dt = { class: "title" }, bt = { class: "detail" }, ft = /* @__PURE__ */ I({
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: 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;
138
- });
139
- const o = ie(), l = () => {
140
- i.value = !i.value, o({
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
- }, u = L(null);
148
- return H(
149
- () => e.message.reasoning_content,
150
- () => {
151
- ne(() => {
152
- u.value && u.value.scrollTo({
153
- top: u.value.scrollHeight,
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
- }, f.$attrs), [
174
+ }, m.$attrs), [
165
175
  B("div", {
166
176
  class: "header",
167
- onClick: l
177
+ onClick: y
168
178
  }, [
169
179
  B("div", {
170
- class: G(["icon-and-text", { thinking: (h = e.message.state) == null ? void 0 : h.thinking }])
180
+ class: G(["icon-and-text", { thinking: (f = e.message.state) == null ? void 0 : f.thinking }])
171
181
  }, [
172
- V(R(qe)),
173
- B("span", dt, z((y = e.message.state) != null && y.thinking ? "正在思考" : "已思考"), 1)
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
- ee(B("div", bt, [
180
- m[0] || (m[0] = B("div", { class: "side-border" }, [
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: u
190
- }, z(e.message.reasoning_content), 513)
199
+ ref: a
200
+ }, z(r.value), 513)
191
201
  ], 512), [
192
- [te, i.value]
202
+ [ee, i.value]
193
203
  ])
194
204
  ], 16),
195
- (v(), A(J(R(a).renderer), D(U({ ...R(a).attributes, ...R(s) })), null, 16))
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__ */ N(ft, [["__scopeId", "data-v-4ddaccea"]]), pt = {
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
- }, mt = /* @__PURE__ */ I({
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 (s, a) => R(n) ? (v(), E("p", pt, z(R(n)), 1)) : ae("", !0);
221
+ return (o, l) => R(n) ? (v(), E("p", mt, z(R(n)), 1)) : ae("", !0);
212
222
  }
213
- }), ce = /* @__PURE__ */ N(mt, [["__scopeId", "data-v-93592ecb"]]), Pe = /* @__PURE__ */ I({
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 Z(() => {
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
- }), (s, a) => ae("", !0);
233
+ }), (o, l) => ae("", !0);
224
234
  }
225
- }), _t = {
235
+ }), gt = {
226
236
  class: "tr-bubble__tool-call",
227
237
  "data-type": "tool-call"
228
- }, gt = { class: "header" }, vt = { class: "header-left" }, ht = { class: "title" }, yt = { class: "header-right" }, xt = { class: "divider" }, Bt = ["innerHTML"], Rt = /* @__PURE__ */ I({
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: s, state: a } = Ut(e), i = /* @__PURE__ */ new Map([
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: Ze }],
240
- ["cancelled", { text: "已取消", icon: Qe }]
241
- ]), o = x(() => {
249
+ ["failed", { text: "调用失败", icon: Qe }],
250
+ ["cancelled", { text: "已取消", icon: et }]
251
+ ]), r = x(() => {
242
252
  var d;
243
- return i.get(((d = a.value) == null ? void 0 : d.status) || "") || { text: "", icon: me };
244
- }), l = (d, _ = 2) => {
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, _) : b = JSON.stringify(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 = Ve(), f = (d) => d.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), m = (d) => {
261
+ }, u = ze(), p = (d) => d.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), _ = (d) => {
252
262
  if (!d)
253
263
  return "";
254
- let _ = f(d);
255
- return _ = _.replace(
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(() => 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,
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 = L(!1);
272
- Z(() => {
273
- c.value = a.value.open ?? !1;
281
+ const c = M(!1);
282
+ ne(() => {
283
+ c.value = l.value.open ?? !1;
274
284
  });
275
- const p = ie(), r = () => {
276
- var _, b;
285
+ const f = ie(), s = () => {
286
+ var g, b;
277
287
  c.value = !c.value;
278
- const d = (_ = n.value) == null ? void 0 : _.id;
279
- d && p({
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]: { ...a.value, open: c.value }
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", _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}`])
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(o.value.text) + " ", 1),
300
- B("span", ht, z(((b = R(n)) == null ? void 0 : b.function.name) || "Untitled"), 1)
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", yt, [
313
+ B("div", xt, [
304
314
  V(R(Re), {
305
315
  class: G(["expand-icon", { "-rotate-90": !c.value }]),
306
- onClick: r
316
+ onClick: s
307
317
  }, null, 8, ["class"])
308
318
  ])
309
319
  ]),
310
- ee(B("div", xt, null, 512), [
311
- [te, c.value]
320
+ Q(B("div", Bt, null, 512), [
321
+ [ee, c.value]
312
322
  ]),
313
- ee(B("div", {
323
+ Q(B("div", {
314
324
  class: "detail",
315
325
  innerHTML: y.value,
316
326
  ref_key: "detailRef",
317
- ref: g
318
- }, null, 8, Bt), [
319
- [te, c.value]
327
+ ref: m
328
+ }, null, 8, Rt), [
329
+ [ee, c.value]
320
330
  ])
321
331
  ]);
322
332
  };
323
333
  }
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,
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
- }, Tt = {
331
- $style: St
332
- }, De = /* @__PURE__ */ N(Rt, [["__cssModules", Tt], ["__scopeId", "data-v-00014a8b"]]), Ue = /* @__PURE__ */ I({
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: 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
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(we),
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(Ne),
385
+ renderer: F(Oe),
376
386
  priority: K.CONTENT
377
387
  },
378
388
  {
379
389
  find: (t) => t.role === "tool",
380
- renderer: F(Pe),
390
+ renderer: F(De),
381
391
  priority: K.ROLE
382
392
  }
383
- ], Ge = F(le), Ye = F(ce), ge = Symbol("BUBBLE_CONTENT_RESOLVER_KEY"), se = (t) => {
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 && M(ge, t), n ? (a) => {
395
+ return !e && t && L(ge, t), n ? (l) => {
386
396
  const i = k(n);
387
- return i == null ? void 0 : i(a);
388
- } : (a) => a.content;
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 && M(Se, e);
406
+ e && L(Se, e);
397
407
  }
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();
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 l = (f) => {
403
- if (f.length !== 1)
412
+ const a = (p) => {
413
+ if (p.length !== 1)
404
414
  return { content: void 0, index: void 0 };
405
- const m = o(f.at(0));
415
+ const _ = r(p.at(0));
406
416
  return {
407
- content: Array.isArray(m) ? m.at(e ?? 0) : { type: "text", text: m || "" },
417
+ content: Array.isArray(_) ? _.at(e ?? 0) : { type: "text", text: _ || "" },
408
418
  index: e ?? 0
409
419
  };
410
- }, u = (f, m, h, y) => typeof f.attributes == "function" ? f.attributes(m, h, y) : f.attributes;
420
+ }, u = (p, _, h, y) => typeof p.attributes == "function" ? p.attributes(_, h, y) : p.attributes;
411
421
  return x(() => {
412
- const f = k(t), { content: m, index: h } = l(f), y = (() => {
413
- const c = k(s);
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(f, m, h) : c;
416
- })(), g = k(n).find((c) => c.find(f, m, h));
417
- return g ? {
418
- renderer: g.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(g, f, m, h)
431
+ ...u(m, p, _, h)
422
432
  }
423
433
  } : {
424
- renderer: k(i) || k(a) || Ge,
434
+ renderer: k(i) || k(l) || Ge,
425
435
  attributes: y
426
436
  };
427
437
  });
428
438
  }
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);
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 && M(Le, e);
445
+ e && L(Le, e);
436
446
  }
437
447
  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();
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 l = k(t), u = o(l), f = Array.isArray(u) ? u.at(e ?? 0) : { type: "text", text: u || "" }, m = (() => {
441
- const y = k(s);
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(l, f, e) : y;
444
- })(), h = k(n).find((y) => y.find(l, f, e));
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
- ...m,
458
+ ..._,
449
459
  ...h.attributes
450
460
  }
451
461
  } : {
452
- renderer: k(i) || k(a) || Ye,
453
- attributes: m
462
+ renderer: k(i) || k(l) || Ye,
463
+ attributes: _
454
464
  };
455
465
  });
456
466
  }
457
467
  function Nt(t) {
458
- M($e, t);
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 an() {
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 = ze(t || {});
479
- return M(re, n), n;
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
- H(
495
+ U(
486
496
  t,
487
- (e, n, s) => {
497
+ (e, n, o) => {
488
498
  if (!e) return;
489
- const a = (i) => {
499
+ const l = (i) => {
490
500
  var u;
491
- const o = window.getSelection();
492
- if (!e.contains((o == null ? void 0 : o.anchorNode) || null)) return;
501
+ const r = window.getSelection();
502
+ if (!e.contains((r == null ? void 0 : r.anchorNode) || null)) return;
493
503
  i.preventDefault();
494
- const l = (o == null ? void 0 : o.toString().replace(/\n{2,}/g, `
504
+ const a = (r == null ? void 0 : r.toString().replace(/\n{2,}/g, `
495
505
  `)) || "";
496
- (u = i.clipboardData) == null || u.setData("text/plain", l);
506
+ (u = i.clipboardData) == null || u.setData("text/plain", a);
497
507
  };
498
- e.addEventListener("copy", a), s(() => e.removeEventListener("copy", a));
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 = 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) : "");
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: s
520
+ contentText: o
511
521
  };
512
522
  };
513
- function wt(t) {
514
- M(Ee, t);
523
+ function Ft(t) {
524
+ L(Ee, t);
515
525
  }
516
- function Ft() {
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 a = Object.entries(t.message).filter(([i]) => !e.includes(i));
522
- return Object.fromEntries(a);
523
- }), s = x(() => ({
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: s
539
+ restProps: o
530
540
  };
531
541
  }
532
- let oe = null;
533
- const Pt = () => (oe || (oe = import("./index5.js")), oe);
542
+ let se = null;
543
+ const Pt = () => (se || (se = import("./index5.js")), se);
534
544
  let j = null;
535
- const Dt = async () => {
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"], Ut = (t) => {
554
+ }, ve = ["running", "success", "failed", "cancelled"], Ht = (t) => {
545
555
  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;
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: o,
555
- open: l
564
+ status: r,
565
+ open: a
556
566
  };
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 };
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
- }), 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];
571
- }), i = L({});
572
- return Z(() => {
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 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));
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(m),
579
- result: l ? JSON.parse(f(l || "{}")) : void 0
588
+ arguments: JSON.parse(_),
589
+ result: a ? JSON.parse(p(a || "{}")) : void 0
580
590
  };
581
- }).catch((f) => {
582
- console.warn(f);
591
+ }).catch((p) => {
592
+ console.warn(p);
583
593
  });
584
594
  }), {
585
595
  toolCall: e,
586
- toolCallWithResult: Xe(i),
587
- state: s
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 = Lt(() => e.messages, e.contentIndex);
600
- return (s, a) => (v(), A(J(R(n).renderer), O(R(n).attributes, {
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(s.$slots, "default")
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, s = ue(() => n.message, n.contentIndex), a = x(() => ({
620
- ...s.value.attributes,
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((l) => {
634
+ return Nt((a) => {
625
635
  if (i("bubble-event", {
626
- ...l,
636
+ ...a,
627
637
  contentIndex: n.contentIndex
628
- }), l.name === "state:update") {
629
- const u = l.payload;
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
- }), (l, u) => (v(), A(J(R(s).renderer), D(U(a.value)), null, 16));
648
+ }), (a, u) => (v(), A(J(R(o).renderer), P(H(l.value)), null, 16));
639
649
  }
640
- }), Ht = ["data-role", "data-placement"], Kt = { class: "tr-bubble__body" }, Gt = { class: "tr-bubble__content" }, Yt = { class: "tr-bubble__after" }, Jt = /* @__PURE__ */ I({
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, s = se(() => n.contentResolver), a = e;
673
+ const n = t, o = oe(() => n.contentResolver), l = e;
664
674
  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);
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
- 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;
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(Oe, !1), y = L(null);
684
- return h || Je(y), (g, c) => ee((v(), E("div", {
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(g.$slots, "prefix", {
692
- messages: l.value,
701
+ C(m.$slots, "prefix", {
702
+ messages: a.value,
693
703
  role: t.role
694
704
  }, void 0, !0),
695
- B("div", Kt, [
705
+ B("div", Gt, [
696
706
  n.avatar ? (v(), A(J(n.avatar), {
697
707
  key: 0,
698
- class: G(["tr-bubble__avatar", g.$style["tr-bubble__avatar"]])
708
+ class: G(["tr-bubble__avatar", m.$style["tr-bubble__avatar"]])
699
709
  }, 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,
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: l.value,
708
- "content-index": r
717
+ messages: a.value,
718
+ "content-index": s
709
719
  }, {
710
720
  default: $(() => [
711
721
  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 }))
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(g.$slots, "content-footer", {
718
- messages: l.value,
727
+ C(m.$slots, "content-footer", {
728
+ messages: a.value,
719
729
  role: n.role,
720
- contentIndex: r
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: l.value
739
+ messages: a.value
730
740
  }, {
731
741
  default: $(() => [
732
- (v(!0), E(P, null, W(l.value, (p, r) => (v(), E(P, {
733
- key: `message-${r}`
742
+ (v(!0), E(D, null, W(a.value, (f, s) => (v(), E(D, {
743
+ key: `message-${s}`
734
744
  }, [
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 })
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(g.$slots, "content-footer", {
744
- messages: l.value,
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", Yt, [
752
- C(g.$slots, "after", {
753
- messages: l.value,
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(g.$slots, "suffix", {
759
- messages: l.value,
768
+ C(m.$slots, "suffix", {
769
+ messages: a.value,
760
770
  role: t.role
761
771
  }, void 0, !0)
762
- ], 8, Ht)), [
763
- [te, !f.value]
772
+ ], 8, Kt)), [
773
+ [ee, !p.value]
764
774
  ]);
765
775
  }
766
- }), jt = {
776
+ }), Wt = {
767
777
  "tr-bubble__avatar": "_tr-bubble__avatar_1r87c_2"
768
- }, Wt = {
769
- $style: jt
770
- }, Y = /* @__PURE__ */ N(Jt, [["__cssModules", Wt], ["__scopeId", "data-v-d68ceaad"]]), Vt = /* @__PURE__ */ I({
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, s = e;
781
- return wt(() => n.messageGroup), (a, i) => (v(), A(Y, O(t.roleConfig, {
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] = (o) => s("state-change", o)),
786
- onBubbleEvent: i[1] || (i[1] = (o) => s("bubble-event", o))
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: $((o) => [
789
- C(a.$slots, "prefix", D(U(o)))
798
+ prefix: $((r) => [
799
+ C(l.$slots, "prefix", P(H(r)))
790
800
  ]),
791
- suffix: $((o) => [
792
- C(a.$slots, "suffix", D(U(o)))
801
+ suffix: $((r) => [
802
+ C(l.$slots, "suffix", P(H(r)))
793
803
  ]),
794
- "content-footer": $((o) => [
795
- C(a.$slots, "content-footer", D(U(o)))
804
+ "content-footer": $((r) => [
805
+ C(l.$slots, "content-footer", P(H(r)))
796
806
  ]),
797
- after: $((o) => [
798
- C(a.$slots, "after", D(U(o)))
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
- }), zt = /* @__PURE__ */ I({
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 s = t, a = n;
818
- de(), M(Oe, !0);
827
+ const o = t, l = n;
828
+ de(), L(we, !0);
819
829
  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 () => {
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 (s.autoScroll) {
826
- const c = x(() => s.messages.at(-1)), { scrollToBottom: p } = ot(o, () => {
827
- var r, d;
835
+ if (o.autoScroll) {
836
+ const c = x(() => o.messages.at(-1)), { scrollToBottom: f } = rt(r, () => {
837
+ var s, d;
828
838
  return [
829
- s.messages.length,
830
- (r = c.value) == null ? void 0 : r.content,
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
- l = p, H(
844
+ a = f, U(
835
845
  () => {
836
- var r;
837
- return (r = c.value) == null ? void 0 : r.role;
846
+ var s;
847
+ return (s = c.value) == null ? void 0 : s.role;
838
848
  },
839
- async (r) => {
840
- r === "user" && (await ne(), p("smooth"));
849
+ async (s) => {
850
+ s === "user" && (await te(), f("smooth"));
841
851
  }
842
852
  );
843
853
  }
844
- Je(o);
854
+ Je(r);
845
855
  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({
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
- }), r = w;
864
+ }), s = N;
855
865
  }
856
- return p;
857
- }, f = (c, p) => {
858
- const r = [];
866
+ return f;
867
+ }, p = (c, f) => {
868
+ const s = [];
859
869
  let d = !1;
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);
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
- !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,
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 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) {
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: p,
888
+ messageIndex: f,
879
889
  messageIndexes: c.messageIndexes
880
890
  }
881
891
  );
882
892
  return;
883
893
  }
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 });
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: l
894
- }), (c, p) => (v(), E("div", {
903
+ scrollToBottom: a
904
+ }), (c, f) => (v(), E("div", {
895
905
  class: "tr-bubble-list",
896
906
  ref_key: "listRef",
897
- ref: o
907
+ ref: r
898
908
  }, [
899
- (v(!0), E(P, null, W(m.value, (r, d) => {
900
- var _;
901
- return v(), A(Vt, {
909
+ (v(!0), E(D, null, W(_.value, (s, d) => {
910
+ var g;
911
+ return v(), A(zt, {
902
912
  key: d,
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)
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", O({ ref_for: !0 }, b, {
913
- messageIndexes: r.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", O({ ref_for: !0 }, b, {
918
- messageIndexes: r.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", O({ ref_for: !0 }, b, {
923
- messageIndexes: r.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", O({ ref_for: !0 }, b, {
928
- messageIndexes: r.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__ */ N(zt, [["__scopeId", "data-v-1d84cbfe"]]), q = /* @__PURE__ */ I({
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((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({
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: a
955
- }), $t({
956
- contentRendererMatches: s,
964
+ fallbackBoxRenderer: l
965
+ }), wt({
966
+ contentRendererMatches: o,
957
967
  contentAttributes: () => e.contentAttributes,
958
968
  fallbackContentRenderer: i
959
- }), (o, l) => C(o.$slots, "default");
969
+ }), (r, a) => C(r.$slots, "default");
960
970
  }
961
- }), Xt = ["innerHTML"], qt = /* @__PURE__ */ I({
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), s = L(null);
978
+ const e = t, { contentText: n } = fe(e), o = M(null);
969
979
  xe(async () => {
970
- s.value = await Dt();
980
+ o.value = await Ut();
971
981
  });
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);
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
- }), (l, u) => o.value ? (v(), E("div", {
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: o.value
983
- }, null, 8, Xt)) : (v(), A(ce, D(O({ key: 1 }, e)), null, 16));
992
+ innerHTML: r.value
993
+ }, null, 8, qt)) : (v(), A(ce, P(w({ key: 1 }, e)), null, 16));
984
994
  }
985
- }), Zt = /* @__PURE__ */ N(qt, [["__scopeId", "data-v-eb1c196f"]]), ln = {
995
+ }), Qt = /* @__PURE__ */ O(Zt, [["__scopeId", "data-v-eb1c196f"]]), cn = {
986
996
  Box: le,
987
- Image: Ne,
988
- Loading: we,
989
- Markdown: Zt,
997
+ Image: Oe,
998
+ Loading: Ne,
999
+ Markdown: Qt,
990
1000
  Reasoning: Fe,
991
1001
  Text: ce,
992
- Tool: De,
993
- ToolRole: Pe,
1002
+ Tool: Pe,
1003
+ ToolRole: De,
994
1004
  Tools: Ue
995
1005
  };
996
1006
  Y.name = "TrBubble";
997
- const Qt = function(t) {
1007
+ const en = function(t) {
998
1008
  t.component(Y.name, Y);
999
1009
  };
1000
- Y.install = Qt;
1001
- const cn = Y;
1010
+ Y.install = en;
1011
+ const un = Y;
1002
1012
  X.name = "TrBubbleList";
1003
- const en = function(t) {
1013
+ const tn = function(t) {
1004
1014
  t.component(X.name, X);
1005
1015
  };
1006
- X.install = en;
1007
- const un = X;
1016
+ X.install = tn;
1017
+ const dn = X;
1008
1018
  q.name = "TrBubbleProvider";
1009
- const tn = function(t) {
1019
+ const nn = function(t) {
1010
1020
  t.component(q.name, q);
1011
1021
  };
1012
- q.install = tn;
1013
- const dn = q;
1022
+ q.install = nn;
1023
+ const bn = q;
1014
1024
  export {
1015
- cn as B,
1016
- un as a,
1017
- dn as b,
1025
+ un as B,
1026
+ dn as a,
1027
+ bn as b,
1018
1028
  K as c,
1019
- ln as d,
1020
- Lt as e,
1029
+ cn as d,
1030
+ $t as e,
1021
1031
  ue as f,
1022
1032
  ie as g,
1023
- an as h,
1033
+ ln as h,
1024
1034
  fe as i,
1025
1035
  je as j,
1026
- Ut as k,
1027
- ot as u
1036
+ Ht as k,
1037
+ rt as u
1028
1038
  };