@ibiz-template/mob-vue3-components 0.7.41-alpha.20 → 0.7.41-alpha.22

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 (397) hide show
  1. package/dist/ibiz-markdown-editor-COU_MxNu.js +2 -0
  2. package/dist/ibiz-markdown-editor-COU_MxNu.js.map +1 -0
  3. package/dist/index-Bn7VkqJp.js +76 -0
  4. package/dist/index-Bn7VkqJp.js.map +1 -0
  5. package/dist/index-ChdHGLJI.js +2 -0
  6. package/dist/index-ChdHGLJI.js.map +1 -0
  7. package/dist/index-Dd7yiMzY.js +2 -0
  8. package/dist/index-Dd7yiMzY.js.map +1 -0
  9. package/dist/index.es-D0mZvSDS.js +14 -0
  10. package/dist/index.es-D0mZvSDS.js.map +1 -0
  11. package/dist/index.min.css +2 -2
  12. package/dist/index.system.min.js +1 -1
  13. package/dist/{quill-COWm2ioZ.js → quill-BOA7ZLOz.js} +2 -2
  14. package/dist/{quill-COWm2ioZ.js.map → quill-BOA7ZLOz.js.map} +1 -1
  15. package/dist/{quill-editor-BwfQqajZ.js → quill-editor-DcZd_lqh.js} +2 -2
  16. package/dist/{quill-editor-BwfQqajZ.js.map → quill-editor-DcZd_lqh.js.map} +1 -1
  17. package/dist/quill-editor-preview-DghpeKpg.js +2 -0
  18. package/dist/quill-editor-preview-DghpeKpg.js.map +1 -0
  19. package/dist/{tree-CgxZzCGY.js → tree-BTa0bMPr.js} +2 -2
  20. package/dist/{tree-CgxZzCGY.js.map → tree-BTa0bMPr.js.map} +1 -1
  21. package/dist/xlsx-util-CQaOn5OK.js +105 -0
  22. package/dist/xlsx-util-CQaOn5OK.js.map +1 -0
  23. package/es/_virtual/FileSaver.min.mjs +3 -0
  24. package/es/_virtual/index12.mjs +2 -2
  25. package/es/_virtual/index14.mjs +2 -2
  26. package/es/common/action-group/action-group.css +1 -1
  27. package/es/common/action-toolbar/action-toolbar.css +1 -1
  28. package/es/common/add-btn/add-btn.css +1 -1
  29. package/es/common/button-list/button-list.css +1 -1
  30. package/es/common/cropping/cropping.css +1 -1
  31. package/es/common/date-range-picker/components/range-picker/range-picker.css +1 -1
  32. package/es/common/date-range-picker/components/single-picker/single-picker.css +1 -1
  33. package/es/common/date-range-picker/date-range-picker.css +1 -1
  34. package/es/common/emoji-select/components/categories/categories.css +1 -1
  35. package/es/common/emoji-select/components/category-label/category-label.css +1 -1
  36. package/es/common/emoji-select/components/emoji-item/emoji-item.css +1 -1
  37. package/es/common/emoji-select/components/emoji-list/emoji-list.css +1 -1
  38. package/es/common/emoji-select/emoji-select.css +1 -1
  39. package/es/common/fullscreen-header/fullscreen-header.css +1 -1
  40. package/es/common/md-advaned-searchform/md-advaned-searchform.css +1 -1
  41. package/es/common/md-sort-setting/md-sort-setting.css +1 -1
  42. package/es/common/preset-view-back/preset-view-back.css +1 -1
  43. package/es/common/rawitem/rawitem.css +1 -1
  44. package/es/common/split/split.css +1 -1
  45. package/es/common/split-trigger/split-trigger.css +1 -1
  46. package/es/common/tab-layout/tab-default-layout/tab-default-layout.css +1 -1
  47. package/es/common/tab-layout/tab-default-layout/tab-default-layout.mjs +1 -0
  48. package/es/common/tab-layout/tab-dropdown/tab-dropdown-list-content.css +1 -1
  49. package/es/common/tab-layout/tab-dropdown/tab-dropdown.css +1 -1
  50. package/es/common/tab-layout/tab-flow-layout/tab-flow-layout.css +1 -1
  51. package/es/common/tab-layout/tab-layout.css +1 -1
  52. package/es/common/tab-layout/tab-sidebar-layout/tab-sidebar-layout.css +1 -1
  53. package/es/common/view-message/view-message.mjs +1 -1
  54. package/es/control/app-menu/app-menu.css +1 -1
  55. package/es/control/app-menu/app-menu.mjs +2 -2
  56. package/es/control/app-menu-icon-view/app-menu-icon-view.css +1 -1
  57. package/es/control/app-menu-icon-view/app-menu-icon-view.mjs +2 -2
  58. package/es/control/app-menu-list-view/app-menu-list-view.css +1 -1
  59. package/es/control/calendar/calendar.css +1 -1
  60. package/es/control/calendar/calendar.mjs +1 -1
  61. package/es/control/caption-bar/caption-bar.css +1 -1
  62. package/es/control/dashboard/custom-dashboard-design/custom-dashboard-design.css +1 -1
  63. package/es/control/dashboard/dashboard.css +1 -1
  64. package/es/control/dashboard/portlet/portlet-layout/portlet-layout.css +1 -1
  65. package/es/control/dashboard/portlet/portlet-layout/portlet-layout.mjs +4 -1
  66. package/es/control/data-view/data-view.css +1 -1
  67. package/es/control/drbar/drbar.css +1 -1
  68. package/es/control/drtab/drtab.controller.mjs +1 -1
  69. package/es/control/drtab/drtab.css +1 -1
  70. package/es/control/form/edit-form/edit-form.css +1 -1
  71. package/es/control/form/form/form.css +1 -1
  72. package/es/control/form/form-detail/form-button/form-button.css +1 -1
  73. package/es/control/form/form-detail/form-button-list/form-button-list.css +1 -1
  74. package/es/control/form/form-detail/form-druipart/form-druipart.css +1 -1
  75. package/es/control/form/form-detail/form-group-panel/form-group-panel.css +1 -1
  76. package/es/control/form/form-detail/form-item/form-item-container/form-item-container.css +1 -1
  77. package/es/control/form/form-detail/form-item/form-item-container/form-item-container.mjs +3 -3
  78. package/es/control/form/form-detail/form-item/form-item.css +1 -1
  79. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.css +0 -1
  80. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.mjs +2 -19
  81. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-md/form-mdctrl-md.css +1 -1
  82. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.mjs +7 -0
  83. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.css +1 -0
  84. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.mjs +239 -0
  85. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-single-form/repeater-single-form.css +1 -1
  86. package/es/control/form/form-detail/form-mdctrl/form-mdctrl.css +1 -1
  87. package/es/control/form/form-detail/form-mdctrl/mdctrl-container/mdctrl-container.css +1 -1
  88. package/es/control/form/form-detail/form-page/form-page-item/form-page-item.css +1 -1
  89. package/es/control/form/form-detail/form-page/form-page.css +1 -1
  90. package/es/control/form/form-detail/form-tab-panel/form-tab-panel.css +1 -1
  91. package/es/control/list/list/list.css +0 -1
  92. package/es/control/list/list/list.mjs +20 -121
  93. package/es/control/list/md-ctrl/md-ctrl.css +1 -1
  94. package/es/control/search-bar/filter-tree/filter-tree.css +1 -1
  95. package/es/control/search-bar/search-bar.css +1 -1
  96. package/es/control/tab-exp-panel/tab-exp-panel.css +1 -1
  97. package/es/control/toolbar/toolbar-render-util.mjs +4 -0
  98. package/es/control/toolbar/toolbar.css +1 -1
  99. package/es/control/tree/tree.css +1 -1
  100. package/es/control/wizard-panel/wizard-panel.css +1 -1
  101. package/es/editor/array/ibiz-array/ibiz-array.css +1 -1
  102. package/es/editor/cascader/ibiz-cascader/ibiz-cascader.css +1 -1
  103. package/es/editor/check-box/ibiz-checkbox/ibiz-checkbox.css +1 -1
  104. package/es/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.css +1 -1
  105. package/es/editor/color-picker/ibiz-color-picker/ibiz-color-picker.css +1 -1
  106. package/es/editor/common/data-mpicker/ibiz-data-mpicker.css +1 -1
  107. package/es/editor/common/right-icon/right-icon.css +1 -1
  108. package/es/editor/data-picker/ibiz-mpicker/ibiz-mpicker.css +1 -1
  109. package/es/editor/data-picker/ibiz-picker/ibiz-picker.css +1 -1
  110. package/es/editor/data-picker/ibiz-picker/ibiz-picker.mjs +2 -2
  111. package/es/editor/data-picker/ibiz-picker-select-view/ibiz-picker-select-view.css +1 -1
  112. package/es/editor/data-picker/ibiz-picker-select-view/ibiz-picker-select-view.mjs +1 -1
  113. package/es/editor/data-picker/picker-editor.controller.mjs +1 -1
  114. package/es/editor/date-picker/ibiz-date-picker/ibiz-date-picker.css +1 -1
  115. package/es/editor/date-range/ibiz-date-range-picker/ibiz-date-range-picker.css +1 -1
  116. package/es/editor/dropdown-list/ibiz-cascader-dropdown/ibiz-cascader-dropdown.css +1 -1
  117. package/es/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.css +1 -1
  118. package/es/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.mjs +18 -9
  119. package/es/editor/dropdown-list/ibiz-dropdown-list/ibiz-dropdown-list.css +1 -1
  120. package/es/editor/dropdown-list/ibiz-dropdown-list/ibiz-dropdown-list.mjs +8 -1
  121. package/es/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.css +1 -1
  122. package/es/editor/html/quill-editor/quill-editor.css +1 -1
  123. package/es/editor/html/quill-editor-preview/quill-editor-preview.css +1 -1
  124. package/es/editor/html/quill-editor-preview/quill-editor-preview.mjs +4 -3
  125. package/es/editor/map-picker/ibiz-map-picker/ibiz-map-picker.css +1 -1
  126. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
  127. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +3 -1
  128. package/es/editor/not-supported-editor/not-supported-editor.css +1 -1
  129. package/es/editor/number-range/ibiz-number-range-picker/ibiz-number-range-picker.css +1 -1
  130. package/es/editor/qrcode/ibiz-qrcode/ibiz-qrcode.css +1 -1
  131. package/es/editor/radio-button-list/ibiz-radio/ibiz-radio.css +1 -1
  132. package/es/editor/rate/ibiz-rate/ibiz-rate.css +1 -1
  133. package/es/editor/raw/ibiz-raw/ibiz-raw.css +1 -1
  134. package/es/editor/slider/ibiz-slider/ibiz-slider.css +1 -1
  135. package/es/editor/span/span/span.css +1 -1
  136. package/es/editor/span/span-link/span-link.css +1 -1
  137. package/es/editor/stepper/ibiz-stepper/ibiz-stepper.css +1 -1
  138. package/es/editor/switch/ibiz-switch/ibiz-switch.css +1 -1
  139. package/es/editor/text-box/ibiz-input-number/ibiz-input-number.css +1 -1
  140. package/es/editor/text-box/ibiz-input-number/ibiz-input-number.mjs +1 -1
  141. package/es/editor/text-box/input/input.css +1 -1
  142. package/es/editor/text-box/input/input.mjs +33 -2
  143. package/es/editor/text-box/signature/signature.css +1 -1
  144. package/es/editor/text-box/signature/signature.mjs +1 -1
  145. package/es/editor/upload/ibiz-file-upload/ibiz-file-upload.css +1 -1
  146. package/es/editor/upload/ibiz-file-upload/ibiz-file-upload.mjs +1 -1
  147. package/es/editor/upload/ibiz-image-cropping/ibiz-image-cropping.css +1 -1
  148. package/es/editor/upload/ibiz-image-select/ibiz-image-select.css +1 -1
  149. package/es/editor/upload/ibiz-image-upload/ibiz-image-upload.css +1 -1
  150. package/es/ibiz-vue3.mjs +1 -0
  151. package/es/index.mjs +3 -0
  152. package/es/locale/en/index.mjs +32 -0
  153. package/es/locale/zh-CN/index.mjs +35 -1
  154. package/es/mob-app/components/modal-router-shell/modal-router-shell.mjs +2 -2
  155. package/es/mob-app/guard/auth-guard/auth-guard.mjs +206 -194
  156. package/es/mob-app/guard/auth-guard/dyna-auth-guard.mjs +65 -0
  157. package/es/mob-app/guard/index.mjs +1 -0
  158. package/es/mob-app/index.mjs +1 -0
  159. package/es/mob-app/main.mjs +14 -1
  160. package/es/mob-app/router/index.mjs +6 -4
  161. package/es/node_modules/.pnpm/@amap_amap-jsapi-loader@1.0.1_patch_hash_73bpcwbs2m5ip4qppmz6a7epsa/node_modules/@amap/amap-jsapi-loader/dist/index.mjs +1 -1
  162. package/es/node_modules/.pnpm/@ibiz-template-plugin_ibiz-mob-ai-chat@0.0.1_cherry-markdown@0.8.58_interactjs@1.10.27_qx-uti_xgmgjpxet4ghyc7txs4jkjxilq/node_modules/@ibiz-template-plugin/ibiz-mob-ai-chat/dist/index.es.mjs +4425 -0
  163. package/es/node_modules/.pnpm/dingtalk-jsapi@3.2.0/node_modules/dingtalk-jsapi/lib/packages/frame-talk-client-pc/index.mjs +1 -1
  164. package/es/node_modules/.pnpm/file-saver@2.0.5/node_modules/file-saver/dist/FileSaver.min.mjs +15 -0
  165. package/es/node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx.mjs +24580 -0
  166. package/es/panel-component/async-action/async-action/async-action.css +1 -1
  167. package/es/panel-component/async-action/async-action-preview/async-action-preview.css +1 -1
  168. package/es/panel-component/async-action/async-action-tab/async-action-tab.css +1 -1
  169. package/es/panel-component/async-action/mob-async-action.css +1 -1
  170. package/es/panel-component/auth-sso/auth-sso.css +1 -1
  171. package/es/panel-component/auth-userinfo/auth-userinfo.css +1 -1
  172. package/es/panel-component/index.mjs +2 -0
  173. package/es/panel-component/panel-app-title/panel-app-title.css +1 -1
  174. package/es/panel-component/panel-button/panel-button.css +1 -1
  175. package/es/panel-component/panel-tab-panel/panel-tab-panel.css +1 -1
  176. package/es/panel-component/setting-container/setting-container.css +1 -1
  177. package/es/panel-component/theme-toggling/index.mjs +15 -0
  178. package/es/panel-component/theme-toggling/theme-toggling.controller.mjs +90 -0
  179. package/es/panel-component/theme-toggling/theme-toggling.css +1 -0
  180. package/es/panel-component/theme-toggling/theme-toggling.mjs +72 -0
  181. package/es/panel-component/theme-toggling/theme-toggling.provider.mjs +21 -0
  182. package/es/panel-component/theme-toggling/theme-toggling.state.mjs +22 -0
  183. package/es/panel-component/user-message/common/internal-message-container/internal-message-container.css +1 -1
  184. package/es/panel-component/user-message/common/internal-message-default/internal-message-default.css +1 -1
  185. package/es/panel-component/user-message/internal-message-text/internal-message-text.css +1 -1
  186. package/es/panel-component/user-message/user-message.css +1 -1
  187. package/es/panel-component/view-content-panel-container/view-content-panel-container.css +1 -1
  188. package/es/panel-component/view-content-panel-container/view-content-panel-container.mjs +18 -4
  189. package/es/panel-component/view-header-panel-container/view-header-panel-container.css +1 -1
  190. package/es/panel-component/wf-action-button/wf-action-button.css +1 -1
  191. package/es/panel-component/wf-step-trace/wf-step-trace.css +1 -1
  192. package/es/util/ai-chat-util/ai-chat-util.mjs +932 -0
  193. package/es/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
  194. package/es/util/ai-chat-util/ai-feedback/ai-feedback.mjs +140 -0
  195. package/es/util/app-drawer/app-drawer-component.mjs +7 -17
  196. package/es/util/app-modal/app-modal-component.mjs +4 -2
  197. package/es/util/app-util/app-util.mjs +76 -6
  198. package/es/util/index.mjs +2 -0
  199. package/es/util/list-util/list-render-util.mjs +1 -2
  200. package/es/util/user-route-util/user-route-util.mjs +55 -0
  201. package/es/util/xlsx-util/xlsx-util.mjs +163 -0
  202. package/es/view/portal-view/portal-view.mjs +3 -2
  203. package/es/view-engine/mob-calendar-view.engine.mjs +4 -0
  204. package/es/view-engine/mob-pickup-md-view.engine.mjs +1 -0
  205. package/lib/_virtual/FileSaver.min.cjs +5 -0
  206. package/lib/_virtual/index12.cjs +2 -2
  207. package/lib/_virtual/index14.cjs +2 -2
  208. package/lib/common/action-group/action-group.css +1 -1
  209. package/lib/common/action-toolbar/action-toolbar.css +1 -1
  210. package/lib/common/add-btn/add-btn.css +1 -1
  211. package/lib/common/button-list/button-list.css +1 -1
  212. package/lib/common/cropping/cropping.css +1 -1
  213. package/lib/common/date-range-picker/components/range-picker/range-picker.css +1 -1
  214. package/lib/common/date-range-picker/components/single-picker/single-picker.css +1 -1
  215. package/lib/common/date-range-picker/date-range-picker.css +1 -1
  216. package/lib/common/emoji-select/components/categories/categories.css +1 -1
  217. package/lib/common/emoji-select/components/category-label/category-label.css +1 -1
  218. package/lib/common/emoji-select/components/emoji-item/emoji-item.css +1 -1
  219. package/lib/common/emoji-select/components/emoji-list/emoji-list.css +1 -1
  220. package/lib/common/emoji-select/emoji-select.css +1 -1
  221. package/lib/common/fullscreen-header/fullscreen-header.css +1 -1
  222. package/lib/common/md-advaned-searchform/md-advaned-searchform.css +1 -1
  223. package/lib/common/md-sort-setting/md-sort-setting.css +1 -1
  224. package/lib/common/preset-view-back/preset-view-back.css +1 -1
  225. package/lib/common/rawitem/rawitem.css +1 -1
  226. package/lib/common/split/split.css +1 -1
  227. package/lib/common/split-trigger/split-trigger.css +1 -1
  228. package/lib/common/tab-layout/tab-default-layout/tab-default-layout.cjs +1 -0
  229. package/lib/common/tab-layout/tab-default-layout/tab-default-layout.css +1 -1
  230. package/lib/common/tab-layout/tab-dropdown/tab-dropdown-list-content.css +1 -1
  231. package/lib/common/tab-layout/tab-dropdown/tab-dropdown.css +1 -1
  232. package/lib/common/tab-layout/tab-flow-layout/tab-flow-layout.css +1 -1
  233. package/lib/common/tab-layout/tab-layout.css +1 -1
  234. package/lib/common/tab-layout/tab-sidebar-layout/tab-sidebar-layout.css +1 -1
  235. package/lib/common/view-message/view-message.cjs +1 -1
  236. package/lib/control/app-menu/app-menu.cjs +2 -2
  237. package/lib/control/app-menu/app-menu.css +1 -1
  238. package/lib/control/app-menu-icon-view/app-menu-icon-view.cjs +2 -2
  239. package/lib/control/app-menu-icon-view/app-menu-icon-view.css +1 -1
  240. package/lib/control/app-menu-list-view/app-menu-list-view.css +1 -1
  241. package/lib/control/calendar/calendar.cjs +1 -1
  242. package/lib/control/calendar/calendar.css +1 -1
  243. package/lib/control/caption-bar/caption-bar.css +1 -1
  244. package/lib/control/dashboard/custom-dashboard-design/custom-dashboard-design.css +1 -1
  245. package/lib/control/dashboard/dashboard.css +1 -1
  246. package/lib/control/dashboard/portlet/portlet-layout/portlet-layout.cjs +4 -1
  247. package/lib/control/dashboard/portlet/portlet-layout/portlet-layout.css +1 -1
  248. package/lib/control/data-view/data-view.css +1 -1
  249. package/lib/control/drbar/drbar.css +1 -1
  250. package/lib/control/drtab/drtab.controller.cjs +1 -1
  251. package/lib/control/drtab/drtab.css +1 -1
  252. package/lib/control/form/edit-form/edit-form.css +1 -1
  253. package/lib/control/form/form/form.css +1 -1
  254. package/lib/control/form/form-detail/form-button/form-button.css +1 -1
  255. package/lib/control/form/form-detail/form-button-list/form-button-list.css +1 -1
  256. package/lib/control/form/form-detail/form-druipart/form-druipart.css +1 -1
  257. package/lib/control/form/form-detail/form-group-panel/form-group-panel.css +1 -1
  258. package/lib/control/form/form-detail/form-item/form-item-container/form-item-container.cjs +3 -3
  259. package/lib/control/form/form-detail/form-item/form-item-container/form-item-container.css +1 -1
  260. package/lib/control/form/form-detail/form-item/form-item.css +1 -1
  261. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.cjs +1 -18
  262. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.css +0 -1
  263. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-md/form-mdctrl-md.css +1 -1
  264. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.cjs +7 -0
  265. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.cjs +241 -0
  266. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.css +1 -0
  267. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-single-form/repeater-single-form.css +1 -1
  268. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl.css +1 -1
  269. package/lib/control/form/form-detail/form-mdctrl/mdctrl-container/mdctrl-container.css +1 -1
  270. package/lib/control/form/form-detail/form-page/form-page-item/form-page-item.css +1 -1
  271. package/lib/control/form/form-detail/form-page/form-page.css +1 -1
  272. package/lib/control/form/form-detail/form-tab-panel/form-tab-panel.css +1 -1
  273. package/lib/control/list/list/list.cjs +19 -120
  274. package/lib/control/list/list/list.css +0 -1
  275. package/lib/control/list/md-ctrl/md-ctrl.css +1 -1
  276. package/lib/control/search-bar/filter-tree/filter-tree.css +1 -1
  277. package/lib/control/search-bar/search-bar.css +1 -1
  278. package/lib/control/tab-exp-panel/tab-exp-panel.css +1 -1
  279. package/lib/control/toolbar/toolbar-render-util.cjs +4 -0
  280. package/lib/control/toolbar/toolbar.css +1 -1
  281. package/lib/control/tree/tree.css +1 -1
  282. package/lib/control/wizard-panel/wizard-panel.css +1 -1
  283. package/lib/editor/array/ibiz-array/ibiz-array.css +1 -1
  284. package/lib/editor/cascader/ibiz-cascader/ibiz-cascader.css +1 -1
  285. package/lib/editor/check-box/ibiz-checkbox/ibiz-checkbox.css +1 -1
  286. package/lib/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.css +1 -1
  287. package/lib/editor/color-picker/ibiz-color-picker/ibiz-color-picker.css +1 -1
  288. package/lib/editor/common/data-mpicker/ibiz-data-mpicker.css +1 -1
  289. package/lib/editor/common/right-icon/right-icon.css +1 -1
  290. package/lib/editor/data-picker/ibiz-mpicker/ibiz-mpicker.css +1 -1
  291. package/lib/editor/data-picker/ibiz-picker/ibiz-picker.cjs +2 -2
  292. package/lib/editor/data-picker/ibiz-picker/ibiz-picker.css +1 -1
  293. package/lib/editor/data-picker/ibiz-picker-select-view/ibiz-picker-select-view.cjs +1 -1
  294. package/lib/editor/data-picker/ibiz-picker-select-view/ibiz-picker-select-view.css +1 -1
  295. package/lib/editor/data-picker/picker-editor.controller.cjs +1 -1
  296. package/lib/editor/date-picker/ibiz-date-picker/ibiz-date-picker.css +1 -1
  297. package/lib/editor/date-range/ibiz-date-range-picker/ibiz-date-range-picker.css +1 -1
  298. package/lib/editor/dropdown-list/ibiz-cascader-dropdown/ibiz-cascader-dropdown.css +1 -1
  299. package/lib/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.cjs +18 -9
  300. package/lib/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.css +1 -1
  301. package/lib/editor/dropdown-list/ibiz-dropdown-list/ibiz-dropdown-list.cjs +8 -1
  302. package/lib/editor/dropdown-list/ibiz-dropdown-list/ibiz-dropdown-list.css +1 -1
  303. package/lib/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.css +1 -1
  304. package/lib/editor/html/quill-editor/quill-editor.css +1 -1
  305. package/lib/editor/html/quill-editor-preview/quill-editor-preview.cjs +4 -3
  306. package/lib/editor/html/quill-editor-preview/quill-editor-preview.css +1 -1
  307. package/lib/editor/map-picker/ibiz-map-picker/ibiz-map-picker.css +1 -1
  308. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +3 -1
  309. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
  310. package/lib/editor/not-supported-editor/not-supported-editor.css +1 -1
  311. package/lib/editor/number-range/ibiz-number-range-picker/ibiz-number-range-picker.css +1 -1
  312. package/lib/editor/qrcode/ibiz-qrcode/ibiz-qrcode.css +1 -1
  313. package/lib/editor/radio-button-list/ibiz-radio/ibiz-radio.css +1 -1
  314. package/lib/editor/rate/ibiz-rate/ibiz-rate.css +1 -1
  315. package/lib/editor/raw/ibiz-raw/ibiz-raw.css +1 -1
  316. package/lib/editor/slider/ibiz-slider/ibiz-slider.css +1 -1
  317. package/lib/editor/span/span/span.css +1 -1
  318. package/lib/editor/span/span-link/span-link.css +1 -1
  319. package/lib/editor/stepper/ibiz-stepper/ibiz-stepper.css +1 -1
  320. package/lib/editor/switch/ibiz-switch/ibiz-switch.css +1 -1
  321. package/lib/editor/text-box/ibiz-input-number/ibiz-input-number.cjs +1 -1
  322. package/lib/editor/text-box/ibiz-input-number/ibiz-input-number.css +1 -1
  323. package/lib/editor/text-box/input/input.cjs +32 -1
  324. package/lib/editor/text-box/input/input.css +1 -1
  325. package/lib/editor/text-box/signature/signature.cjs +1 -1
  326. package/lib/editor/text-box/signature/signature.css +1 -1
  327. package/lib/editor/upload/ibiz-file-upload/ibiz-file-upload.cjs +1 -1
  328. package/lib/editor/upload/ibiz-file-upload/ibiz-file-upload.css +1 -1
  329. package/lib/editor/upload/ibiz-image-cropping/ibiz-image-cropping.css +1 -1
  330. package/lib/editor/upload/ibiz-image-select/ibiz-image-select.css +1 -1
  331. package/lib/editor/upload/ibiz-image-upload/ibiz-image-upload.css +1 -1
  332. package/lib/ibiz-vue3.cjs +1 -0
  333. package/lib/index.cjs +7 -0
  334. package/lib/locale/en/index.cjs +32 -0
  335. package/lib/locale/zh-CN/index.cjs +35 -1
  336. package/lib/mob-app/components/modal-router-shell/modal-router-shell.cjs +2 -2
  337. package/lib/mob-app/guard/auth-guard/auth-guard.cjs +206 -194
  338. package/lib/mob-app/guard/auth-guard/dyna-auth-guard.cjs +67 -0
  339. package/lib/mob-app/guard/index.cjs +2 -0
  340. package/lib/mob-app/index.cjs +2 -0
  341. package/lib/mob-app/main.cjs +14 -1
  342. package/lib/mob-app/router/index.cjs +6 -4
  343. package/lib/node_modules/.pnpm/@amap_amap-jsapi-loader@1.0.1_patch_hash_73bpcwbs2m5ip4qppmz6a7epsa/node_modules/@amap/amap-jsapi-loader/dist/index.cjs +1 -1
  344. package/lib/node_modules/.pnpm/@ibiz-template-plugin_ibiz-mob-ai-chat@0.0.1_cherry-markdown@0.8.58_interactjs@1.10.27_qx-uti_xgmgjpxet4ghyc7txs4jkjxilq/node_modules/@ibiz-template-plugin/ibiz-mob-ai-chat/dist/index.es.cjs +4427 -0
  345. package/lib/node_modules/.pnpm/dingtalk-jsapi@3.2.0/node_modules/dingtalk-jsapi/lib/packages/frame-talk-client-pc/index.cjs +1 -1
  346. package/lib/node_modules/.pnpm/file-saver@2.0.5/node_modules/file-saver/dist/FileSaver.min.cjs +20 -0
  347. package/lib/node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx.cjs +24599 -0
  348. package/lib/panel-component/async-action/async-action/async-action.css +1 -1
  349. package/lib/panel-component/async-action/async-action-preview/async-action-preview.css +1 -1
  350. package/lib/panel-component/async-action/async-action-tab/async-action-tab.css +1 -1
  351. package/lib/panel-component/async-action/mob-async-action.css +1 -1
  352. package/lib/panel-component/auth-sso/auth-sso.css +1 -1
  353. package/lib/panel-component/auth-userinfo/auth-userinfo.css +1 -1
  354. package/lib/panel-component/index.cjs +44 -42
  355. package/lib/panel-component/panel-app-title/panel-app-title.css +1 -1
  356. package/lib/panel-component/panel-button/panel-button.css +1 -1
  357. package/lib/panel-component/panel-tab-panel/panel-tab-panel.css +1 -1
  358. package/lib/panel-component/setting-container/setting-container.css +1 -1
  359. package/lib/panel-component/theme-toggling/index.cjs +20 -0
  360. package/lib/panel-component/theme-toggling/theme-toggling.cjs +74 -0
  361. package/lib/panel-component/theme-toggling/theme-toggling.controller.cjs +92 -0
  362. package/lib/panel-component/theme-toggling/theme-toggling.css +1 -0
  363. package/lib/panel-component/theme-toggling/theme-toggling.provider.cjs +23 -0
  364. package/lib/panel-component/theme-toggling/theme-toggling.state.cjs +24 -0
  365. package/lib/panel-component/user-message/common/internal-message-container/internal-message-container.css +1 -1
  366. package/lib/panel-component/user-message/common/internal-message-default/internal-message-default.css +1 -1
  367. package/lib/panel-component/user-message/internal-message-text/internal-message-text.css +1 -1
  368. package/lib/panel-component/user-message/user-message.css +1 -1
  369. package/lib/panel-component/view-content-panel-container/view-content-panel-container.cjs +18 -4
  370. package/lib/panel-component/view-content-panel-container/view-content-panel-container.css +1 -1
  371. package/lib/panel-component/view-header-panel-container/view-header-panel-container.css +1 -1
  372. package/lib/panel-component/wf-action-button/wf-action-button.css +1 -1
  373. package/lib/panel-component/wf-step-trace/wf-step-trace.css +1 -1
  374. package/lib/util/ai-chat-util/ai-chat-util.cjs +934 -0
  375. package/lib/util/ai-chat-util/ai-feedback/ai-feedback.cjs +142 -0
  376. package/lib/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
  377. package/lib/util/app-drawer/app-drawer-component.cjs +7 -17
  378. package/lib/util/app-modal/app-modal-component.cjs +4 -2
  379. package/lib/util/app-util/app-util.cjs +75 -5
  380. package/lib/util/index.cjs +5 -0
  381. package/lib/util/list-util/list-render-util.cjs +1 -2
  382. package/lib/util/user-route-util/user-route-util.cjs +58 -0
  383. package/lib/util/xlsx-util/xlsx-util.cjs +166 -0
  384. package/lib/view/portal-view/portal-view.cjs +3 -2
  385. package/lib/view-engine/mob-calendar-view.engine.cjs +4 -0
  386. package/lib/view-engine/mob-pickup-md-view.engine.cjs +1 -0
  387. package/package.json +12 -9
  388. package/dist/ibiz-markdown-editor-DMe7ZdYW.js +0 -2
  389. package/dist/ibiz-markdown-editor-DMe7ZdYW.js.map +0 -1
  390. package/dist/index-B0eDJ8A4.js +0 -2
  391. package/dist/index-B0eDJ8A4.js.map +0 -1
  392. package/dist/index-FB2X3Nyy.js +0 -76
  393. package/dist/index-FB2X3Nyy.js.map +0 -1
  394. package/dist/index-nqcMxJEO.js +0 -2
  395. package/dist/index-nqcMxJEO.js.map +0 -1
  396. package/dist/quill-editor-preview-Bj3EE5LD.js +0 -2
  397. package/dist/quill-editor-preview-Bj3EE5LD.js.map +0 -1
@@ -0,0 +1,4427 @@
1
+ 'use strict';
2
+
3
+ require('./style.css');
4
+ var vue = require('vue');
5
+ var qxUtil = require('qx-util');
6
+ var Vant = require('vant');
7
+ var Cherry = require('cherry-markdown');
8
+
9
+ var de = Object.defineProperty;
10
+ var pe = (a, e, t) => e in a ? de(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
11
+ var v = (a, e, t) => (pe(a, typeof e != "symbol" ? e + "" : e, t), t);
12
+ const we = "ibiz", ye = "is-";
13
+ function O(a, e, t, s, i) {
14
+ let o = "".concat(a, "-").concat(e);
15
+ return t && (o += "-".concat(t)), s && (o += "__".concat(s)), i && (o += "--".concat(i)), o;
16
+ }
17
+ class A {
18
+ /**
19
+ * Creates an instance of Namespace.
20
+ *
21
+ * @author chitanda
22
+ * @date 2022-09-06 12:09:12
23
+ * @param {string} block 当前命名空间的根模块,例如组件的名称
24
+ * @param {string} [namespace] 指定命名空间,未指定使用默认值 ibiz
25
+ */
26
+ constructor(e, t) {
27
+ /**
28
+ * 命名空间
29
+ *
30
+ * @author chitanda
31
+ * @date 2023-11-03 10:11:31
32
+ * @type {string}
33
+ */
34
+ v(this, "namespace");
35
+ this.block = e, this.namespace = t || we;
36
+ }
37
+ /**
38
+ * namespace-block
39
+ * namespace-block-blockSuffix
40
+ *
41
+ * @author chitanda
42
+ * @date 2022-09-06 12:09:08
43
+ * @param {string} [blockSuffix='']
44
+ * @return {*} {string}
45
+ */
46
+ b(e = "") {
47
+ return O(this.namespace, this.block, e, "", "");
48
+ }
49
+ /**
50
+ * namespace-block__element
51
+ *
52
+ * @author chitanda
53
+ * @date 2022-09-06 12:09:48
54
+ * @param {string} [element]
55
+ * @return {*} {string}
56
+ */
57
+ e(e) {
58
+ return e ? O(this.namespace, this.block, "", e, "") : "";
59
+ }
60
+ /**
61
+ * namespace-block--modifier
62
+ *
63
+ * @author chitanda
64
+ * @date 2022-09-06 12:09:37
65
+ * @param {string} [modifier]
66
+ * @return {*} {string}
67
+ */
68
+ m(e) {
69
+ return e ? O(this.namespace, this.block, "", "", e) : "";
70
+ }
71
+ /**
72
+ * namespace-block-blockSuffix__element
73
+ *
74
+ * @author chitanda
75
+ * @date 2022-09-06 12:09:52
76
+ * @param {string} [blockSuffix]
77
+ * @param {string} [element]
78
+ * @return {*} {string}
79
+ */
80
+ be(e, t) {
81
+ return e && t ? O(this.namespace, this.block, e, t, "") : "";
82
+ }
83
+ /**
84
+ * namespace-block__element--modifier
85
+ *
86
+ * @author chitanda
87
+ * @date 2022-09-06 12:09:19
88
+ * @param {string} [element]
89
+ * @param {string} [modifier]
90
+ * @return {*} {string}
91
+ */
92
+ em(e, t) {
93
+ return e && t ? O(this.namespace, this.block, "", e, t) : "";
94
+ }
95
+ /**
96
+ * namespace-block-blockSuffix--modifier
97
+ *
98
+ * @author chitanda
99
+ * @date 2022-09-06 12:09:59
100
+ * @param {string} [blockSuffix]
101
+ * @param {string} [modifier]
102
+ * @return {*} {string}
103
+ */
104
+ bm(e, t) {
105
+ return e && t ? O(this.namespace, this.block, e, "", t) : "";
106
+ }
107
+ /**
108
+ * namespace-block-blockSuffix__element--modifier
109
+ *
110
+ * @author chitanda
111
+ * @date 2022-09-06 12:09:37
112
+ * @param {string} [blockSuffix]
113
+ * @param {string} [element]
114
+ * @param {string} [modifier]
115
+ * @return {*} {string}
116
+ */
117
+ bem(e, t, s) {
118
+ return e && t && s ? O(this.namespace, this.block, e, t, s) : "";
119
+ }
120
+ /**
121
+ * 返回状态 class
122
+ *
123
+ * is('loading', false) => '';
124
+ * is('loading', true) => 'is-loading';
125
+ *
126
+ * @author chitanda
127
+ * @date 2022-09-06 12:09:57
128
+ * @param {string} name
129
+ * @param {boolean} [state]
130
+ * @return {*} {string}
131
+ */
132
+ is(e, t) {
133
+ return e && t ? "".concat(ye).concat(e) : "";
134
+ }
135
+ /**
136
+ * 生成使用到的 css 变量 style 对象
137
+ *
138
+ * @author chitanda
139
+ * @date 2022-09-06 15:09:41
140
+ * @param {Record<string, string>} object
141
+ * @return {*} {Record<string, string>}
142
+ */
143
+ cssVar(e) {
144
+ const t = {};
145
+ for (const s in e)
146
+ e[s] && (t[this.cssVarName(s)] = e[s]);
147
+ return t;
148
+ }
149
+ /**
150
+ * 生成使用到的 css block 变量 style 对象
151
+ *
152
+ * @author chitanda
153
+ * @date 2022-09-06 15:09:03
154
+ * @param {Record<string, string>} object
155
+ * @return {*} {Record<string, string>}
156
+ */
157
+ cssVarBlock(e) {
158
+ const t = {};
159
+ for (const s in e)
160
+ e[s] && (t[this.cssVarBlockName(s)] = e[s]);
161
+ return t;
162
+ }
163
+ /**
164
+ * 生成 css var 变量名称
165
+ *
166
+ * @author chitanda
167
+ * @date 2022-09-06 15:09:21
168
+ * @param {string} name
169
+ * @return {*} {string}
170
+ */
171
+ cssVarName(e) {
172
+ return "--".concat(this.namespace, "-").concat(e);
173
+ }
174
+ /**
175
+ * 生成块 css var 变量名称
176
+ *
177
+ * @author chitanda
178
+ * @date 2022-09-06 15:09:35
179
+ * @param {string} name
180
+ * @return {*} {string}
181
+ */
182
+ cssVarBlockName(e) {
183
+ return "--".concat(this.namespace, "-").concat(this.block, "-").concat(e);
184
+ }
185
+ }
186
+ function M(a) {
187
+ if (typeof a != "string")
188
+ throw new TypeError("Path must be a string. Received " + JSON.stringify(a));
189
+ }
190
+ function J(a, e) {
191
+ for (var t = "", s = 0, i = -1, o = 0, n, l = 0; l <= a.length; ++l) {
192
+ if (l < a.length)
193
+ n = a.charCodeAt(l);
194
+ else {
195
+ if (n === 47)
196
+ break;
197
+ n = 47;
198
+ }
199
+ if (n === 47) {
200
+ if (!(i === l - 1 || o === 1))
201
+ if (i !== l - 1 && o === 2) {
202
+ if (t.length < 2 || s !== 2 || t.charCodeAt(t.length - 1) !== 46 || t.charCodeAt(t.length - 2) !== 46) {
203
+ if (t.length > 2) {
204
+ var h = t.lastIndexOf("/");
205
+ if (h !== t.length - 1) {
206
+ h === -1 ? (t = "", s = 0) : (t = t.slice(0, h), s = t.length - 1 - t.lastIndexOf("/")), i = l, o = 0;
207
+ continue;
208
+ }
209
+ } else if (t.length === 2 || t.length === 1) {
210
+ t = "", s = 0, i = l, o = 0;
211
+ continue;
212
+ }
213
+ }
214
+ e && (t.length > 0 ? t += "/.." : t = "..", s = 2);
215
+ } else
216
+ t.length > 0 ? t += "/" + a.slice(i + 1, l) : t = a.slice(i + 1, l), s = l - i - 1;
217
+ i = l, o = 0;
218
+ } else
219
+ n === 46 && o !== -1 ? ++o : o = -1;
220
+ }
221
+ return t;
222
+ }
223
+ function Te(a, e) {
224
+ var t = e.dir || e.root, s = e.base || (e.name || "") + (e.ext || "");
225
+ return t ? t === e.root ? t + s : t + a + s : s;
226
+ }
227
+ var R = {
228
+ // path.resolve([from ...], to)
229
+ resolve: function() {
230
+ for (var e = "", t = !1, s, i = arguments.length - 1; i >= -1 && !t; i--) {
231
+ var o;
232
+ i >= 0 ? o = arguments[i] : (s === void 0 && (s = process.cwd()), o = s), M(o), o.length !== 0 && (e = o + "/" + e, t = o.charCodeAt(0) === 47);
233
+ }
234
+ return e = J(e, !t), t ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : ".";
235
+ },
236
+ normalize: function(e) {
237
+ if (M(e), e.length === 0)
238
+ return ".";
239
+ var t = e.charCodeAt(0) === 47, s = e.charCodeAt(e.length - 1) === 47;
240
+ return e = J(e, !t), e.length === 0 && !t && (e = "."), e.length > 0 && s && (e += "/"), t ? "/" + e : e;
241
+ },
242
+ isAbsolute: function(e) {
243
+ return M(e), e.length > 0 && e.charCodeAt(0) === 47;
244
+ },
245
+ join: function() {
246
+ if (arguments.length === 0)
247
+ return ".";
248
+ for (var e, t = 0; t < arguments.length; ++t) {
249
+ var s = arguments[t];
250
+ M(s), s.length > 0 && (e === void 0 ? e = s : e += "/" + s);
251
+ }
252
+ return e === void 0 ? "." : R.normalize(e);
253
+ },
254
+ relative: function(e, t) {
255
+ if (M(e), M(t), e === t || (e = R.resolve(e), t = R.resolve(t), e === t))
256
+ return "";
257
+ for (var s = 1; s < e.length && e.charCodeAt(s) === 47; ++s)
258
+ ;
259
+ for (var i = e.length, o = i - s, n = 1; n < t.length && t.charCodeAt(n) === 47; ++n)
260
+ ;
261
+ for (var l = t.length, h = l - n, c = o < h ? o : h, u = -1, d = 0; d <= c; ++d) {
262
+ if (d === c) {
263
+ if (h > c) {
264
+ if (t.charCodeAt(n + d) === 47)
265
+ return t.slice(n + d + 1);
266
+ if (d === 0)
267
+ return t.slice(n + d);
268
+ } else
269
+ o > c && (e.charCodeAt(s + d) === 47 ? u = d : d === 0 && (u = 0));
270
+ break;
271
+ }
272
+ var p = e.charCodeAt(s + d), f = t.charCodeAt(n + d);
273
+ if (p !== f)
274
+ break;
275
+ p === 47 && (u = d);
276
+ }
277
+ var m = "";
278
+ for (d = s + u + 1; d <= i; ++d)
279
+ (d === i || e.charCodeAt(d) === 47) && (m.length === 0 ? m += ".." : m += "/..");
280
+ return m.length > 0 ? m + t.slice(n + u) : (n += u, t.charCodeAt(n) === 47 && ++n, t.slice(n));
281
+ },
282
+ _makeLong: function(e) {
283
+ return e;
284
+ },
285
+ dirname: function(e) {
286
+ if (M(e), e.length === 0)
287
+ return ".";
288
+ for (var t = e.charCodeAt(0), s = t === 47, i = -1, o = !0, n = e.length - 1; n >= 1; --n)
289
+ if (t = e.charCodeAt(n), t === 47) {
290
+ if (!o) {
291
+ i = n;
292
+ break;
293
+ }
294
+ } else
295
+ o = !1;
296
+ return i === -1 ? s ? "/" : "." : s && i === 1 ? "//" : e.slice(0, i);
297
+ },
298
+ basename: function(e, t) {
299
+ if (t !== void 0 && typeof t != "string")
300
+ throw new TypeError('"ext" argument must be a string');
301
+ M(e);
302
+ var s = 0, i = -1, o = !0, n;
303
+ if (t !== void 0 && t.length > 0 && t.length <= e.length) {
304
+ if (t.length === e.length && t === e)
305
+ return "";
306
+ var l = t.length - 1, h = -1;
307
+ for (n = e.length - 1; n >= 0; --n) {
308
+ var c = e.charCodeAt(n);
309
+ if (c === 47) {
310
+ if (!o) {
311
+ s = n + 1;
312
+ break;
313
+ }
314
+ } else
315
+ h === -1 && (o = !1, h = n + 1), l >= 0 && (c === t.charCodeAt(l) ? --l === -1 && (i = n) : (l = -1, i = h));
316
+ }
317
+ return s === i ? i = h : i === -1 && (i = e.length), e.slice(s, i);
318
+ } else {
319
+ for (n = e.length - 1; n >= 0; --n)
320
+ if (e.charCodeAt(n) === 47) {
321
+ if (!o) {
322
+ s = n + 1;
323
+ break;
324
+ }
325
+ } else
326
+ i === -1 && (o = !1, i = n + 1);
327
+ return i === -1 ? "" : e.slice(s, i);
328
+ }
329
+ },
330
+ extname: function(e) {
331
+ M(e);
332
+ for (var t = -1, s = 0, i = -1, o = !0, n = 0, l = e.length - 1; l >= 0; --l) {
333
+ var h = e.charCodeAt(l);
334
+ if (h === 47) {
335
+ if (!o) {
336
+ s = l + 1;
337
+ break;
338
+ }
339
+ continue;
340
+ }
341
+ i === -1 && (o = !1, i = l + 1), h === 46 ? t === -1 ? t = l : n !== 1 && (n = 1) : t !== -1 && (n = -1);
342
+ }
343
+ return t === -1 || i === -1 || // We saw a non-dot character immediately before the dot
344
+ n === 0 || // The (right-most) trimmed path component is exactly '..'
345
+ n === 1 && t === i - 1 && t === s + 1 ? "" : e.slice(t, i);
346
+ },
347
+ format: function(e) {
348
+ if (e === null || typeof e != "object")
349
+ throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof e);
350
+ return Te("/", e);
351
+ },
352
+ parse: function(e) {
353
+ M(e);
354
+ var t = { root: "", dir: "", base: "", ext: "", name: "" };
355
+ if (e.length === 0)
356
+ return t;
357
+ var s = e.charCodeAt(0), i = s === 47, o;
358
+ i ? (t.root = "/", o = 1) : o = 0;
359
+ for (var n = -1, l = 0, h = -1, c = !0, u = e.length - 1, d = 0; u >= o; --u) {
360
+ if (s = e.charCodeAt(u), s === 47) {
361
+ if (!c) {
362
+ l = u + 1;
363
+ break;
364
+ }
365
+ continue;
366
+ }
367
+ h === -1 && (c = !1, h = u + 1), s === 46 ? n === -1 ? n = u : d !== 1 && (d = 1) : n !== -1 && (d = -1);
368
+ }
369
+ return n === -1 || h === -1 || // We saw a non-dot character immediately before the dot
370
+ d === 0 || // The (right-most) trimmed path component is exactly '..'
371
+ d === 1 && n === h - 1 && n === l + 1 ? h !== -1 && (l === 0 && i ? t.base = t.name = e.slice(1, h) : t.base = t.name = e.slice(l, h)) : (l === 0 && i ? (t.name = e.slice(1, n), t.base = e.slice(1, h)) : (t.name = e.slice(l, n), t.base = e.slice(l, h)), t.ext = e.slice(n, h)), l > 0 ? t.dir = e.slice(0, l - 1) : i && (t.dir = "/"), t;
372
+ },
373
+ sep: "/",
374
+ delimiter: ":",
375
+ win32: null,
376
+ posix: null
377
+ };
378
+ R.posix = R;
379
+ function D() {
380
+ return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
381
+ }
382
+ function Ae() {
383
+ return "".concat(D() + D(), "-").concat(D(), "-").concat(D(), "-").concat(D(), "-").concat(D()).concat(D()).concat(D());
384
+ }
385
+ function G(a) {
386
+ const e = a.lastIndexOf("@");
387
+ return e === -1 ? a : a.substring(0, e);
388
+ }
389
+ const Ie = /<svg\b[^>]*>[\s\S]*?<\/svg>/;
390
+ function Me(a) {
391
+ return Ie.test(a);
392
+ }
393
+ const ke = "topic", xe = "inline", Se = "temp", Ee = "unknow";
394
+ function De(a, e) {
395
+ let t = "";
396
+ switch (a) {
397
+ case "TOPIC":
398
+ t += ke;
399
+ break;
400
+ case "INLINE":
401
+ t += xe;
402
+ break;
403
+ case "TEMP":
404
+ t += Se;
405
+ break;
406
+ default:
407
+ t += Ee;
408
+ break;
409
+ }
410
+ return t += "@".concat(e || Ae(), "@").concat((/* @__PURE__ */ new Date()).getTime()), t;
411
+ }
412
+ class Z {
413
+ /**
414
+ * 拷贝文本
415
+ *
416
+ * @author zhanghengfeng
417
+ * @date 2023-08-31 11:08:51
418
+ * @param {string} value
419
+ * @return {*} {boolean}
420
+ */
421
+ static copy(e) {
422
+ return this.inputElement || (this.inputElement = document.createElement("input"), this.inputElement.style.position = "absolute", this.inputElement.style.left = "-9999px", document.body.appendChild(this.inputElement)), this.inputElement.value = e, this.inputElement.select(), document.execCommand("copy");
423
+ }
424
+ }
425
+ /**
426
+ * input元素,用于存储拷贝的文本
427
+ *
428
+ * @author zhanghengfeng
429
+ * @date 2023-08-31 20:08:06
430
+ * @private
431
+ * @type {(HTMLInputElement | null)}
432
+ */
433
+ v(Z, "inputElement", null);
434
+ const g = class g {
435
+ /**
436
+ * 检查数据库是否存在
437
+ *
438
+ * @param {string} storeName
439
+ * @return {*} {Promise<boolean>}
440
+ * @memberof IndexedDBUtil
441
+ */
442
+ static async checkDataBaseExists(e) {
443
+ try {
444
+ return (await indexedDB.databases()).some((s) => s.name === e);
445
+ } catch (t) {
446
+ return console.error("检查数据库是否存在时出错:", t), !1;
447
+ }
448
+ }
449
+ /**
450
+ * 删除数据库
451
+ *
452
+ * @return {*} {Promise<void>}
453
+ * @memberof IndexedDBUtil
454
+ */
455
+ static async deleteDatabase(e) {
456
+ var t, s;
457
+ return g.lastLink && ((s = (t = g.lastLink).close) == null || s.call(t)), new Promise((i, o) => {
458
+ const n = indexedDB.deleteDatabase(e);
459
+ n.onsuccess = () => {
460
+ i(!0);
461
+ }, n.onerror = () => {
462
+ i(!1);
463
+ }, n.onblocked = () => {
464
+ console.warn(
465
+ "删除数据库 ".concat(e, " 被阻塞,可能有其他连接正在使用该数据库。")
466
+ ), o(new Error("删除数据库 ".concat(e, " 被阻塞")));
467
+ };
468
+ });
469
+ }
470
+ /**
471
+ * 检查是否存在某个库以及库内是否存在某个表
472
+ *
473
+ * @param {string} storeName
474
+ * @param {string} tableName
475
+ * @return {*}
476
+ * @memberof IndexedDBUtil
477
+ */
478
+ static async checkTableExists(e, t) {
479
+ return await g.checkDataBaseExists(e) ? new Promise((i, o) => {
480
+ const n = indexedDB.open(e);
481
+ n.onupgradeneeded = (l) => {
482
+ g.db = l.target.result, g.version = g.db.version;
483
+ }, n.onsuccess = (l) => {
484
+ g.db = l.target.result, g.lastLink = n.result;
485
+ const h = g.db.objectStoreNames.contains(t);
486
+ n.result.close(), i(h);
487
+ }, n.onerror = (l) => {
488
+ o(l.target.error);
489
+ };
490
+ }) : !1;
491
+ }
492
+ /**
493
+ * 创建表
494
+ *
495
+ * @param {string} storeName 库名称
496
+ * @param {(string | null)} keyPath 表主键
497
+ * @param {boolean} [useAutoIncrement=false] 是否使用自增
498
+ * @return {*} {Promise<void>}
499
+ * @memberof IndexedDBUtil
500
+ */
501
+ static async createTable(e, t, s, i = !1) {
502
+ return new Promise((o) => {
503
+ var l, h;
504
+ g.version += 1, g.lastLink && ((h = (l = g.lastLink).close) == null || h.call(l));
505
+ const n = indexedDB.open(e, g.version);
506
+ n.onupgradeneeded = (c) => {
507
+ if (g.db = c.target.result, !g.db.objectStoreNames.contains(t)) {
508
+ const u = {};
509
+ s ? u.keyPath = s : i && (u.autoIncrement = !0), g.db.createObjectStore(t, u);
510
+ }
511
+ }, n.onsuccess = () => {
512
+ g.lastLink = n.result, n.result.close(), o(!0);
513
+ }, n.onerror = () => {
514
+ o(!1);
515
+ };
516
+ });
517
+ }
518
+ /**
519
+ * 删除表
520
+ *
521
+ * @param {string} storeName 表名称
522
+ * @return {*} {Promise<void>}
523
+ * @memberof IndexedDBUtil
524
+ */
525
+ static async deleteTable(e, t) {
526
+ return new Promise((s) => {
527
+ var o, n;
528
+ g.version += 1, g.lastLink && ((n = (o = g.lastLink).close) == null || n.call(o));
529
+ const i = indexedDB.open(e, g.version);
530
+ i.onupgradeneeded = (l) => {
531
+ g.db = l.target.result, g.lastLink = i.result, g.db.objectStoreNames.contains(t) && g.db.deleteObjectStore(t);
532
+ }, i.onsuccess = (l) => {
533
+ g.db = l.target.result, g.lastLink = i.result, i.result.close(), s(!0);
534
+ }, i.onerror = () => {
535
+ i.result.close(), s(!1);
536
+ };
537
+ });
538
+ }
539
+ /**
540
+ * 新增数据
541
+ *
542
+ * @param {string} storeName 表名称
543
+ * @param {*} data 新增数据
544
+ * @return {*} {Promise<void>}
545
+ * @memberof IndexedDBUtil
546
+ */
547
+ static async addData(e, t, s) {
548
+ return new Promise((i, o) => {
549
+ const n = indexedDB.open(e);
550
+ n.onsuccess = (l) => {
551
+ if (g.db = l.target.result, g.lastLink = n.result, g.db.objectStoreNames.contains(t)) {
552
+ const u = g.db.transaction(
553
+ [t],
554
+ "readwrite"
555
+ ).objectStore(t).add(s);
556
+ u.onsuccess = (d) => {
557
+ i(s);
558
+ }, u.onerror = () => {
559
+ i(null);
560
+ };
561
+ }
562
+ n.result.close();
563
+ }, n.onerror = () => {
564
+ n.result.close(), o();
565
+ };
566
+ });
567
+ }
568
+ /**
569
+ * 删除数据
570
+ *
571
+ * @param {string} storeName 表名称
572
+ * @param {IDBValidKey} key 数据键
573
+ * @return {*} {Promise<void>}
574
+ * @memberof IndexedDBUtil
575
+ */
576
+ static async deleteData(e, t, s) {
577
+ return new Promise((i, o) => {
578
+ const n = indexedDB.open(e);
579
+ n.onsuccess = (l) => {
580
+ if (g.db = l.target.result, g.lastLink = n.result, g.db.objectStoreNames.contains(t)) {
581
+ const u = g.db.transaction(
582
+ [t],
583
+ "readwrite"
584
+ ).objectStore(t).delete(s);
585
+ u.onsuccess = (d) => {
586
+ i(!0);
587
+ }, u.onerror = () => {
588
+ i(!1);
589
+ };
590
+ }
591
+ n.result.close();
592
+ }, n.onerror = () => {
593
+ n.result.close(), o();
594
+ };
595
+ });
596
+ }
597
+ /**
598
+ * 修改数据
599
+ *
600
+ * @param {string} storeName 表名称
601
+ * @param {*} data 需要修改的数据
602
+ * @return {*} {Promise<void>}
603
+ * @memberof IndexedDBUtil
604
+ */
605
+ static async updateData(e, t, s) {
606
+ return new Promise((i, o) => {
607
+ const n = indexedDB.open(e);
608
+ n.onsuccess = (l) => {
609
+ if (g.db = l.target.result, g.lastLink = n.result, g.db.objectStoreNames.contains(t)) {
610
+ const u = g.db.transaction(
611
+ [t],
612
+ "readwrite"
613
+ ).objectStore(t).put(s);
614
+ u.onsuccess = (d) => {
615
+ i(s);
616
+ }, u.onerror = () => {
617
+ i(s);
618
+ };
619
+ }
620
+ n.result.close();
621
+ }, n.onerror = () => {
622
+ n.result.close(), o();
623
+ };
624
+ });
625
+ }
626
+ /**
627
+ * 读取单条数据
628
+ *
629
+ * @param {string} storeName 表名称
630
+ * @param {IDBValidKey} key 数据主键
631
+ * @return {*} {Promise<any>}
632
+ * @memberof IndexedDBUtil
633
+ */
634
+ static async getData(e, t, s) {
635
+ return new Promise((i, o) => {
636
+ const n = indexedDB.open(e);
637
+ n.onsuccess = (l) => {
638
+ if (g.db = l.target.result, g.lastLink = n.result, g.db.objectStoreNames.contains(t)) {
639
+ const u = g.db.transaction(
640
+ [t],
641
+ "readonly"
642
+ ).objectStore(t).get(s);
643
+ u.onsuccess = (d) => {
644
+ i(u.result);
645
+ }, u.onerror = () => {
646
+ o(new Error("未找到数据".concat(s)));
647
+ };
648
+ }
649
+ n.result.close();
650
+ }, n.onerror = () => {
651
+ n.result.close(), o();
652
+ };
653
+ });
654
+ }
655
+ /**
656
+ * 读取所有数据
657
+ *
658
+ * @param {string} storeName 表名称
659
+ * @return {*} {Promise<any[]>}
660
+ * @memberof IndexedDBUtil
661
+ */
662
+ static async getAllData(e, t) {
663
+ return new Promise((s, i) => {
664
+ const o = indexedDB.open(e);
665
+ o.onsuccess = (n) => {
666
+ if (g.db = n.target.result, g.lastLink = o.result, g.db.objectStoreNames.contains(t)) {
667
+ const c = g.db.transaction(
668
+ [t],
669
+ "readonly"
670
+ ).objectStore(t).getAll();
671
+ c.onsuccess = (u) => {
672
+ s(c.result);
673
+ }, c.onerror = () => {
674
+ s([]);
675
+ };
676
+ }
677
+ o.result.close();
678
+ }, o.onerror = () => {
679
+ o.result.close(), i();
680
+ };
681
+ });
682
+ }
683
+ };
684
+ // 数据库版本
685
+ v(g, "version", 1), // 数据库连接句柄
686
+ v(g, "db", null), // 上一个连接
687
+ v(g, "lastLink");
688
+ let x = g;
689
+ class Oe {
690
+ /**
691
+ * Creates an instance of FileUploader.
692
+ * @author tony001
693
+ * @date 2025-02-28 15:02:15
694
+ * @param {FileUploaderOptions<T>} options
695
+ */
696
+ constructor(e) {
697
+ v(this, "options");
698
+ this.options = {
699
+ multiple: !0,
700
+ accept: "*/*",
701
+ maxSize: 5 * 1024 * 1024,
702
+ ...e
703
+ };
704
+ }
705
+ /**
706
+ * 打开文件选择对话框
707
+ */
708
+ openFilePicker() {
709
+ const e = document.createElement("input");
710
+ e.type = "file", e.multiple = this.options.multiple, e.accept = this.options.accept || "", e.onchange = (t) => {
711
+ const s = Array.from(t.target.files || []);
712
+ this.handleFiles(s);
713
+ }, e.click();
714
+ }
715
+ /**
716
+ * 处理选择的文件
717
+ */
718
+ async handleFiles(e) {
719
+ var s, i;
720
+ if (e.length === 0)
721
+ return;
722
+ const t = e.filter((o) => {
723
+ var n, l;
724
+ return this.options.maxSize && o.size > this.options.maxSize ? ((l = (n = this.options).onError) == null || l.call(
725
+ n,
726
+ new Error(
727
+ "文件大小超过限制 (".concat(this.formatSize(
728
+ o.size
729
+ ), " > ").concat(this.formatSize(this.options.maxSize), ")")
730
+ ),
731
+ o
732
+ ), !1) : !0;
733
+ });
734
+ (i = (s = this.options).onSelect) == null || i.call(s, t), await Promise.all(t.map((o) => this.processFile(o)));
735
+ }
736
+ /**
737
+ * 处理单个文件上传
738
+ */
739
+ async processFile(e) {
740
+ var t, s, i, o, n, l;
741
+ try {
742
+ const h = (u) => {
743
+ var d, p;
744
+ (p = (d = this.options).onProgress) == null || p.call(d, e, u);
745
+ }, c = await this.options.onUpload(e, h);
746
+ (s = (t = this.options).onProgress) == null || s.call(t, e, 100), (o = (i = this.options).onSuccess) == null || o.call(i, c, e);
747
+ } catch (h) {
748
+ (l = (n = this.options).onError) == null || l.call(
749
+ n,
750
+ h instanceof Error ? h : new Error("上传失败"),
751
+ e
752
+ );
753
+ }
754
+ }
755
+ /**
756
+ * 格式化文件大小
757
+ */
758
+ formatSize(e) {
759
+ if (e === 0)
760
+ return "0 B";
761
+ const t = ["B", "KB", "MB", "GB"], s = Math.floor(Math.log(e) / Math.log(1024));
762
+ return "".concat((e / 1024 ** s).toFixed(2), " ").concat(t[s]);
763
+ }
764
+ }
765
+ class j {
766
+ /**
767
+ * 从XML元素中提取CDATA内容
768
+ *
769
+ * @author tony001
770
+ * @date 2025-03-03 15:03:43
771
+ * @private
772
+ * @static
773
+ * @param {(Element | null)} element
774
+ * @return {*} {(string | null)}
775
+ */
776
+ static getCdataContent(e) {
777
+ if (!e)
778
+ return null;
779
+ const t = Array.from(e.childNodes).find(
780
+ (s) => s.nodeType === s.CDATA_SECTION_NODE
781
+ );
782
+ return (t == null ? void 0 : t.nodeValue) || e.textContent;
783
+ }
784
+ /**
785
+ * XML 字符串转数据对象
786
+ *
787
+ * @author tony001
788
+ * @date 2025-03-03 11:03:17
789
+ * @static
790
+ * @param {string} xmlString
791
+ * @return {*} {IMaterial[]}
792
+ */
793
+ static parse(e) {
794
+ const s = new DOMParser().parseFromString(e, "text/xml");
795
+ return Array.from(s.querySelectorAll("resource")).map((o) => {
796
+ const n = o.getAttribute("type") || "", l = o.querySelector("data"), h = o.querySelector("metadata");
797
+ try {
798
+ const c = this.getCdataContent(l), u = this.getCdataContent(h), d = c ? JSON.parse(c) : {}, p = u ? JSON.parse(u) : {};
799
+ return { id: d.id, type: n, data: d, metadata: p };
800
+ } catch (c) {
801
+ throw new Error("XML 解析错误: ".concat(c.message));
802
+ }
803
+ });
804
+ }
805
+ /**
806
+ * 混合内容解析
807
+ *
808
+ * @author tony001
809
+ * @date 2025-03-03 13:03:35
810
+ * @static
811
+ * @param {string} input 包含 XML 和其他文本的混合字符串
812
+ * @return {*} {{
813
+ * resources: IMaterial[];
814
+ * remainingText: string;
815
+ * hasResources: boolean;
816
+ * error?: string;
817
+ * }}
818
+ */
819
+ static parseMixedContent(e) {
820
+ const s = /<resources\b[^>]*>[\s\S]*?<\/resources>/i.exec(e);
821
+ if (!s)
822
+ return {
823
+ resources: [],
824
+ remainingText: e,
825
+ hasResources: !1
826
+ };
827
+ const [i] = s, o = s.index, n = o + i.length, l = (e.slice(0, o) + e.slice(n)).replace(/\n/g, "").replace(/(!\[[^\]]*\]\([^)]+\))/g, "\n$1\n").replace(/\n+/g, "\n").replace(/^\n|\n$/g, "");
828
+ try {
829
+ return {
830
+ resources: this.parse(i),
831
+ remainingText: l,
832
+ hasResources: !0
833
+ };
834
+ } catch (h) {
835
+ return {
836
+ resources: [],
837
+ remainingText: l,
838
+ hasResources: !0,
839
+ error: "资源解析失败: ".concat(h.message)
840
+ };
841
+ }
842
+ }
843
+ /**
844
+ * 数据对象转 XML 字符串
845
+ *
846
+ * @author tony001
847
+ * @date 2025-03-03 11:03:51
848
+ * @static
849
+ * @param {IMaterial[]} resources
850
+ * @return {*} {string}
851
+ */
852
+ static stringify(e) {
853
+ const t = document.implementation.createDocument(null, null, null), s = t.createElement("resources");
854
+ s.setAttribute("version", "1.0");
855
+ const i = (n) => "\n".concat(" ".repeat(n)), o = 1;
856
+ return e.forEach((n) => {
857
+ s.appendChild(t.createTextNode(i(o)));
858
+ const l = t.createElement("resource");
859
+ l.setAttribute("type", n.type), l.setAttribute("version", "1.0");
860
+ const h = (c, u) => {
861
+ const d = t.createElement(c);
862
+ d.appendChild(t.createTextNode(i(o + 1)));
863
+ const p = t.createCDATASection(JSON.stringify(u));
864
+ return d.appendChild(p), d.appendChild(t.createTextNode(i(o))), d;
865
+ };
866
+ l.appendChild(
867
+ t.createTextNode(i(o + 1))
868
+ ), l.appendChild(h("data", n.data)), l.appendChild(
869
+ t.createTextNode(i(o + 1))
870
+ ), l.appendChild(h("metadata", n.metadata)), l.appendChild(t.createTextNode(i(o))), s.appendChild(l);
871
+ }), s.appendChild(t.createTextNode("\n")), t.appendChild(s), new XMLSerializer().serializeToString(t).replace(/></g, ">\n<");
872
+ }
873
+ }
874
+ class Le {
875
+ /**
876
+ * 从XML元素中提取CDATA内容
877
+ *
878
+ * @author tony001
879
+ * @date 2025-03-03 15:03:43
880
+ * @private
881
+ * @static
882
+ * @param {(Element | null)} element
883
+ * @return {*} {(string | null)}
884
+ */
885
+ static getCdataContent(e) {
886
+ if (!e)
887
+ return null;
888
+ const t = Array.from(e.childNodes).find(
889
+ (s) => s.nodeType === s.CDATA_SECTION_NODE
890
+ );
891
+ return (t == null ? void 0 : t.nodeValue) || e.textContent;
892
+ }
893
+ /**
894
+ * XML 字符串转数据对象
895
+ *
896
+ * @author tony001
897
+ * @date 2025-03-03 11:03:17
898
+ * @static
899
+ * @param {string} xmlString
900
+ * @return {*} {IChatSuggestion[]}
901
+ */
902
+ static parse(e) {
903
+ const s = new DOMParser().parseFromString(e, "text/xml");
904
+ return Array.from(s.querySelectorAll("suggestion")).map((o) => {
905
+ const n = o.getAttribute("type") || "", l = o.querySelector("data"), h = o.querySelector("metadata");
906
+ try {
907
+ const c = this.getCdataContent(l), u = this.getCdataContent(h), d = c ? JSON.parse(c) : {}, p = u ? JSON.parse(u) : {};
908
+ return { type: n, data: d, metadata: p };
909
+ } catch (c) {
910
+ throw new Error("XML 解析错误: ".concat(c.message));
911
+ }
912
+ });
913
+ }
914
+ /**
915
+ * 混合内容解析
916
+ *
917
+ * @author tony001
918
+ * @date 2025-03-03 13:03:35
919
+ * @static
920
+ * @param {string} input 包含 XML 和其他文本的混合字符串
921
+ * @return {*} {{
922
+ * suggestions: IChatSuggestion[];
923
+ * remainingText: string;
924
+ * hasSuggestions: boolean;
925
+ * error?: string;
926
+ * }}
927
+ */
928
+ static parseMixedContent(e) {
929
+ const s = /<suggestions\b[^>]*>[\s\S]*?<\/suggestions>/i.exec(e);
930
+ if (!s)
931
+ return {
932
+ suggestions: [],
933
+ remainingText: e,
934
+ hasSuggestions: !1
935
+ };
936
+ const [i] = s, o = s.index, n = o + i.length, l = (e.slice(0, o) + e.slice(n)).replace(/\n/g, "");
937
+ try {
938
+ return {
939
+ suggestions: this.parse(i),
940
+ remainingText: l,
941
+ hasSuggestions: !0
942
+ };
943
+ } catch (h) {
944
+ return {
945
+ suggestions: [],
946
+ remainingText: l,
947
+ hasSuggestions: !0,
948
+ error: "资源解析失败: ".concat(h.message)
949
+ };
950
+ }
951
+ }
952
+ /**
953
+ * 数据对象转 XML 字符串
954
+ *
955
+ * @author tony001
956
+ * @date 2025-03-03 11:03:51
957
+ * @static
958
+ * @param {IChatSuggestion[]} suggestions
959
+ * @return {*} {string}
960
+ */
961
+ static stringify(e) {
962
+ const t = document.implementation.createDocument(null, null, null), s = t.createElement("suggestions");
963
+ s.setAttribute("version", "1.0");
964
+ const i = (n) => "\n".concat(" ".repeat(n)), o = 1;
965
+ return e.forEach((n) => {
966
+ s.appendChild(t.createTextNode(i(o)));
967
+ const l = t.createElement("suggestion");
968
+ l.setAttribute("type", n.type), l.setAttribute("version", "1.0");
969
+ const h = (c, u) => {
970
+ const d = t.createElement(c);
971
+ d.appendChild(t.createTextNode(i(o + 1)));
972
+ const p = t.createCDATASection(JSON.stringify(u));
973
+ return d.appendChild(p), d.appendChild(t.createTextNode(i(o))), d;
974
+ };
975
+ l.appendChild(
976
+ t.createTextNode(i(o + 1))
977
+ ), l.appendChild(h("data", n.data)), l.appendChild(
978
+ t.createTextNode(i(o + 1))
979
+ ), l.appendChild(
980
+ h("metadata", n.metadata)
981
+ ), l.appendChild(t.createTextNode(i(o))), s.appendChild(l);
982
+ }), s.appendChild(t.createTextNode("\n")), t.appendChild(s), new XMLSerializer().serializeToString(t).replace(/></g, ">\n<");
983
+ }
984
+ }
985
+ class Be {
986
+ /**
987
+ * @description 解析工具调用
988
+ * @static
989
+ * @param {string} toolCallString
990
+ * @returns {*} {IChatToolCall[]}
991
+ * @memberof ChatToolCallParser
992
+ */
993
+ static parse(e) {
994
+ const t = new RegExp(
995
+ "<tool_call>\\s*({[\\s\\S]*?})\\s*</tool_call>",
996
+ "g"
997
+ ), s = e.matchAll(t), i = [];
998
+ for (const o of s)
999
+ try {
1000
+ const n = JSON.parse(o[1]), l = {
1001
+ name: n.name,
1002
+ parameters: n.parameters,
1003
+ error: n.error || !1
1004
+ };
1005
+ n.result && Object.assign(l, {
1006
+ result: n.result
1007
+ }), i.push(l);
1008
+ } catch (n) {
1009
+ console.error("解析工具调用失败:", n);
1010
+ }
1011
+ return i;
1012
+ }
1013
+ }
1014
+ class L {
1015
+ constructor(e) {
1016
+ v(this, "toolcalls", []);
1017
+ /**
1018
+ * @description 消息的所有原始内容
1019
+ * - 用于维护工具调用消息数据
1020
+ * @type {string}
1021
+ * @memberof ChatMessage
1022
+ */
1023
+ v(this, "allcontent", "");
1024
+ this.msg = e, this.toolcalls = e.toolcalls || [], this.allcontent = e.content;
1025
+ }
1026
+ get messageid() {
1027
+ return this.msg.messageid;
1028
+ }
1029
+ get state() {
1030
+ return this.msg.state;
1031
+ }
1032
+ get role() {
1033
+ return this.msg.role;
1034
+ }
1035
+ get type() {
1036
+ return this.msg.type;
1037
+ }
1038
+ get status() {
1039
+ return this.msg.status;
1040
+ }
1041
+ get realcontent() {
1042
+ let e = this.msg.content;
1043
+ if (e.indexOf("<think>") !== -1 && e.indexOf("</think>") === -1 || (e = e.replace(new RegExp("\\<think\\>[^]*?\\<\\/think\\>", "gs"), "").trim(), e.indexOf("<tool_call>") !== -1 && e.indexOf("</tool_call>") === -1) || (e = e.replace(new RegExp("\\<tool_call\\>[^]*?\\<\\/tool_call\\>", "gs"), "").trim(), e.indexOf("<resources>") !== -1 && e.indexOf("</resources>") === -1))
1044
+ return "";
1045
+ e = e.replace(new RegExp("\\<resources\\>[^]*?\\<\\/resources\\>", "gs"), "").trim();
1046
+ const t = e.indexOf("<suggestions>");
1047
+ return t !== -1 && (e = e.substring(0, t).trim()), e;
1048
+ }
1049
+ get content() {
1050
+ return this.msg.content;
1051
+ }
1052
+ get completed() {
1053
+ return this.msg.completed;
1054
+ }
1055
+ get suggestions() {
1056
+ return this.msg.suggestions;
1057
+ }
1058
+ get _origin() {
1059
+ return this.msg;
1060
+ }
1061
+ get islike() {
1062
+ return this.msg.islike;
1063
+ }
1064
+ get isdislike() {
1065
+ return this.msg.isdislike;
1066
+ }
1067
+ get feedbackcontent() {
1068
+ return this.msg.feedbackcontent;
1069
+ }
1070
+ get realmessageid() {
1071
+ return this.msg.realmessageid;
1072
+ }
1073
+ /**
1074
+ * 更新消息
1075
+ *
1076
+ * @author chitanda
1077
+ * @date 2023-10-10 17:10:07
1078
+ * @param {IChatMessage} msg
1079
+ */
1080
+ update(e) {
1081
+ e.content || (e.content = ""), this.allcontent += e.content, e.content.indexOf("<think>") !== -1 && this.msg.content && (this.msg.content = ""), this.msg.content += e.content, this.computeToolCalls();
1082
+ }
1083
+ /**
1084
+ * @description 替换消息
1085
+ * @param {IChatMessage} msg
1086
+ * @memberof ChatMessage
1087
+ */
1088
+ replace(e) {
1089
+ this.msg = e;
1090
+ }
1091
+ /**
1092
+ * 更新消息完成状态
1093
+ *
1094
+ * @author tony001
1095
+ * @date 2025-02-25 17:02:31
1096
+ * @param {boolean} completed
1097
+ */
1098
+ updateCompleted(e) {
1099
+ this.msg.completed = e;
1100
+ }
1101
+ /**
1102
+ * @description 计算工具调用
1103
+ * @memberof ChatMessage
1104
+ */
1105
+ computeToolCalls() {
1106
+ this.toolcalls = Be.parse(this.allcontent);
1107
+ }
1108
+ }
1109
+ class $ {
1110
+ constructor(e) {
1111
+ this.data = e;
1112
+ }
1113
+ get appid() {
1114
+ return this.data.appid;
1115
+ }
1116
+ get id() {
1117
+ return this.data.id;
1118
+ }
1119
+ get type() {
1120
+ return this.data.type;
1121
+ }
1122
+ get caption() {
1123
+ return this.data.caption;
1124
+ }
1125
+ get sourceCaption() {
1126
+ return this.data.sourceCaption;
1127
+ }
1128
+ get url() {
1129
+ return this.data.url;
1130
+ }
1131
+ get aiChat() {
1132
+ return this.data.aiChat;
1133
+ }
1134
+ get captionMode() {
1135
+ return this.data.captionMode;
1136
+ }
1137
+ get captionFilled() {
1138
+ return this.data.captionFilled;
1139
+ }
1140
+ get realid() {
1141
+ return this.data.realid;
1142
+ }
1143
+ get sequence() {
1144
+ return this.data.sequence;
1145
+ }
1146
+ get isTop() {
1147
+ return this.data.isTop;
1148
+ }
1149
+ get disableStorage() {
1150
+ return this.data.disableStorage || !1;
1151
+ }
1152
+ }
1153
+ class F {
1154
+ constructor(e) {
1155
+ this.material = e;
1156
+ }
1157
+ get id() {
1158
+ return this.material.id;
1159
+ }
1160
+ get type() {
1161
+ return this.material.type;
1162
+ }
1163
+ get metadata() {
1164
+ return this.material.metadata;
1165
+ }
1166
+ get data() {
1167
+ return this.material.data;
1168
+ }
1169
+ }
1170
+ class $e {
1171
+ constructor(e) {
1172
+ this.agent = e;
1173
+ }
1174
+ get id() {
1175
+ return this.agent.id;
1176
+ }
1177
+ get caption() {
1178
+ return this.agent.caption;
1179
+ }
1180
+ get default() {
1181
+ return this.agent.default;
1182
+ }
1183
+ get order() {
1184
+ return this.agent.order;
1185
+ }
1186
+ get value() {
1187
+ return this.agent.id;
1188
+ }
1189
+ get label() {
1190
+ return this.agent.caption;
1191
+ }
1192
+ }
1193
+ var I = /* @__PURE__ */ ((a) => (a.DATA_BASE_NAME = "ibiz-chat", a.DATA_TABLE_NAME = "history-message", a.DATA_TABLE_KEY_NAME = "id", a))(I || {});
1194
+ function Re(a) {
1195
+ switch (a) {
1196
+ case "user":
1197
+ return "USER";
1198
+ case "agent":
1199
+ return "ASSISTANT";
1200
+ case "system":
1201
+ return "SYSTEM";
1202
+ default:
1203
+ return "USER";
1204
+ }
1205
+ }
1206
+ function ze(a) {
1207
+ switch (a) {
1208
+ case "pending":
1209
+ return 20;
1210
+ case "sent":
1211
+ return 30;
1212
+ case "failed":
1213
+ return 40;
1214
+ case "canceled":
1215
+ return 30;
1216
+ default:
1217
+ return 30;
1218
+ }
1219
+ }
1220
+ function qe(a) {
1221
+ switch (a) {
1222
+ case "pending":
1223
+ case "sent":
1224
+ case "canceled":
1225
+ return "DEFAULT";
1226
+ case "failed":
1227
+ return "ERROR";
1228
+ default:
1229
+ return "DEFAULT";
1230
+ }
1231
+ }
1232
+ function Fe(a) {
1233
+ return {
1234
+ messageid: a.id,
1235
+ state: ze(a.status),
1236
+ type: qe(a.status),
1237
+ role: Re(a.sender_type),
1238
+ content: a.content,
1239
+ completed: !0,
1240
+ islike: a.is_like,
1241
+ isdislike: a.is_dislike,
1242
+ feedbackcontent: a.feedback_content,
1243
+ realmessageid: a.id,
1244
+ status: a.status
1245
+ };
1246
+ }
1247
+ class Y {
1248
+ /**
1249
+ * Creates an instance of AiChatController.
1250
+ *
1251
+ * @author chitanda
1252
+ * @date 2023-10-15 19:10:34
1253
+ * @param {IChatOptions} opts 聊天配置
1254
+ * @param {IChatOptions} resourceOptions 资源配置
1255
+ */
1256
+ constructor(e, t) {
1257
+ /**
1258
+ * 事件触发器
1259
+ * @type {EventBase}
1260
+ */
1261
+ v(this, "evt", new qxUtil.QXEvent());
1262
+ /**
1263
+ * 聊天记录
1264
+ *
1265
+ * @author chitanda
1266
+ * @date 2023-10-16 16:10:29
1267
+ * @type {Signal<ChatMessage[]>}
1268
+ */
1269
+ v(this, "messages", vue.ref([]));
1270
+ /**
1271
+ * 素材列表
1272
+ *
1273
+ * @author tony001
1274
+ * @date 2025-02-27 18:02:46
1275
+ * @type {Signal<IMaterial[]>}
1276
+ */
1277
+ v(this, "materials", vue.ref([]));
1278
+ /**
1279
+ * 聊天框输入值
1280
+ *
1281
+ * @author chitanda
1282
+ * @date 2023-10-16 15:10:43
1283
+ * @type {Signal<string>}
1284
+ */
1285
+ v(this, "input", vue.ref(""));
1286
+ /**
1287
+ * 是否加载中
1288
+ *
1289
+ * @author tony001
1290
+ * @date 2025-03-10 18:03:42
1291
+ * @type {Signal<boolean>}
1292
+ */
1293
+ v(this, "isLoading", vue.ref(!1));
1294
+ /**
1295
+ * 是否允许切换AI代理
1296
+ */
1297
+ v(this, "enableAIAgentChange", !0);
1298
+ /**
1299
+ * 激活AI代理标识
1300
+ *
1301
+ * @type {(string | undefined)}
1302
+ */
1303
+ v(this, "activeAIAgentID");
1304
+ /**
1305
+ * AI代理列表
1306
+ *
1307
+ * @type {Signal<AIAgent[]>}
1308
+ */
1309
+ v(this, "agentList", vue.ref([]));
1310
+ /**
1311
+ * 视图参数
1312
+ *
1313
+ * @author tony001
1314
+ * @date 2025-02-24 14:02:23
1315
+ * @type {object}
1316
+ */
1317
+ v(this, "context");
1318
+ /**
1319
+ * 视图参数
1320
+ *
1321
+ * @author tony001
1322
+ * @date 2025-02-24 14:02:32
1323
+ * @type {object}
1324
+ */
1325
+ v(this, "params");
1326
+ /**
1327
+ * 应用实体标记
1328
+ *
1329
+ * @author tony001
1330
+ * @date 2025-02-24 14:02:10
1331
+ * @type {string}
1332
+ */
1333
+ v(this, "appDataEntityId");
1334
+ /**
1335
+ * 话题标识
1336
+ *
1337
+ * @author tony001
1338
+ * @date 2025-02-24 18:02:02
1339
+ * @type {(string | undefined)}
1340
+ */
1341
+ v(this, "topicId");
1342
+ /**
1343
+ * 话题数据
1344
+ *
1345
+ * @author tony001
1346
+ * @date 2025-03-10 16:03:26
1347
+ * @type {(ITopic | undefined)}
1348
+ */
1349
+ v(this, "topic");
1350
+ /**
1351
+ * 话题控制器
1352
+ */
1353
+ v(this, "aiTopic");
1354
+ /**
1355
+ * @description 聊天sessionid
1356
+ * @type {string}
1357
+ * @memberof AiChatController
1358
+ */
1359
+ v(this, "chatSessionid", "");
1360
+ /**
1361
+ * 模式参数,用于业务区分
1362
+ */
1363
+ v(this, "chatMode");
1364
+ this.opts = e, this.resourceOptions = t, this.context = e.context, this.params = e.params, this.appDataEntityId = e.appDataEntityId, this.aiTopic = e.aiTopic, this.topicId = e.topicId, this.topic = e.topic, this.activeAIAgentID = e.activeAIAgentID, this.enableAIAgentChange = !!e.enableAIAgentChange, this.chatMode = e.srfMode, this.chatSessionid = e.sessionid, this.initAIChat();
1365
+ }
1366
+ /**
1367
+ * AI资源模式
1368
+ */
1369
+ get resourceMode() {
1370
+ var e;
1371
+ return ((e = this.resourceOptions) == null ? void 0 : e.resourceMode) || "LOCAL";
1372
+ }
1373
+ /**
1374
+ * 当前话题是否禁止存储
1375
+ */
1376
+ get currentTopicDisableStorage() {
1377
+ if (this.topicId && this.aiTopic) {
1378
+ const e = this.aiTopic.getCurrentTopicByID(this.topicId);
1379
+ if (e && e.disableStorage)
1380
+ return !0;
1381
+ }
1382
+ return !1;
1383
+ }
1384
+ /**
1385
+ * 初始化
1386
+ */
1387
+ async initAIChat() {
1388
+ this.messages.value = [], await this.initAIChatAgent(), await this.fecthHistory();
1389
+ }
1390
+ /**
1391
+ * 初始化AI代理列表
1392
+ */
1393
+ async initAIChatAgent() {
1394
+ this.opts.aiAgentlist && this.opts.aiAgentlist.length > 0 && this.opts.aiAgentlist.forEach((e) => {
1395
+ this.agentList.value = [...this.agentList.value, new $e(e)];
1396
+ });
1397
+ }
1398
+ /**
1399
+ * 获取历史记录存储key(用于适配不同智能体存在不同的历史记录)
1400
+ * @param topicId 话题标识
1401
+ * @returns 历史存储key
1402
+ */
1403
+ getHistoryStoreKey(e) {
1404
+ return "".concat(e);
1405
+ }
1406
+ /**
1407
+ * 获取历史记录
1408
+ *
1409
+ * @author tony001
1410
+ * @date 2025-02-24 13:02:52
1411
+ * @return {*} {Promise<boolean>}
1412
+ */
1413
+ async fecthHistory() {
1414
+ if (this.topicId) {
1415
+ let t = {};
1416
+ if (this.currentTopicDisableStorage)
1417
+ t.data = [];
1418
+ else if (this.resourceMode === "LOCAL")
1419
+ t = await x.getData(
1420
+ I.DATA_BASE_NAME,
1421
+ I.DATA_TABLE_NAME,
1422
+ this.getHistoryStoreKey(this.topicId)
1423
+ );
1424
+ else if (this.resourceMode === "REMOTE" && this.resourceOptions) {
1425
+ const s = await this.resourceOptions.getMessages({
1426
+ n_session_id_eq: this.chatSessionid
1427
+ });
1428
+ if (s && s.length > 0) {
1429
+ const i = [];
1430
+ s.forEach((o) => {
1431
+ i.push(Fe(o));
1432
+ }), t.data = i;
1433
+ }
1434
+ }
1435
+ if (t && t.data && t.data.length > 0)
1436
+ return t.data.forEach((s) => {
1437
+ const i = {
1438
+ messageid: s.messageid,
1439
+ state: s.state,
1440
+ type: s.type,
1441
+ role: s.role,
1442
+ islike: s.islike,
1443
+ isdislike: s.isdislike,
1444
+ feedbackcontent: s.feedbackcontent,
1445
+ content: s.content,
1446
+ suggestions: s.suggestions,
1447
+ completed: !0,
1448
+ toolcalls: s.toolcalls,
1449
+ realmessageid: s.realmessageid,
1450
+ status: s.status
1451
+ };
1452
+ this.addMessage(i);
1453
+ }), await this.afterFecthHistory(), !0;
1454
+ }
1455
+ return await this.opts.history(this.context, this.params, {
1456
+ appDataEntityId: this.appDataEntityId,
1457
+ appendCurData: this.opts.appendCurData,
1458
+ sessionid: this.chatSessionid,
1459
+ srfaiagent: this.activeAIAgentID,
1460
+ srfmode: this.chatMode
1461
+ }) && await this.afterFecthHistory(), !0;
1462
+ }
1463
+ /**
1464
+ * 获取历史记录后续处理
1465
+ */
1466
+ async afterFecthHistory() {
1467
+ if (this.opts.appendCurContent && this.addMessage({
1468
+ state: 30,
1469
+ messageid: qxUtil.createUUID(),
1470
+ role: "USER",
1471
+ type: "DEFAULT",
1472
+ content: this.opts.appendCurContent,
1473
+ completed: !0,
1474
+ status: "sent"
1475
+ }), this.opts.appendCurResource) {
1476
+ const { hasResources: e, resources: t } = j.parseMixedContent(this.opts.appendCurResource);
1477
+ e && t && t.length > 0 && t.forEach((s) => {
1478
+ this.replaceMaterial(s.id, s);
1479
+ });
1480
+ }
1481
+ if (this.opts.autoQuestion !== !1) {
1482
+ const e = this.messages.value.length - 1, t = this.messages.value[e];
1483
+ if (t && t.role === "USER") {
1484
+ const s = this.stringlyMaterialResource(!1);
1485
+ if (s) {
1486
+ const i = s + t.content, o = {
1487
+ ...t._origin,
1488
+ messageid: qxUtil.createUUID(),
1489
+ content: i
1490
+ };
1491
+ this.messages.value[e] = new L(o), this.messages.value = [...this.messages.value];
1492
+ }
1493
+ try {
1494
+ this.isLoading.value = !0, await this.opts.question(
1495
+ this,
1496
+ this.context,
1497
+ this.params,
1498
+ { appDataEntityId: this.appDataEntityId },
1499
+ this.getMessages(),
1500
+ this.chatSessionid,
1501
+ this.activeAIAgentID,
1502
+ this.chatMode
1503
+ ), this.opts.action && await this.opts.action("question", t.content);
1504
+ } finally {
1505
+ this.isLoading.value = !1;
1506
+ }
1507
+ }
1508
+ }
1509
+ await this.updateTopicCaption();
1510
+ }
1511
+ /**
1512
+ * 更新数据到indexdb
1513
+ *
1514
+ * @author tony001
1515
+ * @date 2025-02-24 18:02:41
1516
+ * @return {*} {Promise<void>}
1517
+ */
1518
+ async asyncToIndexDB() {
1519
+ if (!this.topicId || this.resourceMode !== "LOCAL" || this.currentTopicDisableStorage)
1520
+ return;
1521
+ const e = {
1522
+ id: this.getHistoryStoreKey(this.topicId),
1523
+ data: this.messages.value.map((t) => ({
1524
+ ...t._origin,
1525
+ toolcalls: t.toolcalls ? [...t.toolcalls] : []
1526
+ })),
1527
+ timestamp: (/* @__PURE__ */ new Date()).getTime()
1528
+ };
1529
+ await x.updateData(
1530
+ I.DATA_BASE_NAME,
1531
+ I.DATA_TABLE_NAME,
1532
+ e
1533
+ );
1534
+ }
1535
+ /**
1536
+ * 设置聊天框值
1537
+ *
1538
+ * @author chitanda
1539
+ * @date 2023-10-16 16:10:21
1540
+ * @param {string} input
1541
+ */
1542
+ setInput(e) {
1543
+ this.input.value = e || "";
1544
+ }
1545
+ /**
1546
+ * 新增聊天记录
1547
+ *
1548
+ * @author chitanda
1549
+ * @date 2023-10-09 15:10:15
1550
+ * @param {IMessage} data
1551
+ */
1552
+ addMessage(e) {
1553
+ const t = this.messages.value.find(
1554
+ (s) => s.messageid === e.messageid
1555
+ );
1556
+ t ? (t.update(e), this.messages.value = [...this.messages.value]) : this.messages.value = [...this.messages.value, new L(e)], this.asyncToIndexDB();
1557
+ }
1558
+ /**
1559
+ * 更新消息完成状态
1560
+ *
1561
+ * @author tony001
1562
+ * @date 2025-02-25 17:02:19
1563
+ * @param {string} id
1564
+ * @param {boolean} completed
1565
+ */
1566
+ async completeMessage(e, t) {
1567
+ const s = this.messages.value.find((i) => i.messageid === e);
1568
+ if (s && (s.updateCompleted(t), this.messages.value = [...this.messages.value], await this.asyncToIndexDB()), this.opts.autoFill === !0) {
1569
+ const i = s || this.messages.value[this.messages.value.length - 1];
1570
+ i.role === "ASSISTANT" && i.state === 30 && this.backfill(i);
1571
+ }
1572
+ this.evt.emit("onCompleteMessage", {
1573
+ messageid: e,
1574
+ completed: t
1575
+ });
1576
+ }
1577
+ /**
1578
+ * 替换已经存在的聊天消息
1579
+ *
1580
+ * @author chitanda
1581
+ * @date 2023-10-16 22:10:49
1582
+ * @param {IChatMessage} data
1583
+ */
1584
+ replaceMessage(e, t = !0) {
1585
+ const s = this.messages.value.findIndex(
1586
+ (i) => i.messageid === e.messageid
1587
+ );
1588
+ s !== -1 ? (this.messages.value[s].replace(e), this.messages.value = [...this.messages.value]) : this.messages.value = [...this.messages.value, new L(e)], this.asyncToIndexDB(), e.type === "DEFAULT" && this.opts.recommendPrompt && t && this.opts.recommendPrompt(this.context, this.params, {
1589
+ appDataEntityId: this.appDataEntityId,
1590
+ message: {
1591
+ messages: [e],
1592
+ sessionid: this.chatSessionid,
1593
+ srfaiagent: this.activeAIAgentID
1594
+ }
1595
+ }).then((i) => {
1596
+ i && i.content && this.updateRecommendPrompt(e, i.content);
1597
+ });
1598
+ }
1599
+ /**
1600
+ * 终止消息
1601
+ *
1602
+ * @author tony001
1603
+ * @date 2025-03-10 14:03:17
1604
+ * @param {IChatMessage} data
1605
+ */
1606
+ async stopMessage(e) {
1607
+ const t = this.messages.value.findIndex(
1608
+ (s) => s.messageid === e.messageid
1609
+ );
1610
+ e.content = e.content || "用户中断", t !== -1 ? (this.messages.value[t].replace(e), this.messages.value = [...this.messages.value]) : this.messages.value = [...this.messages.value, new L(e)], await this.asyncToIndexDB();
1611
+ }
1612
+ /**
1613
+ * 数据对象转 XML 字符串
1614
+ *
1615
+ * @author tony001
1616
+ * @date 2025-03-03 11:03:55
1617
+ * @return {*} {string}
1618
+ */
1619
+ stringlyMaterialResource(e = !0) {
1620
+ let t = "";
1621
+ const s = [];
1622
+ return this.materials.value && this.materials.value.length > 0 && (this.materials.value.forEach((i) => {
1623
+ if (i.type === "ossfile") {
1624
+ const o = i.metadata;
1625
+ o.state && o.state === "successed" && s.push(i);
1626
+ } else
1627
+ s.push(i);
1628
+ }), e && (this.materials.value = [])), s && s.length > 0 && (t = j.stringify(s)), t;
1629
+ }
1630
+ /**
1631
+ * @description 获取当前会话的消息集合
1632
+ * @private
1633
+ * @returns {*} {IChatMessage[]}
1634
+ * @memberof AiChatController
1635
+ */
1636
+ getMessages() {
1637
+ const e = this.messages.value.filter((t) => t.type !== "ERROR" && t.status !== "canceled").map((t) => t._origin);
1638
+ return e.forEach((t) => {
1639
+ t.content = t.content.replace(new RegExp("\\<tool_call\\>[^]*?\\<\\/tool_call\\>", "gs"), "").trim();
1640
+ }), e;
1641
+ }
1642
+ /**
1643
+ * 获取完整消息集合
1644
+ * @returns
1645
+ */
1646
+ getAllMessages() {
1647
+ return this.messages.value.map((e) => e._origin);
1648
+ }
1649
+ /**
1650
+ * 提问
1651
+ *
1652
+ * @author chitanda
1653
+ * @date 2023-10-09 20:10:43
1654
+ * @return {*} {Promise<void>}
1655
+ */
1656
+ async question(e) {
1657
+ try {
1658
+ this.isLoading.value = !0, this.messages.value.forEach((s, i) => {
1659
+ const o = s._origin;
1660
+ o.suggestions && (o.suggestions = void 0, this.messages.value[i].replace(o));
1661
+ }), this.messages.value = [...this.messages.value], this.asyncToIndexDB();
1662
+ let t = this.stringlyMaterialResource(!1);
1663
+ t ? t += "\n".concat(e) : t = e, this.addMessage({
1664
+ state: 30,
1665
+ messageid: qxUtil.createUUID(),
1666
+ role: "USER",
1667
+ type: "DEFAULT",
1668
+ content: t,
1669
+ status: "sent"
1670
+ }), await this.opts.question(
1671
+ this,
1672
+ this.context,
1673
+ this.params,
1674
+ { appDataEntityId: this.appDataEntityId },
1675
+ this.getMessages(),
1676
+ this.chatSessionid,
1677
+ this.activeAIAgentID,
1678
+ this.chatMode
1679
+ ), await this.updateTopicCaption(), this.opts.action && this.opts.action("question", e), this.isLoading.value = !1;
1680
+ } finally {
1681
+ this.isLoading.value = !1;
1682
+ }
1683
+ }
1684
+ /**
1685
+ * 中断请求
1686
+ *
1687
+ * @author tony001
1688
+ * @date 2025-03-10 14:03:48
1689
+ */
1690
+ async abortQuestion() {
1691
+ try {
1692
+ await this.opts.abortQuestion(this, this.context, this.params, {
1693
+ appDataEntityId: this.appDataEntityId,
1694
+ sessionid: this.chatSessionid,
1695
+ srfaiagent: this.activeAIAgentID,
1696
+ srfmode: this.chatMode
1697
+ });
1698
+ } finally {
1699
+ this.isLoading.value = !1;
1700
+ }
1701
+ }
1702
+ /**
1703
+ * 回填选中的消息
1704
+ *
1705
+ * @author chitanda
1706
+ * @date 2023-10-16 18:10:19
1707
+ * @param {IChatMessage} message
1708
+ */
1709
+ backfill(e) {
1710
+ this.opts.action && this.opts.action("backfill", e);
1711
+ }
1712
+ /**
1713
+ *
1714
+ * 删除指定消息,如果是用户提问的刷新调用的删除,则需要删除从问题开始到最后的所有记录
1715
+ * @param {IChatMessage} message
1716
+ * @param {boolean} [isuser=false]
1717
+ * @memberof AiChatController
1718
+ */
1719
+ async deleteMessage(e) {
1720
+ const t = this.messages.value.findIndex(
1721
+ (s) => s.messageid === e.messageid
1722
+ );
1723
+ t !== -1 && (this.messages.value.splice(t, 1), this.messages.value = [...this.messages.value]), this.asyncToIndexDB(), this.resourceMode === "REMOTE" && this.resourceOptions && e.realmessageid && await this.resourceOptions.deleteMessage(e.realmessageid), this.opts.action && this.opts.action("deletemsg", e);
1724
+ }
1725
+ /**
1726
+ * 刷新当前消息
1727
+ *
1728
+ * @memberof AiChatController
1729
+ */
1730
+ async refreshMessage(e, t = !1) {
1731
+ this.isLoading.value = !0;
1732
+ try {
1733
+ const s = this.messages.value.findIndex(
1734
+ (i) => i.messageid === e.messageid
1735
+ );
1736
+ if (t)
1737
+ this.messages.value.splice(s + 1, this.messages.value.length - s - 1), this.messages.value = [...this.messages.value], await this.opts.question(
1738
+ this,
1739
+ this.context,
1740
+ this.params,
1741
+ { appDataEntityId: this.appDataEntityId },
1742
+ this.getMessages(),
1743
+ this.chatSessionid,
1744
+ this.activeAIAgentID,
1745
+ this.chatMode
1746
+ );
1747
+ else if (s === this.messages.value.length - 1)
1748
+ this.messages.value.pop(), this.messages.value = [...this.messages.value], await this.opts.question(
1749
+ this,
1750
+ this.context,
1751
+ this.params,
1752
+ { appDataEntityId: this.appDataEntityId },
1753
+ this.getMessages(),
1754
+ this.chatSessionid,
1755
+ this.activeAIAgentID,
1756
+ this.chatMode
1757
+ );
1758
+ else {
1759
+ const i = this.messages.value[s - 1].content;
1760
+ this.messages.value.splice(s - 1, 2), this.question(i);
1761
+ }
1762
+ this.asyncToIndexDB(), this.opts.action && this.opts.action("refreshmsg", e);
1763
+ } finally {
1764
+ this.isLoading.value = !1;
1765
+ }
1766
+ }
1767
+ /**
1768
+ * 复制消息
1769
+ *
1770
+ * @param {IChatMessage} message
1771
+ * @memberof AiChatController
1772
+ */
1773
+ copyMessage(e) {
1774
+ const t = e.realcontent;
1775
+ Z.copy(t), this.opts.action && this.opts.action("copymsg", e);
1776
+ }
1777
+ /**
1778
+ * 重置对话(清空当前对话、查询历史)
1779
+ * @returns
1780
+ */
1781
+ async resetTopic() {
1782
+ let e = !0;
1783
+ return e = await this.clearTopic(), e && (await this.fecthHistory(), e);
1784
+ }
1785
+ /**
1786
+ * 清空对话
1787
+ * @returns
1788
+ */
1789
+ async clearTopic() {
1790
+ let e = !0;
1791
+ if (await this.abortQuestion(), this.topicId)
1792
+ this.topicId && this.aiTopic && (this.currentTopicDisableStorage ? e = !0 : this.resourceMode === "LOCAL" ? e = await x.deleteData(
1793
+ I.DATA_BASE_NAME,
1794
+ I.DATA_TABLE_NAME,
1795
+ this.getHistoryStoreKey(this.topicId)
1796
+ ) : this.resourceMode === "REMOTE" && (e = await this.aiTopic.clearMessagesByTopicId(this.topicId)));
1797
+ else if (this.resourceMode === "REMOTE" && this.resourceOptions) {
1798
+ const t = await this.resourceOptions.getSessionList({
1799
+ n_session_id_eq: this.chatSessionid
1800
+ });
1801
+ t && t.length > 0 && (e = await this.resourceOptions.clearAllMessageBySessionId(
1802
+ t[0].realid
1803
+ ));
1804
+ }
1805
+ return e && (this.messages.value = [], e);
1806
+ }
1807
+ /**
1808
+ * 新建话题
1809
+ */
1810
+ async newTopic() {
1811
+ this.topicId && this.aiTopic && this.aiTopic.newTopic(this.topicId, {
1812
+ activeAIAgentID: this.activeAIAgentID,
1813
+ sessionid: "".concat(G(this.chatSessionid), "@").concat((/* @__PURE__ */ new Date()).getTime())
1814
+ });
1815
+ }
1816
+ /**
1817
+ * 新增素材资源
1818
+ *
1819
+ * @author tony001
1820
+ * @date 2025-02-27 18:02:00
1821
+ * @param {IMaterial} data
1822
+ */
1823
+ addMaterial(e) {
1824
+ this.materials.value.find((s) => s.id === e.id) ? this.materials.value = [...this.materials.value] : this.materials.value = [...this.materials.value, new F(e)];
1825
+ }
1826
+ /**
1827
+ * 替换素材资源
1828
+ *
1829
+ * @author tony001
1830
+ * @date 2025-02-28 15:02:24
1831
+ * @param {string} id
1832
+ * @param {IMaterial} data
1833
+ */
1834
+ replaceMaterial(e, t) {
1835
+ const s = this.materials.value.findIndex((i) => i.id === e);
1836
+ s !== -1 ? (this.materials.value[s] = new F(t), this.materials.value = [...this.materials.value]) : this.materials.value = [...this.materials.value, new F(t)];
1837
+ }
1838
+ /**
1839
+ * 删除指定素材资源
1840
+ *
1841
+ * @author tony001
1842
+ * @date 2025-02-27 18:02:33
1843
+ * @param {IMaterial} data
1844
+ */
1845
+ deleteMaterial(e) {
1846
+ const t = this.materials.value.findIndex((s) => s.id === e.id);
1847
+ t !== -1 && (this.materials.value.splice(t, 1), this.materials.value = [...this.materials.value]);
1848
+ }
1849
+ /**
1850
+ * 更新指定消息推荐提示
1851
+ *
1852
+ * @author tony001
1853
+ * @date 2025-03-19 11:03:47
1854
+ * @param {IChatMessage} data
1855
+ * @param {string} suggestionStr
1856
+ */
1857
+ updateRecommendPrompt(e, t) {
1858
+ if (!t)
1859
+ return;
1860
+ const s = this.messages.value.findIndex(
1861
+ (o) => o.messageid === e.messageid
1862
+ ), { suggestions: i } = Le.parseMixedContent(t);
1863
+ i && i.length > 0 && (e.suggestions = i, s !== -1 ? (this.messages.value[s] = new L(e), this.messages.value = [...this.messages.value]) : this.messages.value = [...this.messages.value, new L(e)], this.asyncToIndexDB());
1864
+ }
1865
+ /**
1866
+ * 处理建议点击
1867
+ *
1868
+ * @author tony001
1869
+ * @date 2025-03-19 12:03:25
1870
+ * @param {IChatMessage} message
1871
+ * @param {IChatSuggestion} suggestion
1872
+ * @param {MouseEvent} event
1873
+ * @return {*} {Promise<void>}
1874
+ */
1875
+ async handleSuggestionClick(e, t, s) {
1876
+ var l;
1877
+ const i = this.messages.value.findIndex(
1878
+ (h) => h.messageid === e.messageid
1879
+ );
1880
+ if (i !== -1) {
1881
+ const h = this.messages.value[i]._origin;
1882
+ h.suggestions = void 0, this.messages.value[i].replace(h), this.messages.value = [...this.messages.value];
1883
+ }
1884
+ this.asyncToIndexDB();
1885
+ const { type: o, metadata: n } = t;
1886
+ switch (o) {
1887
+ case "action":
1888
+ if (this.opts.extendToolbarClick) {
1889
+ const h = t.data.actionid, c = t.data.appid;
1890
+ if (!h)
1891
+ throw new Error("actionid不能为空");
1892
+ this.addMessage({
1893
+ messageid: qxUtil.createUUID(),
1894
+ state: 30,
1895
+ type: "DEFAULT",
1896
+ role: "USER",
1897
+ content: n.content_name,
1898
+ status: "sent"
1899
+ });
1900
+ const u = { ...e };
1901
+ Object.assign(u, { topic: this.topic }), u.msg.realcontent = e.realcontent;
1902
+ const d = await this.opts.extendToolbarClick(
1903
+ s,
1904
+ {
1905
+ id: h,
1906
+ // 是否是插件应用(建议里面定义appid认为是插件应用的界面行为)
1907
+ isPluginApp: !!c,
1908
+ appId: c || this.context.srfappid
1909
+ },
1910
+ this.context,
1911
+ this.params,
1912
+ u
1913
+ ), p = (l = d == null ? void 0 : d.data) == null ? void 0 : l[0];
1914
+ p.content && this.addMessage({
1915
+ messageid: qxUtil.createUUID(),
1916
+ state: 30,
1917
+ type: p.type || "DEFAULT",
1918
+ role: p.role || "ASSISTANT",
1919
+ content: p.content,
1920
+ status: "sent"
1921
+ });
1922
+ }
1923
+ break;
1924
+ case "raw":
1925
+ await this.question(t.data.content);
1926
+ break;
1927
+ default:
1928
+ throw new Error("不支持".concat(o, "推荐类型"));
1929
+ }
1930
+ }
1931
+ /**
1932
+ * 设置当前激活的AI助手ID
1933
+ * @param agentID
1934
+ */
1935
+ async setActiveAIAgentID(e) {
1936
+ this.activeAIAgentID = e, this.topicId && this.aiTopic && this.aiTopic.updateTopicChatByID(this.topicId, {
1937
+ activeAIAgentID: e
1938
+ });
1939
+ }
1940
+ /**
1941
+ * 更新当前话题标题
1942
+ */
1943
+ async updateTopicCaption() {
1944
+ const e = this.messages.value.find((t) => t.role === "USER");
1945
+ if (e) {
1946
+ if (this.topicId && this.aiTopic)
1947
+ this.aiTopic.updateTopicCaption(this.topicId, e.content);
1948
+ else if (this.resourceMode === "REMOTE" && this.resourceOptions) {
1949
+ const t = await this.resourceOptions.getSessionList({
1950
+ n_session_id_eq: this.chatSessionid
1951
+ });
1952
+ if (t && t.length > 0) {
1953
+ const s = e.content.substring(0, 15) || this.opts.caption;
1954
+ if (t[0].caption === s)
1955
+ return;
1956
+ await this.resourceOptions.updateSession(t[0].realid, {
1957
+ caption: s
1958
+ });
1959
+ }
1960
+ }
1961
+ }
1962
+ }
1963
+ /**
1964
+ * @description 消息点赞
1965
+ * @param {IChatMessage} message
1966
+ * @returns {*} {Promise<void>}
1967
+ * @memberof AiChatController
1968
+ */
1969
+ async messageLike(e) {
1970
+ const t = e.islike === "1", s = e.realmessageid;
1971
+ if (!s || !this.resourceOptions)
1972
+ return;
1973
+ (t ? await this.resourceOptions.cancelFeedback(s) : await this.resourceOptions.likeMessage(s)) && (e.islike = t ? "0" : "1", !t && e.isdislike === "1" && (e.isdislike = "0"), this.replaceMessage(e, !1));
1974
+ }
1975
+ /**
1976
+ * @description 消息点踩
1977
+ * @param {IChatMessage} message
1978
+ * @returns {*} {Promise<void>}
1979
+ * @memberof AiChatController
1980
+ */
1981
+ async messageDisLike(e) {
1982
+ const t = e.isdislike === "1", s = e.realmessageid, i = e.feedbackcontent;
1983
+ if (!s || !this.resourceOptions)
1984
+ return;
1985
+ (t ? await this.resourceOptions.cancelFeedback(s) : await this.resourceOptions.dislikeMessage(s, i)) && (e.isdislike = t ? "0" : "1", !t && e.islike === "1" && (e.islike = "0"), this.replaceMessage(e, !1));
1986
+ }
1987
+ /**
1988
+ * 销毁
1989
+ *
1990
+ * @return {*} {Promise<void>}
1991
+ * @memberof AiChatController
1992
+ */
1993
+ async destroyed() {
1994
+ await this.abortQuestion(), this.evt.reset();
1995
+ }
1996
+ }
1997
+ class _e {
1998
+ /**
1999
+ * Creates an instance of AiTopicController.
2000
+ * @author tony001
2001
+ * @date 2025-02-24 11:02:26
2002
+ * @param {ChatController} chat
2003
+ */
2004
+ constructor(e) {
2005
+ /**
2006
+ * 话题清单
2007
+ *
2008
+ * @author tony001
2009
+ * @date 2025-02-20 16:02:38
2010
+ * @type {Signal<ChatTopic[]>}
2011
+ */
2012
+ v(this, "topics", vue.ref([]));
2013
+ /**
2014
+ * 激活话题
2015
+ *
2016
+ * @author tony001
2017
+ * @date 2025-02-24 16:02:44
2018
+ * @type {(Signal<ITopic | undefined>)}
2019
+ */
2020
+ v(this, "activedTopic", vue.ref(void 0));
2021
+ /**
2022
+ * 当前话题配置备份
2023
+ *
2024
+ * @author tony001
2025
+ * @date 2025-02-24 16:02:28
2026
+ * @public
2027
+ * @type {(ITopicOptions | undefined)}
2028
+ */
2029
+ v(this, "backupOptions");
2030
+ /**
2031
+ * 远程会话列表
2032
+ */
2033
+ v(this, "remoteSessionList", []);
2034
+ /**
2035
+ * 资源模式
2036
+ */
2037
+ v(this, "resourceMode", "LOCAL");
2038
+ /**
2039
+ * 资源选项
2040
+ */
2041
+ v(this, "resourceOptions");
2042
+ this.chat = e;
2043
+ }
2044
+ /**
2045
+ * 注入资源选项
2046
+ * @param resourceOptions
2047
+ */
2048
+ injectResourceOptions(e) {
2049
+ this.resourceMode = (e == null ? void 0 : e.resourceMode) || "LOCAL", this.resourceOptions = e;
2050
+ }
2051
+ /**
2052
+ * 获取历史话题
2053
+ *
2054
+ * @author tony001
2055
+ * @date 2025-02-23 16:02:37
2056
+ * @return {*} {Promise<void>}
2057
+ */
2058
+ async fetchHistory(e) {
2059
+ this.topics.value = [];
2060
+ const s = await e.configService(
2061
+ e.appid,
2062
+ "aitopics",
2063
+ e.type
2064
+ ).load();
2065
+ s && s.length > 0 && (this.resourceMode === "REMOTE" && this.resourceOptions ? (this.remoteSessionList = await this.resourceOptions.getSessionList(), await this.asyncRemoteSession(s)) : s.forEach((i, o) => {
2066
+ Object.prototype.hasOwnProperty.call(i, "sequence") || (i.sequence = o), Object.prototype.hasOwnProperty.call(i, "isTop") || (i.isTop = 0), this.topics.value = [...this.topics.value, new $(i)];
2067
+ }));
2068
+ }
2069
+ /**
2070
+ * 同步远程会话
2071
+ * @param configList config存储数据
2072
+ */
2073
+ async asyncRemoteSession(e) {
2074
+ !this.remoteSessionList || this.remoteSessionList.length === 0 || !e || e.length === 0 || this.remoteSessionList.forEach((t) => {
2075
+ const s = e.find((i) => {
2076
+ var o;
2077
+ return ((o = i.aiChat) == null ? void 0 : o.sessionid) === t.session_id;
2078
+ });
2079
+ s && (s.realid = t.realid, s.sequence = t.sequence, s.isTop = t.is_top ? t.is_top : 0, t.caption && (s.caption = t.caption), this.topics.value = [...this.topics.value, new $(s)]);
2080
+ });
2081
+ }
2082
+ /**
2083
+ * 同步当前话题
2084
+ *
2085
+ * @author tony001
2086
+ * @date 2025-02-23 17:02:43
2087
+ * @param {ITopicOptions} options
2088
+ * @return {*} {Promise<void>}
2089
+ */
2090
+ async asyncTopic(e) {
2091
+ this.backupOptions = e;
2092
+ const t = this.topics.value.findIndex(
2093
+ (i) => i.id === e.id
2094
+ ), s = new $(e);
2095
+ t !== -1 ? this.topics.value.splice(t, 1, s) : this.topics.value = [...this.topics.value, s], await this.updateTopic(e), this.activedTopic.value = s;
2096
+ }
2097
+ /**
2098
+ * 获取指定标识话题
2099
+ * @param topicid
2100
+ * @returns
2101
+ */
2102
+ getCurrentTopicByID(e) {
2103
+ const t = this.topics.value.find((s) => s.id === e);
2104
+ return t && t.data ? new $({ ...t.data }) : void 0;
2105
+ }
2106
+ /**
2107
+ * 基于话题标识更新当前话题
2108
+ * @param topicid 话题标识
2109
+ */
2110
+ async updateTopicChatByID(e, t) {
2111
+ if (!e || !t || !this.backupOptions)
2112
+ return;
2113
+ const s = this.topics.value.findIndex(
2114
+ (i) => i.id === e
2115
+ );
2116
+ s === -1 || !this.topics.value[s].data.aiChat || (this.topics.value[s].data.aiChat = {
2117
+ ...this.topics.value[s].data.aiChat,
2118
+ ...t
2119
+ }, await this.updateTopic(this.backupOptions));
2120
+ }
2121
+ /**
2122
+ * 删除话题
2123
+ *
2124
+ * @author tony001
2125
+ * @date 2025-02-24 16:02:03
2126
+ * @param {ITopicOptions} options
2127
+ * @param {object} context
2128
+ * @param {object} params
2129
+ * @param {ITopic} data
2130
+ * @param {MouseEvent} event
2131
+ * @return {*} {Promise<void>}
2132
+ */
2133
+ async removeTopic(e, t, s, i, o) {
2134
+ var c;
2135
+ let n = !0;
2136
+ if (e.beforeDelete && (n = await e.beforeDelete(t, s, i, o)), !n)
2137
+ return;
2138
+ let l = !1;
2139
+ if (i && i.disableStorage)
2140
+ l = !0;
2141
+ else if (this.resourceMode === "LOCAL")
2142
+ l = await x.deleteData(
2143
+ I.DATA_BASE_NAME,
2144
+ I.DATA_TABLE_NAME,
2145
+ i.id
2146
+ );
2147
+ else if (this.resourceMode === "REMOTE" && this.resourceOptions) {
2148
+ if (i.realid)
2149
+ l = await this.resourceOptions.deleteSession(i.realid);
2150
+ else if (i.aiChat && i.aiChat.sessionid) {
2151
+ const u = await this.resourceOptions.getSessionList({
2152
+ n_session_id_eq: i.aiChat.sessionid
2153
+ });
2154
+ u && u.length > 0 ? l = await this.resourceOptions.deleteSession(
2155
+ u[0].realid
2156
+ ) : l = !0;
2157
+ }
2158
+ }
2159
+ if (!l)
2160
+ return;
2161
+ const h = this.topics.value.findIndex(
2162
+ (u) => u.id === i.id
2163
+ );
2164
+ h !== -1 && (this.topics.value.splice(h, 1), this.topics.value = [...this.topics.value]), await this.updateTopic(e), this.topics.value.length > 0 && i.id === ((c = this.activedTopic.value) == null ? void 0 : c.id) && this.handleTopicChange(this.topics.value[0]);
2165
+ }
2166
+ /**
2167
+ * 处理选中变化
2168
+ *
2169
+ * @author tony001
2170
+ * @date 2025-02-20 19:02:27
2171
+ * @param {ChatTopic} item
2172
+ */
2173
+ handleTopicChange(e) {
2174
+ var t;
2175
+ ((t = this.activedTopic.value) == null ? void 0 : t.id) !== e.id && (this.activedTopic.value = e, this.chat.switchAiChatController(e));
2176
+ }
2177
+ /**
2178
+ * 处理话题行为
2179
+ *
2180
+ * @author tony001
2181
+ * @date 2025-02-24 16:02:58
2182
+ * @param {string} action
2183
+ * @param {ChatTopic} topic
2184
+ * @param {MouseEvent} event
2185
+ * @return {*} {Promise<void>}
2186
+ */
2187
+ async handleTopicAction(e, t, s) {
2188
+ var o, n;
2189
+ const i = this.topics.value.find((l) => l.id === t.id);
2190
+ if (this.backupOptions && i && i.aiChat) {
2191
+ const { context: l, params: h } = i.aiChat;
2192
+ switch (e) {
2193
+ case "DELETE":
2194
+ await this.removeTopic(
2195
+ this.backupOptions,
2196
+ l,
2197
+ h,
2198
+ i,
2199
+ s
2200
+ );
2201
+ break;
2202
+ case "RENAME":
2203
+ case "PINNED":
2204
+ if (e === "PINNED" && (t.data.isTop = t.data.isTop === 0 ? 1 : 0, this.topics.value = [...this.topics.value]), t && !t.disableStorage && (await this.updateTopic(this.backupOptions), t && this.resourceMode === "REMOTE" && this.resourceOptions)) {
2205
+ if (t.realid)
2206
+ await this.resourceOptions.updateSession(t.realid, {
2207
+ caption: t.caption,
2208
+ is_top: t.isTop
2209
+ });
2210
+ else if (t.aiChat && t.aiChat.sessionid) {
2211
+ const c = await this.resourceOptions.getSessionList({
2212
+ n_session_id_eq: t.aiChat.sessionid
2213
+ });
2214
+ c && c.length > 0 && await this.resourceOptions.updateSession(
2215
+ c[0].realid,
2216
+ {
2217
+ caption: t.caption,
2218
+ is_top: t.isTop
2219
+ }
2220
+ );
2221
+ }
2222
+ }
2223
+ break;
2224
+ }
2225
+ (n = (o = this.backupOptions).action) == null || n.call(o, e, l, h, t, s);
2226
+ }
2227
+ }
2228
+ /**
2229
+ * 清空指定话题的消息
2230
+ * @param topicID
2231
+ * @returns
2232
+ */
2233
+ async clearMessagesByTopicId(e) {
2234
+ let t = !0;
2235
+ if (!e || !this.backupOptions)
2236
+ return t;
2237
+ const s = this.topics.value.findIndex(
2238
+ (o) => o.id === e
2239
+ );
2240
+ if (s === -1 || !this.topics.value[s].data)
2241
+ return t;
2242
+ const i = this.topics.value[s];
2243
+ if (!i || i.disableStorage)
2244
+ return t;
2245
+ if (this.resourceMode === "REMOTE" && this.resourceOptions) {
2246
+ if (i.realid)
2247
+ t = await this.resourceOptions.clearAllMessageBySessionId(
2248
+ i.realid
2249
+ );
2250
+ else if (i.aiChat && i.aiChat.sessionid) {
2251
+ const o = await this.resourceOptions.getSessionList({
2252
+ n_session_id_eq: i.aiChat.sessionid
2253
+ });
2254
+ o && o.length > 0 && (t = await this.resourceOptions.clearAllMessageBySessionId(
2255
+ o[0].realid
2256
+ ));
2257
+ }
2258
+ if (!t)
2259
+ return t;
2260
+ }
2261
+ return t;
2262
+ }
2263
+ /**
2264
+ * 新建对话
2265
+ *
2266
+ * @author tony001
2267
+ * @date 2025-03-18 18:03:49
2268
+ * @return {*} {Promise<void>}
2269
+ */
2270
+ async newTopic(e, t) {
2271
+ var u;
2272
+ if (!e)
2273
+ return;
2274
+ const s = this.getCurrentTopicByID(e);
2275
+ if (!s)
2276
+ return;
2277
+ const i = G(s.id), o = this.topics.value.filter((d) => d.id.startsWith(i));
2278
+ t && s.aiChat && (s.data.aiChat = {
2279
+ ...s.aiChat,
2280
+ ...t
2281
+ });
2282
+ let n = "";
2283
+ s.captionMode === "default" ? n = "".concat((u = s.sourceCaption) == null ? void 0 : u.split("_")[0], "_").concat(o.length) : n = "新会话";
2284
+ const l = Math.max(
2285
+ ...this.topics.value.map((d) => d.sequence)
2286
+ ), h = {
2287
+ appid: s.appid,
2288
+ // 源头数据id@当前时间戳
2289
+ id: "".concat(i, "@").concat(Date.now()),
2290
+ type: s.type,
2291
+ captionMode: s.captionMode,
2292
+ captionFilled: !1,
2293
+ caption: n,
2294
+ sourceCaption: s.sourceCaption,
2295
+ url: s.url,
2296
+ aiChat: s.aiChat,
2297
+ sequence: l + 1,
2298
+ isTop: 0,
2299
+ disableStorage: s.disableStorage
2300
+ }, c = new $(h);
2301
+ this.topics.value = [...this.topics.value, c], this.backupOptions && await this.updateTopic(this.backupOptions), this.handleTopicChange(c);
2302
+ }
2303
+ /**
2304
+ * 清空话题
2305
+ * - 当前激活项不清空
2306
+ * @return {*} {Promise<void>}
2307
+ * @memberof AiTopicController
2308
+ */
2309
+ async clearTopic() {
2310
+ var i;
2311
+ const e = this.topics.value.find(
2312
+ (o) => {
2313
+ var n;
2314
+ return o.id === ((n = this.activedTopic.value) == null ? void 0 : n.id);
2315
+ }
2316
+ );
2317
+ if (!this.backupOptions || !e)
2318
+ return;
2319
+ let t = !0;
2320
+ if (this.backupOptions.beforeDelete && (t = await this.backupOptions.beforeDelete(
2321
+ e.aiChat.context,
2322
+ e.aiChat.params,
2323
+ e,
2324
+ void 0,
2325
+ !0
2326
+ )), !t)
2327
+ return;
2328
+ let s = !1;
2329
+ if (this.resourceMode === "LOCAL")
2330
+ await Promise.all(
2331
+ this.topics.value.map((o) => {
2332
+ if (o.id !== (e == null ? void 0 : e.id) && !o.disableStorage)
2333
+ return x.deleteData(
2334
+ I.DATA_BASE_NAME,
2335
+ I.DATA_TABLE_NAME,
2336
+ o.id
2337
+ );
2338
+ })
2339
+ ), s = !0;
2340
+ else if (this.resourceMode === "REMOTE")
2341
+ if (e && this.resourceOptions) {
2342
+ const o = (i = e.aiChat) == null ? void 0 : i.sessionid;
2343
+ o ? s = await this.resourceOptions.clearAllSession(o) : s = !0;
2344
+ } else
2345
+ s = !0;
2346
+ s && (this.topics.value = e ? [e] : [], await this.updateTopic(this.backupOptions));
2347
+ }
2348
+ /**
2349
+ * 更新话题标题
2350
+ * @param topicId
2351
+ * @param message
2352
+ */
2353
+ async updateTopicCaption(e, t) {
2354
+ const s = this.topics.value.find((i) => i.id === e);
2355
+ if (s && !s.captionFilled) {
2356
+ if (s.captionMode !== "default") {
2357
+ switch (s.captionMode) {
2358
+ case "snippet":
2359
+ s.data.caption = t.substring(0, 15);
2360
+ break;
2361
+ }
2362
+ this.topics.value = [...this.topics.value], this.backupOptions && await this.updateTopic(this.backupOptions);
2363
+ }
2364
+ if (s.disableStorage)
2365
+ return;
2366
+ if (this.resourceMode === "REMOTE" && this.resourceOptions) {
2367
+ if (s.realid)
2368
+ await this.resourceOptions.updateSession(s.realid, {
2369
+ caption: s.caption
2370
+ });
2371
+ else if (s.aiChat && s.aiChat.sessionid) {
2372
+ const i = await this.resourceOptions.getSessionList({
2373
+ n_session_id_eq: s.aiChat.sessionid
2374
+ });
2375
+ if (i && i.length > 0) {
2376
+ if (i[0].caption === s.caption)
2377
+ return;
2378
+ await this.resourceOptions.updateSession(i[0].realid, {
2379
+ caption: s.caption
2380
+ });
2381
+ }
2382
+ }
2383
+ }
2384
+ s.data.captionFilled = !0;
2385
+ }
2386
+ }
2387
+ /**
2388
+ * 更新话题数据
2389
+ *
2390
+ * @param {ITopicOptions} options 话题配置
2391
+ * @return {*} {Promise<void>}
2392
+ * @memberof AiTopicController
2393
+ */
2394
+ async updateTopic(e) {
2395
+ if (!e)
2396
+ return;
2397
+ const t = [];
2398
+ this.topics.value.forEach((i) => {
2399
+ i.disableStorage || t.push({
2400
+ appid: i.appid,
2401
+ id: i.id,
2402
+ type: i.type,
2403
+ captionMode: i.captionMode,
2404
+ captionFilled: i.captionFilled,
2405
+ caption: i.caption || i.sourceCaption,
2406
+ sourceCaption: i.sourceCaption,
2407
+ url: i.url,
2408
+ aiChat: i.aiChat,
2409
+ isTop: i.isTop,
2410
+ sequence: i.sequence
2411
+ });
2412
+ });
2413
+ const s = e.configService(
2414
+ e.appid,
2415
+ "aitopics",
2416
+ e.type
2417
+ );
2418
+ await (s == null ? void 0 : s.save(t));
2419
+ }
2420
+ }
2421
+ class ee {
2422
+ constructor(e) {
2423
+ this.aiChat = e;
2424
+ }
2425
+ }
2426
+ class je extends ee {
2427
+ /**
2428
+ * 执行操作
2429
+ *
2430
+ * @author tony001
2431
+ * @date 2025-02-28 15:02:48
2432
+ * @return {*} {Promise<void>}
2433
+ */
2434
+ async excuteAction(e, t) {
2435
+ let s;
2436
+ if (t && t.onClick && typeof t.onClick == "function")
2437
+ s = await t.onClick(
2438
+ e,
2439
+ t,
2440
+ this.aiChat.context,
2441
+ this.aiChat.params
2442
+ );
2443
+ else {
2444
+ const i = this.aiChat.opts.extendToolbarClick;
2445
+ i ? s = await i(
2446
+ e,
2447
+ t,
2448
+ this.aiChat.context,
2449
+ this.aiChat.params,
2450
+ {}
2451
+ ) : console.error("未找到扩展工具栏点击事件");
2452
+ }
2453
+ if (s && s.data && s.data.length > 0) {
2454
+ const i = s.data[0], o = {
2455
+ id: i.id,
2456
+ type: i.type,
2457
+ data: i.data || {},
2458
+ metadata: i.metadata || {}
2459
+ };
2460
+ t.id && Object.assign(o.metadata, { actionId: t.id }), this.aiChat.addMaterial(o);
2461
+ }
2462
+ }
2463
+ }
2464
+ class Ne extends ee {
2465
+ /**
2466
+ * 执行操作
2467
+ *
2468
+ * @author tony001
2469
+ * @date 2025-02-28 15:02:27
2470
+ * @return {*} {Promise<void>}
2471
+ */
2472
+ async excuteAction(e, t) {
2473
+ const s = this.aiChat.opts.uploader, {
2474
+ multiple: i,
2475
+ accept: o,
2476
+ maxSize: n,
2477
+ onSelect: l,
2478
+ onUpload: h,
2479
+ onSuccess: c,
2480
+ onError: u,
2481
+ onProgress: d
2482
+ } = s, p = {
2483
+ multiple: i || !0,
2484
+ accept: o || "*/*",
2485
+ maxSize: n || 5 * 1024 * 1024,
2486
+ onSelect: (m) => {
2487
+ l == null || l(m), m.length > 0 && m.forEach((b) => {
2488
+ const y = this.buildMaterialObject(b);
2489
+ Object.assign(y.metadata, { state: "uploading" }), this.aiChat.addMaterial(y);
2490
+ });
2491
+ },
2492
+ onUpload: async (m, b) => h(m, b, {
2493
+ context: this.aiChat.context,
2494
+ params: this.aiChat.params
2495
+ }),
2496
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2497
+ onSuccess: (m, b) => {
2498
+ const y = {
2499
+ id: m.id,
2500
+ type: "ossfile",
2501
+ data: {
2502
+ id: m.id,
2503
+ name: m.name
2504
+ },
2505
+ metadata: {
2506
+ ext: m.ext,
2507
+ fileext: m.fileext,
2508
+ fileid: m.fileid,
2509
+ filename: m.filename,
2510
+ size: m.size,
2511
+ filesize: m.filesize,
2512
+ state: "successed"
2513
+ }
2514
+ };
2515
+ this.aiChat.replaceMaterial(b.name, y), c == null || c(m, b);
2516
+ },
2517
+ onError: (m, b) => {
2518
+ const y = this.buildMaterialObject(b);
2519
+ Object.assign(y.metadata, { state: "failed" }), this.aiChat.replaceMaterial(b.name, y), u == null || u(m, b);
2520
+ },
2521
+ onProgress: (m, b) => {
2522
+ d == null || d(m, b);
2523
+ }
2524
+ };
2525
+ new Oe(p).openFilePicker();
2526
+ }
2527
+ /**
2528
+ * 构建素材对象
2529
+ *
2530
+ * @author tony001
2531
+ * @date 2025-02-28 15:02:12
2532
+ * @param {File} file
2533
+ * @return {*} {IMaterial}
2534
+ */
2535
+ buildMaterialObject(e) {
2536
+ return {
2537
+ id: e.name,
2538
+ type: "ossfile",
2539
+ data: {
2540
+ name: e.name,
2541
+ id: e.name
2542
+ },
2543
+ metadata: {
2544
+ size: e.size,
2545
+ type: e.type,
2546
+ lastModified: e.lastModified
2547
+ }
2548
+ };
2549
+ }
2550
+ }
2551
+ class He {
2552
+ static getMaterialHelper(e, t) {
2553
+ switch (e) {
2554
+ case "ossfile":
2555
+ return new Ne(t);
2556
+ default:
2557
+ return new je(t);
2558
+ }
2559
+ }
2560
+ }
2561
+ const Pe = vue.createVNode("svg", {
2562
+ xmlns: "http://www.w3.org/2000/svg",
2563
+ width: "24",
2564
+ height: "24",
2565
+ viewBox: "0 0 24 24",
2566
+ fill: "none",
2567
+ stroke: "currentColor",
2568
+ "stroke-width": "2",
2569
+ "stroke-linecap": "round",
2570
+ "stroke-linejoin": "round",
2571
+ "aria-hidden": "true"
2572
+ }, [vue.createVNode("path", {
2573
+ d: "M12 19v3"
2574
+ }, null), vue.createVNode("path", {
2575
+ d: "M19 10v2a7 7 0 0 1-14 0v-2"
2576
+ }, null), vue.createVNode("rect", {
2577
+ x: "9",
2578
+ y: "2",
2579
+ width: "6",
2580
+ height: "13",
2581
+ rx: "3"
2582
+ }, null)]), Ue = vue.createVNode("svg", {
2583
+ xmlns: "http://www.w3.org/2000/svg",
2584
+ width: "24",
2585
+ height: "24",
2586
+ viewBox: "0 0 24 24",
2587
+ fill: "none",
2588
+ stroke: "currentColor",
2589
+ "stroke-width": "2",
2590
+ "stroke-linecap": "round",
2591
+ "stroke-linejoin": "round",
2592
+ "aria-hidden": "true"
2593
+ }, [vue.createVNode("path", {
2594
+ d: "M12 19v3"
2595
+ }, null), vue.createVNode("path", {
2596
+ d: "M15 9.34V5a3 3 0 0 0-5.68-1.33"
2597
+ }, null), vue.createVNode("path", {
2598
+ d: "M16.95 16.95A7 7 0 0 1 5 12v-2"
2599
+ }, null), vue.createVNode("path", {
2600
+ d: "M18.89 13.23A7 7 0 0 0 19 12v-2"
2601
+ }, null), vue.createVNode("path", {
2602
+ d: "m2 2 20 20"
2603
+ }, null), vue.createVNode("path", {
2604
+ d: "M9 9v3a3 3 0 0 0 5.12 2.12"
2605
+ }, null)]), Ve = vue.createVNode("svg", {
2606
+ xmlns: "http://www.w3.org/2000/svg",
2607
+ width: "24",
2608
+ height: "24",
2609
+ viewBox: "0 0 24 24",
2610
+ fill: "none",
2611
+ stroke: "currentColor",
2612
+ "stroke-width": "2",
2613
+ "stroke-linecap": "round",
2614
+ "stroke-linejoin": "round",
2615
+ "aria-hidden": "true"
2616
+ }, [vue.createVNode("path", {
2617
+ d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"
2618
+ }, null), vue.createVNode("path", {
2619
+ d: "m21.854 2.147-10.94 10.939"
2620
+ }, null)]), Xe = vue.createVNode("svg", {
2621
+ viewBox: "0 0 1024 1024",
2622
+ version: "1.1",
2623
+ xmlns: "http://www.w3.org/2000/svg",
2624
+ "p-id": "4696",
2625
+ width: "24",
2626
+ height: "24",
2627
+ fill: "currentColor"
2628
+ }, [vue.createVNode("path", {
2629
+ d: "M512 960.2c-246 0-447.35-201.73-447.35-448.28S265.94 63.63 512 63.63s447.33 201.73 447.33 448.29S758 960.2 512 960.2z m144.3-104.38A377.09 377.09 0 0 0 855 656.7a371.79 371.79 0 0 0 0-289.57A377.09 377.09 0 0 0 656.3 168a369.15 369.15 0 0 0-288.64 0A377.18 377.18 0 0 0 169 367.13a371.79 371.79 0 0 0 0 289.57 377.18 377.18 0 0 0 198.66 199.12 369.15 369.15 0 0 0 288.64 0z",
2630
+ "p-id": "4697"
2631
+ }, null), vue.createVNode("path", {
2632
+ d: "M378.19 349.54h265.46a30.66 30.66 0 0 1 30.63 30.69v266a30.66 30.66 0 0 1-30.63 30.69H378.19a30.66 30.66 0 0 1-30.63-30.69v-266a30.66 30.66 0 0 1 30.63-30.69z",
2633
+ "p-id": "4698"
2634
+ }, null)]), q = vue.createVNode("svg", {
2635
+ viewBox: "0 0 1024 1024",
2636
+ version: "1.1",
2637
+ xmlns: "http://www.w3.org/2000/svg",
2638
+ "p-id": "9261",
2639
+ width: "24",
2640
+ height: "24",
2641
+ fill: "currentColor"
2642
+ }, [vue.createVNode("path", {
2643
+ d: "M512 20.48c271.36 0 491.52 220.16 491.52 491.52S783.36 1003.52 512 1003.52 20.48 783.36 20.48 512 240.64 20.48 512 20.48m0-20.48C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0z",
2644
+ "p-id": "9262"
2645
+ }, null), vue.createVNode("path", {
2646
+ d: "M512 226.304l-283.648 143.36v284.672l283.648 143.36L795.648 655.36V369.664L512 226.304z m54.272 370.688h-32.768l-5.12-3.072-20.48-49.152h-95.232l-20.48 49.152-4.096 3.072h-32.768l-4.096-7.168 86.016-198.656 4.096-3.072h37.888l4.096 3.072 86.016 198.656-3.072 7.168z m88.064-5.12l-5.12 5.12h-29.696l-5.12-5.12V394.24l5.12-5.12h29.696l5.12 5.12v197.632z",
2647
+ "p-id": "9263"
2648
+ }, null), vue.createVNode("path", {
2649
+ d: "M427.008 512h67.584L460.8 427.008z",
2650
+ "p-id": "9264"
2651
+ }, null)]), Je = vue.createVNode("svg", {
2652
+ fill: "currentColor",
2653
+ viewBox: "0 0 24 24"
2654
+ }, [vue.createVNode("path", {
2655
+ d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"
2656
+ }, null)]), Ye = vue.createVNode("svg", {
2657
+ width: "16",
2658
+ height: "16",
2659
+ viewBox: "0 0 50 50",
2660
+ xmlns: "http://www.w3.org/2000/svg"
2661
+ }, [vue.createVNode("circle", {
2662
+ cx: "25",
2663
+ cy: "25",
2664
+ r: "20",
2665
+ fill: "none",
2666
+ stroke: "currentColor",
2667
+ "stroke-width": "5",
2668
+ "stroke-dasharray": "31.415, 31.415",
2669
+ "stroke-linecap": "round"
2670
+ }, [vue.createVNode("animateTransform", {
2671
+ attributeName: "transform",
2672
+ type: "rotate",
2673
+ from: "0 25 25",
2674
+ to: "360 25 25",
2675
+ dur: "1s",
2676
+ repeatCount: "indefinite"
2677
+ }, null)])]), Ke = vue.createVNode("svg", {
2678
+ viewBox: "0 0 16 16",
2679
+ xmlns: "http://www.w3.org/2000/svg",
2680
+ width: "16",
2681
+ height: "16",
2682
+ fill: "currentColor",
2683
+ preserveAspectRatio: "xMidYMid meet",
2684
+ focusable: "false"
2685
+ }, [vue.createVNode("g", {
2686
+ id: "agptips/check-circle",
2687
+ "stroke-width": "1",
2688
+ "fill-rule": "evenodd"
2689
+ }, [vue.createVNode("path", {
2690
+ d: "M8 16A8 8 0 118 0a8 8 0 010 16zm0-1.2A6.8 6.8 0 108 1.2a6.8 6.8 0 000 13.6zM5.666 7.207l1.8 1.845 3.482-3.554.857.84-4.34 4.43-2.658-2.723.86-.838z",
2691
+ id: "agp形状结合"
2692
+ }, null)])]), Qe = vue.createVNode("svg", {
2693
+ viewBox: "0 0 16 16",
2694
+ xmlns: "http://www.w3.org/2000/svg",
2695
+ width: "16",
2696
+ height: "16",
2697
+ fill: "currentColor",
2698
+ preserveAspectRatio: "xMidYMid meet",
2699
+ focusable: "false",
2700
+ style: "transform: rotate(-90deg);"
2701
+ }, [vue.createVNode("g", {
2702
+ id: "abfnavigation/angle-right",
2703
+ "stroke-width": "1",
2704
+ "fill-rule": "evenodd"
2705
+ }, [vue.createVNode("path", {
2706
+ d: "M7.978 11.498l-.005.005L2.3 5.831 3.13 5l4.848 4.848L12.826 5l.83.831-5.673 5.672-.005-.005z",
2707
+ id: "abf形状结合",
2708
+ transform: "rotate(-90 7.978 8.252)"
2709
+ }, null)])]), te = vue.createVNode("svg", {
2710
+ viewBox: "0 0 16 16",
2711
+ xmlns: "http://www.w3.org/2000/svg",
2712
+ width: "16",
2713
+ height: "16",
2714
+ fill: "currentColor",
2715
+ preserveAspectRatio: "xMidYMid meet",
2716
+ focusable: "false",
2717
+ style: "transform: rotate(90deg);"
2718
+ }, [vue.createVNode("g", {
2719
+ id: "abfnavigation/angle-right",
2720
+ "stroke-width": "1",
2721
+ "fill-rule": "evenodd"
2722
+ }, [vue.createVNode("path", {
2723
+ d: "M7.978 11.498l-.005.005L2.3 5.831 3.13 5l4.848 4.848L12.826 5l.83.831-5.673 5.672-.005-.005z",
2724
+ id: "abf形状结合",
2725
+ transform: "rotate(-90 7.978 8.252)"
2726
+ }, null)])]), se = vue.createVNode("svg", {
2727
+ viewBox: "0 0 1024 1024",
2728
+ version: "1.1",
2729
+ xmlns: "http://www.w3.org/2000/svg",
2730
+ "p-id": "4832",
2731
+ width: "16",
2732
+ height: "16",
2733
+ fill: "currentColor"
2734
+ }, [vue.createVNode("path", {
2735
+ d: "M707.61856 495.14624l-357.5296-357.5296c-9.30816-9.30688-24.40064-9.30688-33.70752 0-9.30816 9.30816-9.30816 24.40064 0 33.7088L657.056 512 316.38144 852.67456c-9.30816 9.30688-9.30816 24.40064 0 33.7088 4.65408 4.65536 10.75328 6.98112 16.85376 6.98112 6.10048 0 12.19968-2.32576 16.85376-6.98112l357.5296-357.5296C716.92672 519.5456 716.92672 504.4544 707.61856 495.14624z",
2736
+ "p-id": "4833"
2737
+ }, null)]), We = vue.createVNode("svg", {
2738
+ xmlns: "http://www.w3.org/2000/svg",
2739
+ width: "16",
2740
+ height: "16",
2741
+ viewBox: "0 0 24 24",
2742
+ fill: "none",
2743
+ stroke: "red",
2744
+ "stroke-width": "2",
2745
+ "stroke-linecap": "round",
2746
+ "stroke-linejoin": "round",
2747
+ "aria-hidden": "true"
2748
+ }, [vue.createVNode("path", {
2749
+ d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"
2750
+ }, null), vue.createVNode("path", {
2751
+ d: "M12 9v4"
2752
+ }, null), vue.createVNode("path", {
2753
+ d: "M12 17h.01"
2754
+ }, null)]), ie = vue.createVNode("svg", {
2755
+ xmlns: "http://www.w3.org/2000/svg",
2756
+ width: "16",
2757
+ height: "16",
2758
+ viewBox: "0 0 24 24",
2759
+ fill: "none",
2760
+ stroke: "currentColor",
2761
+ "stroke-width": "2",
2762
+ "stroke-linecap": "round",
2763
+ "stroke-linejoin": "round",
2764
+ "aria-hidden": "true"
2765
+ }, [vue.createVNode("rect", {
2766
+ width: "14",
2767
+ height: "14",
2768
+ x: "8",
2769
+ y: "8",
2770
+ rx: "2",
2771
+ ry: "2"
2772
+ }, null), vue.createVNode("path", {
2773
+ d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
2774
+ }, null)]), Ge = vue.createVNode("svg", {
2775
+ xmlns: "http://www.w3.org/2000/svg",
2776
+ viewBox: "0 0 512 512"
2777
+ }, [vue.createVNode("path", {
2778
+ fill: "none",
2779
+ stroke: "currentColor",
2780
+ "stroke-linecap": "round",
2781
+ "stroke-linejoin": "round",
2782
+ "stroke-width": "48",
2783
+ d: "M112 268l144 144 144-144M256 392V100"
2784
+ }, null)]), Ze = vue.createVNode("svg", {
2785
+ viewBox: "0 0 1024 1024",
2786
+ version: "1.1",
2787
+ xmlns: "http://www.w3.org/2000/svg",
2788
+ width: "24",
2789
+ height: "24",
2790
+ fill: "currentColor"
2791
+ }, [vue.createVNode("path", {
2792
+ d: "M938.2 671.3c-13.8 0-25 11.2-25 25v83.1c0 63.3-52.6 114.7-117.3 114.7H230.2c-64.7 0-117.3-51.5-117.3-114.7v-83.1c0-13.8-11.2-25-25-25s-25 11.2-25 25v83.1c0 90.8 75.1 164.7 167.3 164.7h565.7c92.3 0 167.3-73.9 167.3-164.7v-83.1c0-13.8-11.2-25-25-25z",
2793
+ "p-id": "7618"
2794
+ }, null), vue.createVNode("path", {
2795
+ d: "M494.4 80.8c4.7-4.7 11.1-7.4 17.7-7.4h0.1c6.7 0 13 2.7 17.7 7.4l189.7 192c9.7 9.8 9.6 25.7-0.2 35.4-9.8 9.7-25.7 9.6-35.4-0.2L538.8 161v513.7c0 13.8-11.2 25-25 25s-25-11.2-25-25V157.3L338.5 308.1c-9.7 9.8-25.6 9.8-35.4 0.1-9.8-9.7-9.8-25.6-0.1-35.4l191.4-192z",
2796
+ "p-id": "7619"
2797
+ }, null)]), et = vue.createVNode("svg", {
2798
+ viewBox: "0 0 1024 1024",
2799
+ version: "1.1",
2800
+ xmlns: "http://www.w3.org/2000/svg",
2801
+ width: "24",
2802
+ height: "24",
2803
+ fill: "currentColor"
2804
+ }, [vue.createVNode("path", {
2805
+ d: "M842.666667 285.866667l-187.733334-187.733334c-14.933333-14.933333-32-21.333333-53.333333-21.333333H234.666667C194.133333 74.666667 160 108.8 160 149.333333v725.333334c0 40.533333 34.133333 74.666667 74.666667 74.666666h554.666666c40.533333 0 74.666667-34.133333 74.666667-74.666666V337.066667c0-19.2-8.533333-38.4-21.333333-51.2z m-44.8 44.8c-2.133333 2.133333-4.266667 0-8.533334 0h-170.666666c-6.4 0-10.666667-4.266667-10.666667-10.666667V149.333333c0-2.133333 0-6.4-2.133333-8.533333 0 0 2.133333 0 2.133333 2.133333l189.866667 187.733334z m-8.533334 554.666666H234.666667c-6.4 0-10.666667-4.266667-10.666667-10.666666V149.333333c0-6.4 4.266667-10.666667 10.666667-10.666666h311.466666c-2.133333 4.266667-2.133333 6.4-2.133333 10.666666v170.666667c0 40.533333 34.133333 74.666667 74.666667 74.666667h170.666666c4.266667 0 6.4 0 10.666667-2.133334V874.666667c0 6.4-4.266667 10.666667-10.666667 10.666666z"
2806
+ }, null), vue.createVNode("path", {
2807
+ d: "M640 693.333333H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM640 522.666667H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM341.333333 416h85.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-85.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32z"
2808
+ }, null)]), ae = vue.createVNode("svg", {
2809
+ viewBox: "0 0 1024 1024",
2810
+ version: "1.1",
2811
+ xmlns: "http://www.w3.org/2000/svg",
2812
+ width: "24",
2813
+ height: "24",
2814
+ fill: "currentColor"
2815
+ }, [vue.createVNode("path", {
2816
+ d: "M557.248 511.68l135.776-135.744-45.248-45.28L512 466.432l-135.776-135.776-45.248 45.28 135.776 135.744-135.776 135.776 45.248 45.248L512 556.928l135.776 135.776 45.248-45.248-135.776-135.776zM512 64c247.136 0 448 200.864 448 448s-200.864 448-448 448S64 759.136 64 512 264.864 64 512 64z"
2817
+ }, null)]), K = vue.createVNode("svg", {
2818
+ viewBox: "0 0 1024 1024",
2819
+ version: "1.1",
2820
+ xmlns: "http://www.w3.org/2000/svg",
2821
+ fill: "currentcolor"
2822
+ }, [vue.createVNode("path", {
2823
+ d: "M511.582491 63.413262C265.134543 63.413262 64.62588 263.921925 64.62588 510.369873s200.508663 446.957635 446.957635 446.957635 446.957635-200.508663 446.957635-446.957635S758.031463 63.413262 511.582491 63.413262zM509.001713 751.859903c-98.517781 0-182.467775-62.623269-214.771505-150.056598l0.327458-0.134053c-2.007727-4.036943-3.38305-8.422833-3.38305-13.237489 0-16.647145 13.494339-30.142507 30.142507-30.142507 13.389962 0 24.358781 8.877181 28.2893 20.955264l0.422625-0.172939c23.269983 65.442478 85.645612 112.503307 158.972665 112.503307 93.106538 0 168.845523-75.738985 168.845523-168.845523s-75.738985-168.845523-168.845523-168.845523c-20.432355 0-39.874149 3.980661-58.013275 10.66899l21.248953 40.742936c2.486634 2.677992 4.0175 6.2831 4.0175 10.243295 0 8.417717-8.404414 14.921851-15.365966 15.07023-0.102331 0-0.206708 0-0.309038 0-0.220011 0-0.427742 0-0.647753-0.013303l-150.579507-6.463202c-5.372358-0.234337-10.229992-3.310396-12.716626-8.093329-2.486634-4.76963-2.236947-10.509355 0.647753-15.055904l80.890308-127.179564c2.8847-4.533246 8.006348-7.151887 13.365402-6.960529 5.372358 0.234337 10.227945 3.312442 12.71458 8.095375l18.580171 35.625382c26.629497-10.855232 55.683207-16.963347 86.168522-16.963347 126.338407 0 229.130537 102.791108 229.130537 229.130537S635.340119 751.859903 509.001713 751.859903z"
2824
+ }, null)]), tt = vue.createVNode("svg", {
2825
+ viewBox: "0 0 1024 1024",
2826
+ version: "1.1",
2827
+ xmlns: "http://www.w3.org/2000/svg",
2828
+ fill: "currentcolor"
2829
+ }, [vue.createVNode("path", {
2830
+ d: "M190.193225 471.411583c14.446014 0 26.139334-11.718903 26.139334-26.13831 0-14.44499-11.69332-26.164916-26.139334-26.164916-0.271176 0-0.490164 0.149403-0.73678 0.149403l-62.496379 0.146333c-1.425466-0.195451-2.90005-0.295735-4.373611-0.295735-19.677155 0-35.621289 16.141632-35.621289 36.114522L86.622358 888.550075c0 19.949354 15.96767 35.597753 35.670407 35.597753 1.916653 0 3.808746 0.292666 5.649674 0l61.022819 0.022513c0.099261 0 0.148379 0.048095 0.24764 0.048095 0.097214 0 0.146333-0.048095 0.24457-0.048095l0.73678 0 0-0.148379c13.413498-0.540306 24.174586-11.422144 24.174586-24.960485 0-13.55983-10.760065-24.441669-24.174586-24.981974l0-0.393973-50.949392 0 1.450025-402.275993L190.193225 471.409536z"
2831
+ }, null), vue.createVNode("path", {
2832
+ d: "M926.52241 433.948343c-19.283182-31.445176-47.339168-44.172035-81.289398-45.546336-1.77032-0.246617-3.536546-0.39295-5.380544-0.39295l-205.447139-0.688685c13.462616-39.059598 22.698978-85.58933 22.698978-129.317251 0-28.349675-3.193739-55.962569-9.041934-82.542948l-0.490164 0.049119c-10.638291-46.578852-51.736315-81.31498-100.966553-81.31498-57.264215 0-95.466282 48.15065-95.466282 106.126063 0 3.241834-0.294712 6.387477 0 9.532097-2.996241 108.386546-91.240027 195.548698-196.23636 207.513194l0 54.881958-0.785899 222.227314 0 229.744521 10.709923 0 500.025271 0.222057 8.746198-0.243547c19.35686 0.049119 30.239721-4.817726 47.803749-16.116049 16.682961-10.761088 29.236881-25.50079 37.490869-42.156122 2.260483-3.341095 4.028757-7.075139 5.106298-11.20111l77.018118-344.324116c1.056052-4.053316 1.348718-8.181333 1.056052-12.160971C943.643346 476.446249 938.781618 453.944769 926.52241 433.948343zM893.82573 486.837924l-82.983993 367.783411-0.099261-0.049119c-2.555196 6.141884-6.879688 11.596106-12.872169 15.427364-4.177136 2.727111-8.773827 4.351098-13.414521 4.964058-1.49812-0.195451-3.046383 0-4.620227 0l-477.028511-0.540306-0.171915-407.408897c89.323375-40.266076 154.841577-79.670527 188.596356-173.661202 0.072655 0.024559 0.124843 0.049119 0.195451 0.072655 2.99931-9.137101 6.313799-20.73423 8.697079-33.164331 5.551436-29.185716 5.258771-58.123792 5.258771-58.123792-4.937452-37.98001 25.940812-52.965306 44.364417-52.965306 25.304316 0.860601 50.263777 33.656541 50.263777 52.326762 0 0 5.600555 27.563776 5.649674 57.190537 0.048095 37.366026-4.6673 56.847729-4.6673 56.847729l-0.466628 0c-5.872754 30.879288-16.214287 60.138682-30.464849 86.964654l0.36839 0.342808c-2.358721 4.815679-3.709485 10.220782-3.709485 15.943111 0 19.922748 19.088754 21.742187 38.765909 21.742187l238.761895 0.270153c0 0 14.666024 0.465604 14.690584 0.465604l0 0.100284c12.132318-0.638543 24.221658 5.207605 31.100322 16.409738 5.504364 9.016351 6.437619 19.6045 3.486404 28.988218L893.82573 486.837924z"
2833
+ }, null), vue.createVNode("path", {
2834
+ d: "M264.827039 924.31872c0.319272 0.024559 0.441045 0.024559 0.295735-0.024559 0.243547-0.048095 0.367367-0.074701-0.295735-0.074701s-0.539282 0.026606-0.271176 0.074701C264.43409 924.343279 264.532327 924.343279 264.827039 924.31872z"
2835
+ }, null)]), st = vue.createVNode("svg", {
2836
+ viewBox: "0 0 1024 1024",
2837
+ version: "1.1",
2838
+ xmlns: "http://www.w3.org/2000/svg",
2839
+ fill: "currentcolor"
2840
+ }, [vue.createVNode("path", {
2841
+ d: "M190.208 552.576a26.176 26.176 0 0 1 0 52.288L189.44 604.8l-62.464-0.128a35.84 35.84 0 0 1-40-35.84l-0.384-433.28c0-19.968 16-35.648 35.712-35.648 1.92 0 3.84-0.256 5.632 0h62.272v0.128c13.44 0.576 24.192 11.456 24.192 24.96a25.024 25.024 0 0 1-24.192 24.96v0.448h-50.944l1.408 402.24h49.536z m736.32 37.504c-19.264 31.36-47.36 44.16-81.28 45.504a38.656 38.656 0 0 1-5.376 0.384l-205.44 0.704c13.44 39.04 22.656 85.568 22.656 129.28 0 28.416-3.2 56-9.024 82.56h-0.512a103.936 103.936 0 0 1-100.928 81.28c-57.28 0-95.488-48.128-95.488-106.112 0-3.2-0.32-6.4 0-9.536-3.008-108.352-91.264-195.52-196.224-207.488V551.68L254.08 329.6v-229.76h10.688l500.032-0.192 8.704 0.192c19.392 0 30.272 4.864 47.808 16.128 16.704 10.752 29.248 25.536 37.504 42.176 2.304 3.328 4.032 7.04 5.12 11.2l76.992 344.32a37.568 37.568 0 0 1 1.088 12.16c1.536 21.76-3.328 44.288-15.552 64.32z m-32.704-52.928l-83.008-367.744h-0.064a33.408 33.408 0 0 0-26.24-20.352c-1.536 0.192-3.072 0-4.672 0l-477.056 0.512-0.128 407.424c89.28 40.32 154.88 79.68 188.544 173.632h0.256c2.944 9.088 6.272 20.672 8.64 33.088 5.568 29.184 5.312 58.176 5.312 58.176-4.992 37.952 25.92 52.928 44.352 52.928 25.28-0.832 50.24-33.664 50.24-52.288 0 0 5.632-27.584 5.632-57.216 0.064-37.376-4.608-56.832-4.608-56.832h-0.512a307.84 307.84 0 0 0-30.464-87.04l0.384-0.256a36.16 36.16 0 0 1-3.712-16c0-19.84 19.072-21.76 38.784-21.76l238.72-0.192 14.72-0.512v-0.064c12.16 0.64 24.192-5.248 31.104-16.448a35.2 35.2 0 0 0 3.456-28.992h0.32zM267.52 96.768c2.048-0.192 2.816-0.192 1.92 0.128 1.536 0.32 2.304 0.512-1.92 0.512s-3.456-0.192-1.728-0.512c-0.768-0.32-0.192-0.32 1.728-0.128z"
2842
+ }, null)]), it = vue.createVNode("svg", {
2843
+ viewBox: "0 0 1024 1024",
2844
+ version: "1.1",
2845
+ xmlns: "http://www.w3.org/2000/svg",
2846
+ fill: "currentcolor"
2847
+ }, [vue.createVNode("path", {
2848
+ d: "M900.64 379.808l-263.072-256.032c-36.448-35.328-105.76-35.392-142.304 0.096l-327.04 319.904c-56.416 54.72-70.72 76.704-70.72 150.976l0 143.936c0 132.768 26.976 192 186.912 192l131.872 0c81.12 0 128.448-46.656 193.952-111.264l290.016-297.696c18.592-17.984 29.248-43.968 29.248-71.264C929.504 423.36 918.976 397.6 900.64 379.808zM323.008 786.752c-52.928 0-96-43.072-96-96s43.072-96 96-96 96 43.072 96 96S375.936 786.752 323.008 786.752z"
2849
+ }, null)]), at = vue.createVNode("svg", {
2850
+ viewBox: "0 0 1024 1024",
2851
+ version: "1.1",
2852
+ xmlns: "http://www.w3.org/2000/svg",
2853
+ fill: "currentcolor"
2854
+ }, [vue.createVNode("path", {
2855
+ d: "M843.251 424.407l43.828-74.898c10.194-17.946 32.596-22.158 48.956-11.598 16.298 10.499 23.44 32.658 14.223 49.566l-113.11 195.212-61.164-40.044-126.418-82.285c-16.115-11.598-20.632-34.428-10.194-51.702 9.705-17.397 31.009-23.501 47.857-13.734l89.67 59.028C748.576 295.547 615.81 180.667 461.008 180.667c-177.387 0-320.042 148.758-320.042 331.335 0 183.613 143.692 331.334 319.981 331.334 107.861 0.184 208.58-56.158 268.034-149.858 1.099-1.038 1.099-2.075 2.075-2.075 6.348-9.949 17.092-15.871 28.568-15.81 19.35 0 35.648 16.848 35.648 36.93 0 7.508-2.137 14.833-6.104 21.059-72.823 114.698-196.066 183.675-328.099 183.614-216.088 0-391.4-181.478-391.4-405.195 0-223.718 175.312-405.195 391.339-405.195 183.125-0.427 342.016 131.606 382.243 317.601z"
2856
+ }, null)]), nt = vue.createVNode("svg", {
2857
+ viewBox: "0 0 1024 1024",
2858
+ version: "1.1",
2859
+ xmlns: "http://www.w3.org/2000/svg",
2860
+ fill: "currentcolor"
2861
+ }, [vue.createVNode("path", {
2862
+ d: "M394.688 126.208a32 32 0 0 1 32-32h170.688a32 32 0 0 1 32 32v138.624h288a32 32 0 0 1 32 32v170.688a32 32 0 0 1-32 32H106.688a32 32 0 0 1-32-32V296.832a32 32 0 0 1 32-32h288V126.208z m64 32v138.624a32 32 0 0 1-32 32h-288v106.688h746.688V328.832h-288a32 32 0 0 1-32-32V158.208H458.688z"
2863
+ }, null), vue.createVNode("path", {
2864
+ d: "M138.688 469.376a32 32 0 0 1 32-32h682.688a32 32 0 0 1 32 32v384a32 32 0 0 1-32 32H170.688a32 32 0 0 1-32-32v-384z m64 32v320h618.688v-320H202.688z"
2865
+ }, null), vue.createVNode("path", {
2866
+ d: "M341.376 691.52a32 32 0 0 1 32 32V851.2a32 32 0 1 1-64 0v-127.68a32 32 0 0 1 32-32zM512 691.2a32 32 0 0 1 32 32v128a32 32 0 0 1-64 0v-128a32 32 0 0 1 32-32zM682.688 691.52a32 32 0 0 1 32 32V851.2a32 32 0 1 1-64 0v-127.68a32 32 0 0 1 32-32z"
2867
+ }, null)]);
2868
+ vue.createVNode("svg", {
2869
+ viewBox: "0 0 18 18",
2870
+ fill: "currentcolor",
2871
+ xmlns: "http://www.w3.org/2000/svg"
2872
+ }, [vue.createVNode("path", {
2873
+ d: "M5.856 17.121a.979.979 0 0 1-.327-.06.839.839 0 0 1-.283-.177.739.739 0 0 1-.187-.255.724.724 0 0 1-.07-.303l-.02-1.609a4.663 4.663 0 0 1-1.446-.455 4.252 4.252 0 0 1-.637-.401c-.199-.146-.385-.31-.553-.492a4.442 4.442 0 0 1-.45-.577 4.303 4.303 0 0 1-.327-.637 3.823 3.823 0 0 1-.206-.686 3.729 3.729 0 0 1-.064-.704V6.478c0-.261.025-.516.077-.771a4.43 4.43 0 0 1 .244-.747 4.062 4.062 0 0 1 .932-1.28c.2-.183.418-.347.65-.493.23-.145.482-.267.739-.364a4.21 4.21 0 0 1 .81-.225c.27-.054.553-.078.835-.078H8.55c.103 0 .2.018.29.054a.7.7 0 0 1 .411.376.667.667 0 0 1-.161.766.736.736 0 0 1-.25.151.764.764 0 0 1-.29.055H5.573c-.186 0-.366.012-.54.049-.18.03-.353.079-.52.145-.167.061-.328.14-.482.237-.148.091-.29.2-.418.316a2.897 2.897 0 0 0-.347.388c-.097.14-.187.286-.257.444a2.473 2.473 0 0 0-.206.977v4.287c0 .17.013.333.051.503a2.549 2.549 0 0 0 .772 1.33 2.721 2.721 0 0 0 .913.559c.167.066.347.115.527.152.18.03.36.048.546.048a.904.904 0 0 1 .61.23.848.848 0 0 1 .194.262.84.84 0 0 1 .07.303l.007.99 1.915-1.293a2.877 2.877 0 0 1 1.64-.492h2.372c.186 0 .366-.018.54-.048.18-.03.353-.08.52-.146.168-.067.329-.146.483-.237.148-.091.29-.2.418-.316.128-.121.244-.249.347-.388a2.8 2.8 0 0 0 .257-.444 2.47 2.47 0 0 0 .206-.977V8.585a.646.646 0 0 1 .225-.492.679.679 0 0 1 .244-.152.814.814 0 0 1 .585 0c.09.03.174.085.244.152a.657.657 0 0 1 .225.492V10.8c0 .261-.032.516-.083.771a4.192 4.192 0 0 1-.245.74c-.109.244-.244.468-.398.687a3.735 3.735 0 0 1-.534.6c-.2.183-.418.347-.65.493a4.134 4.134 0 0 1-.738.364 4.7 4.7 0 0 1-.81.225c-.27.054-.553.079-.836.079h-1.877c-.604 0-1.144.164-1.633.491l-2.54 1.713a.913.913 0 0 1-.514.157z",
2874
+ fill: "currentColor"
2875
+ }, null), vue.createVNode("path", {
2876
+ d: "M15.866 4.125h-4.174c-.41 0-.741.313-.741.7 0 .387.332.7.741.7h4.174c.41 0 .742-.313.742-.7 0-.387-.332-.7-.742-.7z",
2877
+ fill: "currentColor"
2878
+ }, null), vue.createVNode("path", {
2879
+ d: "M14.537 2.932c0-.396-.34-.717-.759-.717s-.758.32-.758.717v3.786c0 .396.34.717.758.717.42 0 .76-.321.76-.717V2.932z",
2880
+ fill: "currentColor"
2881
+ }, null)]);
2882
+ const ot = vue.createVNode("svg", {
2883
+ viewBox: "0 0 1024 1024",
2884
+ version: "1.1",
2885
+ xmlns: "http://www.w3.org/2000/svg",
2886
+ "p-id": "15393",
2887
+ width: "24",
2888
+ height: "24",
2889
+ fill: "currentColor"
2890
+ }, [vue.createVNode("path", {
2891
+ d: "M896 921.6H128c-70.656 0-128-57.344-128-128V230.4c0-70.656 57.344-128 128-128h768c70.656 0 128 57.344 128 128v563.2c0 70.656-57.344 128-128 128zM128 153.6c-42.496 0-76.8 34.304-76.8 76.8v563.2c0 42.496 34.304 76.8 76.8 76.8h768c42.496 0 76.8-34.304 76.8-76.8V230.4c0-42.496-34.304-76.8-76.8-76.8H128z",
2892
+ "p-id": "15394"
2893
+ }, null), vue.createVNode("path", {
2894
+ d: "M256 486.4c-70.656 0-128-57.344-128-128s57.344-128 128-128 128 57.344 128 128-57.344 128-128 128z m0-204.8c-42.496 0-76.8 34.304-76.8 76.8s34.304 76.8 76.8 76.8 76.8-34.304 76.8-76.8-34.304-76.8-76.8-76.8zM204.8 742.4c-7.68 0-15.36-3.584-20.48-10.24-8.704-11.264-6.144-27.136 5.12-35.84l181.76-136.192c21.504-15.872 49.664-19.968 74.752-9.728l198.144 79.36c9.728 3.584 20.48 1.536 27.648-5.632l129.536-129.536c10.24-10.24 26.112-10.24 36.352 0s10.24 26.112 0 36.352L708.096 660.48c-21.504 21.504-54.272 28.672-82.944 16.896l-198.144-79.36c-8.192-3.072-17.92-2.048-25.088 3.072L220.16 737.28c-4.608 3.584-10.24 5.12-15.36 5.12z",
2895
+ "p-id": "15395"
2896
+ }, null)]), rt = vue.createVNode("svg", {
2897
+ viewBox: "0 0 1024 1024",
2898
+ version: "1.1",
2899
+ xmlns: "http://www.w3.org/2000/svg",
2900
+ "p-id": "4645",
2901
+ width: "24",
2902
+ height: "24",
2903
+ fill: "currentColor"
2904
+ }, [vue.createVNode("path", {
2905
+ d: "M192.608008 1023.936a192 192 0 0 1-192-192v-640a192 192 0 0 1 192-192h383.296a64 64 0 0 1 0 128H192.608008a64 64 0 0 0-64 64v640a64 64 0 0 0 64 64h383.296a64 64 0 0 1 0 128z m544.896-289.6a64 64 0 0 1 0-90.432L805.280008 576H384.352008a64 64 0 1 1 0-128h420.928l-82.688-82.816a64 64 0 0 1 90.368-90.496l192 192a64.576 64.576 0 0 1 13.76 69.824 65.6 65.6 0 0 1-13.76 20.672l-176.896 177.152a64 64 0 0 1-90.368 0z",
2906
+ "p-id": "4646"
2907
+ }, null)]);
2908
+ const lt = /* @__PURE__ */ vue.defineComponent({
2909
+ props: {
2910
+ message: {
2911
+ type: Object,
2912
+ required: !0
2913
+ }
2914
+ },
2915
+ setup(a) {
2916
+ return {
2917
+ ns: new A("ai-error-message")
2918
+ };
2919
+ },
2920
+ render() {
2921
+ var a, e;
2922
+ return vue.createVNode("div", {
2923
+ class: this.ns.b()
2924
+ }, [vue.createVNode("div", {
2925
+ class: this.ns.e("icon")
2926
+ }, [q]), vue.createVNode("div", {
2927
+ class: this.ns.e("right")
2928
+ }, [vue.createVNode("div", {
2929
+ class: this.ns.em("right", "header")
2930
+ }, [(e = (a = this.$slots).header) == null ? void 0 : e.call(a)]), vue.createVNode("div", {
2931
+ class: [this.ns.em("right", "content"), "pre-wrap-container"]
2932
+ }, [vue.createVNode("p", {
2933
+ class: this.ns.e("message")
2934
+ }, [this.message.content])])])]);
2935
+ }
2936
+ });
2937
+ const ct = /* @__PURE__ */ vue.defineComponent({
2938
+ props: {
2939
+ message: {
2940
+ type: Object,
2941
+ required: !0
2942
+ }
2943
+ },
2944
+ setup(a) {
2945
+ const e = new A("chart-thought-chain"), t = vue.ref(!1), s = vue.computed(() => {
2946
+ const n = a.message.content, l = n.indexOf("<think>");
2947
+ if (l === -1)
2948
+ return;
2949
+ const h = n.indexOf("</think>");
2950
+ return h === -1 ? n.slice(l + 7) : n.slice(l + 7, h);
2951
+ }), i = vue.computed(() => a.message.content.indexOf("</think>") === -1);
2952
+ return {
2953
+ ns: e,
2954
+ think: s,
2955
+ isLoading: i,
2956
+ isCollapse: t,
2957
+ onCollapseChange: () => {
2958
+ t.value = !t.value;
2959
+ }
2960
+ };
2961
+ },
2962
+ render() {
2963
+ if (this.think)
2964
+ return vue.createVNode("div", {
2965
+ class: this.ns.b()
2966
+ }, [vue.createVNode("div", {
2967
+ class: this.ns.e("header"),
2968
+ onClick: this.onCollapseChange
2969
+ }, [vue.createVNode("div", {
2970
+ class: this.ns.em("header", "left")
2971
+ }, [vue.createVNode("div", {
2972
+ class: [this.ns.em("header", "state-icon"), this.ns.is("loading", this.isLoading)]
2973
+ }, [this.isLoading ? Ye : Ke]), vue.createVNode("div", {
2974
+ class: this.ns.em("header", "title")
2975
+ }, [this.isLoading ? "思考中..." : "思考完成"])]), vue.createVNode("div", {
2976
+ class: this.ns.em("header", "right")
2977
+ }, [vue.createVNode("div", {
2978
+ class: this.ns.em("header", "collapse-icon")
2979
+ }, [this.isCollapse ? te : Qe])])]), !this.isCollapse && vue.createVNode("div", {
2980
+ class: this.ns.e("content")
2981
+ }, [this.think])]);
2982
+ }
2983
+ });
2984
+ const ht = /* @__PURE__ */ vue.defineComponent({
2985
+ props: {
2986
+ toolCall: {
2987
+ type: Object,
2988
+ required: !0
2989
+ }
2990
+ },
2991
+ setup(a) {
2992
+ const e = new A("chart-tool-call-item"), t = vue.ref(!1), s = () => {
2993
+ t.value = !t.value;
2994
+ }, i = (c) => {
2995
+ c.stopPropagation(), window.ibiz.util.text.copy(JSON.stringify(a.toolCall, void 0, 2)), window.message.success("拷贝成功");
2996
+ }, o = (c) => typeof c == "string" ? c.includes("Failed") || c.includes("Error") || c.includes("ERR_") ? '<span class="'.concat(e.e("error"), '">"').concat(c, '"</span>') : '<span class="'.concat(e.e("string"), '">"').concat(c, '"</span>') : typeof c == "number" ? '<span class="'.concat(e.e("number"), '">').concat(c, "</span>") : typeof c == "boolean" ? '<span class="'.concat(e.e("boolean"), '">').concat(c, "</span>") : c === null ? '<span class="'.concat(e.e("null"), '">null</span>') : "", n = (c, u = 0) => {
2997
+ const d = " ".repeat(u), p = [];
2998
+ if (Array.isArray(c)) {
2999
+ if (c.length === 0)
3000
+ return ["".concat(d, '<span class="').concat(e.e("array"), '">[]</span>')];
3001
+ p.push("".concat(d, '<span class="').concat(e.e("array"), '">[</span>')), c.forEach((f, m) => {
3002
+ const b = n(f, u + 1), y = m < c.length - 1 ? "," : "";
3003
+ typeof f == "object" && f !== null ? (p.push(...b.slice(0, -1)), p.push("".concat(b[b.length - 1]).concat(y))) : p.push("".concat(b[0]).concat(y));
3004
+ }), p.push("".concat(d, '<span class="').concat(e.e("array"), '">]</span>'));
3005
+ } else if (typeof c == "object" && c !== null) {
3006
+ const f = Object.keys(c);
3007
+ if (f.length === 0)
3008
+ return ["".concat(d, '<span class="').concat(e.e("property"), '">{}</span>')];
3009
+ p.push("".concat(d, '<span class="').concat(e.e("property"), '">{</span>')), f.forEach((m, b) => {
3010
+ const y = c[m], S = b < f.length - 1 ? "," : "", E = '<span class="'.concat(e.e("json-key"), '">"').concat(m, '":</span>');
3011
+ if (typeof y == "object" && y !== null) {
3012
+ const C = n(y, u + 1);
3013
+ p.push("".concat(d, " ").concat(E, " ").concat(C[0].trim())), C.length > 1 && (p.push(...C.slice(1, -1)), p.push("".concat(C[C.length - 1]).concat(S)));
3014
+ } else {
3015
+ const C = o(y);
3016
+ p.push("".concat(d, " ").concat(E, " ").concat(C).concat(S));
3017
+ }
3018
+ }), p.push("".concat(d, '<span class="').concat(e.e("property"), '">}</span>'));
3019
+ } else
3020
+ p.push("".concat(d).concat(o(c)));
3021
+ return p;
3022
+ }, l = vue.ref([]), h = () => {
3023
+ const c = n(a.toolCall, 0);
3024
+ l.value = c.map((u, d) => '<span class="'.concat(e.em("code-line", "line-number"), '">').concat(d + 1, "</span>").concat(u));
3025
+ };
3026
+ return vue.onMounted(() => {
3027
+ h();
3028
+ }), {
3029
+ ns: e,
3030
+ lines: l,
3031
+ isExpanded: t,
3032
+ onCopy: i,
3033
+ handleExpandChange: s
3034
+ };
3035
+ },
3036
+ render() {
3037
+ var a;
3038
+ return vue.createVNode("div", {
3039
+ class: this.ns.b()
3040
+ }, [vue.createVNode("div", {
3041
+ class: this.ns.e("header"),
3042
+ onClick: this.handleExpandChange
3043
+ }, [vue.createVNode("div", {
3044
+ class: this.ns.e("header-left")
3045
+ }, [vue.createVNode("div", {
3046
+ class: this.ns.em("header-left", "caption")
3047
+ }, [this.toolCall.name]), vue.createVNode("div", {
3048
+ class: this.ns.em("header-left", "desc")
3049
+ }, [(a = this.toolCall.parameters) == null ? void 0 : a.desc])]), vue.createVNode("div", {
3050
+ class: this.ns.e("header-right")
3051
+ }, [this.toolCall.error && vue.createVNode("div", {
3052
+ class: this.ns.em("header-right", "error")
3053
+ }, [vue.createVNode("span", {
3054
+ class: this.ns.em("header-right", "error-text")
3055
+ }, [vue.createTextVNode("发生错误")]), vue.createVNode("div", {
3056
+ class: this.ns.em("header-right", "icon")
3057
+ }, [We])]), vue.createVNode("div", {
3058
+ onClick: this.onCopy,
3059
+ class: this.ns.em("header-right", "icon")
3060
+ }, [ie]), vue.createVNode("div", {
3061
+ class: this.ns.em("header-right", "icon")
3062
+ }, [this.isExpanded ? te : se])])]), this.isExpanded && vue.createVNode("div", {
3063
+ class: this.ns.e("content")
3064
+ }, [this.lines.map((e) => vue.createVNode("div", {
3065
+ class: this.ns.e("code-line"),
3066
+ innerHTML: e
3067
+ }, null))])]);
3068
+ }
3069
+ });
3070
+ const ut = /* @__PURE__ */ vue.defineComponent({
3071
+ props: {
3072
+ toolCalls: {
3073
+ type: Array,
3074
+ required: !0
3075
+ }
3076
+ },
3077
+ setup(a) {
3078
+ const e = new A("chart-tool-call"), t = vue.ref(!1), s = vue.computed(() => a.toolCalls.length > 4), i = vue.computed(() => s.value && !t.value ? a.toolCalls.slice(0, 4) : a.toolCalls);
3079
+ return {
3080
+ ns: e,
3081
+ items: i,
3082
+ showToggle: s,
3083
+ isExpanded: t,
3084
+ handleToggle: () => {
3085
+ t.value = !t.value;
3086
+ }
3087
+ };
3088
+ },
3089
+ render() {
3090
+ if (this.toolCalls.length)
3091
+ return vue.createVNode("div", {
3092
+ class: this.ns.b()
3093
+ }, [this.items.map((a) => vue.createVNode(ht, {
3094
+ toolCall: a
3095
+ }, null)), this.showToggle && vue.createVNode("div", {
3096
+ class: this.ns.e("toggle"),
3097
+ onClick: this.handleToggle
3098
+ }, [this.isExpanded ? "收起工具调用" : "展开全部 ".concat(this.toolCalls.length, " 个工具调用")])]);
3099
+ }
3100
+ });
3101
+ const dt = /* @__PURE__ */ vue.defineComponent({
3102
+ props: {
3103
+ suggestions: {
3104
+ type: Array,
3105
+ required: !0
3106
+ }
3107
+ },
3108
+ emits: {
3109
+ itemClick: (a, e) => !0
3110
+ },
3111
+ setup(a, {
3112
+ emit: e
3113
+ }) {
3114
+ return {
3115
+ ns: new A("chart-suggestion"),
3116
+ onItemClick: (i, o) => {
3117
+ e("itemClick", i, o);
3118
+ }
3119
+ };
3120
+ },
3121
+ render() {
3122
+ return vue.createVNode("div", {
3123
+ class: this.ns.b()
3124
+ }, [this.suggestions.map((a) => vue.createVNode("div", {
3125
+ onClick: (e) => this.onItemClick(a, e),
3126
+ class: [this.ns.e("item"), this.ns.em("item", a.type)]
3127
+ }, [a.metadata.content_name, se]))]);
3128
+ }
3129
+ });
3130
+ const pt = /* @__PURE__ */ vue.defineComponent({
3131
+ props: {
3132
+ controller: {
3133
+ type: Object,
3134
+ required: !0
3135
+ },
3136
+ message: {
3137
+ type: Object,
3138
+ required: !0
3139
+ }
3140
+ },
3141
+ setup(a) {
3142
+ const e = new A("ai-markdown-message"), t = qxUtil.createUUID(), s = vue.ref(null), i = (n) => {
3143
+ let l = "", h;
3144
+ if (!n)
3145
+ return {
3146
+ content: l,
3147
+ think: h
3148
+ };
3149
+ const c = n.indexOf("<think>"), u = n.indexOf("</think>");
3150
+ return c !== -1 ? (h = u === -1 ? n.slice(c + 7) : n.slice(c + 7, u), l = u === -1 ? "" : n.slice(u + 8)) : l = n.replace(new RegExp("\\<tool_call\\>[^]*?\\<\\/tool_call\\>", "gs"), "").trim(), {
3151
+ think: h,
3152
+ content: l
3153
+ };
3154
+ };
3155
+ vue.watch(() => a.message.content, () => {
3156
+ var l;
3157
+ const {
3158
+ content: n
3159
+ } = i(a.message.content);
3160
+ (l = s.value) == null || l.setMarkdown(n);
3161
+ }, {
3162
+ immediate: !0
3163
+ });
3164
+ const o = () => {
3165
+ const {
3166
+ content: n
3167
+ } = i(a.message.content);
3168
+ s.value = new Cherry({
3169
+ id: t,
3170
+ value: n,
3171
+ editor: {
3172
+ defaultModel: "previewOnly"
3173
+ },
3174
+ previewer: {
3175
+ enablePreviewerBubble: !1
3176
+ },
3177
+ engine: {
3178
+ syntax: {
3179
+ table: {
3180
+ enableChart: !1,
3181
+ externals: ["echarts"]
3182
+ }
3183
+ }
3184
+ }
3185
+ });
3186
+ };
3187
+ return vue.onMounted(() => {
3188
+ o();
3189
+ }), {
3190
+ ns: e,
3191
+ UUID: t
3192
+ };
3193
+ },
3194
+ render() {
3195
+ var a, e;
3196
+ return vue.createVNode("div", {
3197
+ class: this.ns.b()
3198
+ }, [vue.createVNode("div", {
3199
+ class: this.ns.e("icon")
3200
+ }, [q]), vue.createVNode("div", {
3201
+ class: this.ns.e("right")
3202
+ }, [vue.createVNode("div", {
3203
+ class: this.ns.em("right", "header")
3204
+ }, [(e = (a = this.$slots).header) == null ? void 0 : e.call(a)]), vue.createVNode("div", {
3205
+ class: [this.ns.em("right", "content"), "pre-wrap-container"]
3206
+ }, [this.message.toolcalls && vue.createVNode(ut, {
3207
+ class: this.ns.e("tool-call"),
3208
+ toolCalls: this.message.toolcalls
3209
+ }, null), vue.createVNode(ct, {
3210
+ message: this.message,
3211
+ class: this.ns.e("thought")
3212
+ }, null), vue.createVNode("div", {
3213
+ class: this.ns.e("message"),
3214
+ id: this.UUID
3215
+ }, null)]), vue.createVNode("div", {
3216
+ class: this.ns.em("right", "footer")
3217
+ }, [this.message.suggestions && vue.createVNode(dt, {
3218
+ suggestions: this.message.suggestions,
3219
+ onItemClick: (t, s) => {
3220
+ this.controller.handleSuggestionClick(this.message, t, s);
3221
+ }
3222
+ }, null)])])]);
3223
+ }
3224
+ });
3225
+ const gt = /* @__PURE__ */ vue.defineComponent({
3226
+ props: {
3227
+ message: {
3228
+ type: Object,
3229
+ required: !0
3230
+ }
3231
+ },
3232
+ setup() {
3233
+ return {
3234
+ ns: new A("ai-unknown-message")
3235
+ };
3236
+ },
3237
+ render() {
3238
+ var a, e;
3239
+ return vue.createVNode("div", {
3240
+ class: this.ns.b()
3241
+ }, [vue.createVNode("div", {
3242
+ class: this.ns.e("icon")
3243
+ }, [q]), vue.createVNode("div", {
3244
+ class: this.ns.e("right")
3245
+ }, [vue.createVNode("div", {
3246
+ class: this.ns.em("right", "header")
3247
+ }, [(e = (a = this.$slots).header) == null ? void 0 : e.call(a)]), vue.createVNode("div", {
3248
+ class: [this.ns.em("right", "content"), "pre-wrap-container"]
3249
+ }, [vue.createVNode("p", {
3250
+ class: this.ns.e("message")
3251
+ }, [vue.createTextVNode("暂未支持的消息类型: "), this.message.type])])])]);
3252
+ }
3253
+ });
3254
+ const mt = /* @__PURE__ */ vue.defineComponent({
3255
+ props: {
3256
+ material: {
3257
+ type: Object,
3258
+ required: !0
3259
+ },
3260
+ readonly: {
3261
+ type: Boolean,
3262
+ default: !1
3263
+ }
3264
+ },
3265
+ emits: {
3266
+ remove: () => !0
3267
+ },
3268
+ setup(a, {
3269
+ emit: e
3270
+ }) {
3271
+ const t = new A("chart-material-item"), s = () => {
3272
+ e("remove");
3273
+ }, i = vue.computed(() => {
3274
+ const o = a.material.metadata.state, n = {
3275
+ color: "#ff4d4f",
3276
+ label: "未知状态"
3277
+ };
3278
+ switch (o) {
3279
+ case "successed":
3280
+ Object.assign(n, {
3281
+ color: "#1890ff",
3282
+ label: "上传成功"
3283
+ });
3284
+ break;
3285
+ case "uploading":
3286
+ Object.assign(n, {
3287
+ color: "#52c41a",
3288
+ label: "上传中"
3289
+ });
3290
+ break;
3291
+ case "failed":
3292
+ Object.assign(n, {
3293
+ color: "#ff4d4f",
3294
+ label: "上传失败"
3295
+ });
3296
+ break;
3297
+ }
3298
+ return n;
3299
+ });
3300
+ return {
3301
+ ns: t,
3302
+ state: i,
3303
+ onRemove: s
3304
+ };
3305
+ },
3306
+ render() {
3307
+ return vue.createVNode("div", {
3308
+ class: this.ns.b()
3309
+ }, [!this.readonly && vue.createVNode("div", {
3310
+ class: this.ns.e("icon"),
3311
+ onClick: this.onRemove
3312
+ }, [ae]), vue.createVNode("div", {
3313
+ class: this.ns.e("left")
3314
+ }, [et]), vue.createVNode("div", {
3315
+ class: this.ns.e("right")
3316
+ }, [vue.createVNode("div", {
3317
+ class: this.ns.e("caption")
3318
+ }, [this.material.data.name]), vue.createVNode("div", {
3319
+ class: this.ns.e("metadata")
3320
+ }, [vue.createVNode("div", {
3321
+ class: this.ns.em("metadata", "size")
3322
+ }, [this.material.metadata.size, vue.createTextVNode("B")]), vue.createVNode("div", {
3323
+ class: this.ns.em("metadata", "state"),
3324
+ style: {
3325
+ color: this.state.color
3326
+ }
3327
+ }, [this.state.label])])])]);
3328
+ }
3329
+ });
3330
+ const ne = /* @__PURE__ */ vue.defineComponent({
3331
+ props: {
3332
+ materials: {
3333
+ type: Array,
3334
+ required: !0
3335
+ },
3336
+ readonly: {
3337
+ type: Boolean,
3338
+ default: !1
3339
+ }
3340
+ },
3341
+ emits: {
3342
+ remove: (a) => !0
3343
+ },
3344
+ setup(a, {
3345
+ emit: e
3346
+ }) {
3347
+ return {
3348
+ ns: new A("chart-material"),
3349
+ onRemove: (i) => {
3350
+ e("remove", i);
3351
+ }
3352
+ };
3353
+ },
3354
+ render() {
3355
+ if (this.materials.length)
3356
+ return vue.createVNode("div", {
3357
+ class: this.ns.b()
3358
+ }, [this.materials.map((a) => vue.createVNode(mt, {
3359
+ material: a,
3360
+ readonly: this.readonly,
3361
+ onRemove: () => this.onRemove(a)
3362
+ }, null))]);
3363
+ }
3364
+ });
3365
+ const ft = /* @__PURE__ */ vue.defineComponent({
3366
+ props: {
3367
+ controller: {
3368
+ type: Object,
3369
+ required: !0
3370
+ },
3371
+ message: {
3372
+ type: Object,
3373
+ required: !0
3374
+ }
3375
+ },
3376
+ setup(a) {
3377
+ const e = new A("ai-user-message"), t = qxUtil.createUUID(), s = vue.ref(null), i = j.parseMixedContent(a.message.content), o = () => {
3378
+ s.value = new Cherry({
3379
+ id: t,
3380
+ value: i.remainingText,
3381
+ editor: {
3382
+ defaultModel: "previewOnly"
3383
+ },
3384
+ previewer: {
3385
+ enablePreviewerBubble: !1
3386
+ },
3387
+ engine: {
3388
+ syntax: {
3389
+ table: {
3390
+ enableChart: !1,
3391
+ externals: ["echarts"]
3392
+ }
3393
+ }
3394
+ }
3395
+ });
3396
+ };
3397
+ return vue.onMounted(() => {
3398
+ o();
3399
+ }), {
3400
+ ns: e,
3401
+ UUID: t,
3402
+ material: i
3403
+ };
3404
+ },
3405
+ render() {
3406
+ var a, e;
3407
+ return vue.createVNode("div", {
3408
+ class: this.ns.b()
3409
+ }, [vue.createVNode("div", {
3410
+ class: this.ns.e("icon")
3411
+ }, [Je]), vue.createVNode("div", {
3412
+ class: this.ns.e("right")
3413
+ }, [vue.createVNode("div", {
3414
+ class: this.ns.em("right", "header")
3415
+ }, [(e = (a = this.$slots).header) == null ? void 0 : e.call(a)]), vue.createVNode("div", {
3416
+ class: [this.ns.em("right", "content"), "pre-wrap-container"]
3417
+ }, [this.material.hasResources && vue.createVNode(ne, {
3418
+ readonly: !0,
3419
+ class: this.ns.e("material"),
3420
+ materials: this.material.resources
3421
+ }, null), vue.createVNode("div", {
3422
+ class: this.ns.e("message"),
3423
+ id: this.UUID
3424
+ }, null)])])]);
3425
+ }
3426
+ });
3427
+ const vt = /* @__PURE__ */ vue.defineComponent({
3428
+ props: {
3429
+ // 滚动目标:选择器 | DOM 元素
3430
+ target: {
3431
+ type: [String, HTMLElement],
3432
+ default: ""
3433
+ },
3434
+ // 右侧距离
3435
+ right: {
3436
+ type: [Number, String],
3437
+ default: "1rem"
3438
+ },
3439
+ // 底部距离
3440
+ bottom: {
3441
+ type: [Number, String],
3442
+ default: "1rem"
3443
+ },
3444
+ // 显示阈值(滚动高度超过该值才显示)
3445
+ offset: {
3446
+ type: Number,
3447
+ default: 200
3448
+ }
3449
+ },
3450
+ setup(a) {
3451
+ const e = new A("back-bottom"), t = vue.ref(!1), s = vue.ref(), i = vue.ref(), o = () => {
3452
+ var c;
3453
+ if (a.target) {
3454
+ if (typeof a.target == "string") {
3455
+ const u = document.querySelector(a.target);
3456
+ if (u)
3457
+ return u;
3458
+ } else if (a.target instanceof HTMLElement)
3459
+ return a.target;
3460
+ }
3461
+ return (c = i.value) == null ? void 0 : c.parentElement;
3462
+ }, n = vue.computed(() => ({
3463
+ right: qxUtil.isString(a.right) ? a.right : "".concat(a.right, "px"),
3464
+ bottom: qxUtil.isString(a.bottom) ? a.bottom : "".concat(a.bottom, "px")
3465
+ })), l = () => {
3466
+ const c = s.value;
3467
+ c && setTimeout(() => {
3468
+ const {
3469
+ scrollTop: u,
3470
+ scrollHeight: d,
3471
+ clientHeight: p
3472
+ } = c, f = d - (u + p) > a.offset;
3473
+ t.value = f;
3474
+ }, 1e3);
3475
+ }, h = () => {
3476
+ if (!s.value)
3477
+ return;
3478
+ const c = s.value;
3479
+ c == null || c.scrollTo({
3480
+ top: c.scrollHeight,
3481
+ behavior: "smooth"
3482
+ });
3483
+ };
3484
+ return vue.onMounted(async () => {
3485
+ var c;
3486
+ await vue.nextTick(), s.value = o(), (c = s.value) == null || c.addEventListener("scroll", l), l();
3487
+ }), vue.watch(() => a.target, async () => {
3488
+ await vue.nextTick(), s.value = o();
3489
+ }), vue.onUnmounted(() => {
3490
+ var c;
3491
+ (c = s.value) == null || c.removeEventListener("scroll", l);
3492
+ }), {
3493
+ ns: e,
3494
+ btnRef: i,
3495
+ isShow: t,
3496
+ buttonStyle: n,
3497
+ scrollToBottom: h
3498
+ };
3499
+ },
3500
+ render() {
3501
+ return vue.createVNode("div", {
3502
+ ref: "btnRef",
3503
+ class: [this.ns.b(), this.ns.is("visible", this.isShow)],
3504
+ style: this.buttonStyle,
3505
+ onClick: this.scrollToBottom
3506
+ }, [Ge]);
3507
+ }
3508
+ });
3509
+ function oe(a) {
3510
+ return { handleItemClick: (t, s) => {
3511
+ const i = {
3512
+ ...a.data
3513
+ };
3514
+ if (a.data instanceof L ? (Object.assign(i, { topic: a.controller.topic }), i.msg.realcontent = a.data.realcontent) : (i.data || (i.data = {}), Object.assign(i.data, {
3515
+ messages: a.controller.messages.value
3516
+ })), s.onClick && typeof s.onClick == "function")
3517
+ s.onClick(
3518
+ t,
3519
+ s,
3520
+ a.controller.context,
3521
+ a.controller.params,
3522
+ i
3523
+ );
3524
+ else {
3525
+ const { extendToolbarClick: o } = a.controller.opts;
3526
+ o && typeof o == "function" && o(
3527
+ t,
3528
+ s,
3529
+ a.controller.context,
3530
+ a.controller.params,
3531
+ i
3532
+ );
3533
+ }
3534
+ } };
3535
+ }
3536
+ const N = /* @__PURE__ */ vue.defineComponent({
3537
+ props: {
3538
+ model: {
3539
+ type: Object,
3540
+ required: !0
3541
+ },
3542
+ data: {
3543
+ type: Object,
3544
+ default: () => ({})
3545
+ },
3546
+ disabled: {
3547
+ type: Boolean,
3548
+ default: !1
3549
+ }
3550
+ },
3551
+ emits: {
3552
+ click: (a, e) => !0
3553
+ },
3554
+ setup(a, {
3555
+ emit: e
3556
+ }) {
3557
+ const t = new A("chat-toolbar-item"), s = (l) => typeof l.hidden == "function" ? l.hidden(a.data) : l.hidden === !0, i = (l) => a.disabled ? !0 : typeof l.disabled == "function" ? l.disabled(a.data) : l.disabled === !0;
3558
+ return {
3559
+ ns: t,
3560
+ isHidden: s,
3561
+ isDisabled: i,
3562
+ handleItemClick: (l, h) => {
3563
+ i(h) || e("click", l, h);
3564
+ },
3565
+ renderIcon: (l) => {
3566
+ var h, c, u, d;
3567
+ return typeof l.icon == "function" ? l.icon() : (h = l.icon) != null && h.showIcon && ((c = l.icon) != null && c.cssClass) ? vue.createVNode("i", {
3568
+ class: l.icon.cssClass
3569
+ }, null) : (u = l.icon) != null && u.showIcon && ((d = l.icon) != null && d.imagePath) ? Me(l.icon.imagePath) ? vue.createVNode("div", {
3570
+ innerHTML: l.icon.imagePath
3571
+ }, null) : vue.createVNode("img", {
3572
+ src: l.icon.imagePath
3573
+ }, null) : null;
3574
+ }
3575
+ };
3576
+ },
3577
+ render() {
3578
+ return this.isHidden(this.model) ? null : vue.createVNode("div", {
3579
+ class: [this.ns.b(), this.ns.is("disabled", this.isDisabled(this.model)), "".concat(this.model.customClass || "")]
3580
+ }, [vue.createVNode("div", {
3581
+ title: this.model.title,
3582
+ class: this.ns.e("content"),
3583
+ onClick: (a) => this.handleItemClick(a, this.model)
3584
+ }, [vue.createVNode("div", {
3585
+ class: this.ns.em("content", "icon")
3586
+ }, [this.renderIcon(this.model)]), vue.createVNode("div", {
3587
+ class: this.ns.em("content", "label")
3588
+ }, [this.model.label])])]);
3589
+ }
3590
+ });
3591
+ const Ct = /* @__PURE__ */ vue.defineComponent({
3592
+ props: {
3593
+ controller: {
3594
+ type: Object,
3595
+ required: !0
3596
+ },
3597
+ data: {
3598
+ type: Object
3599
+ },
3600
+ items: {
3601
+ type: Array,
3602
+ default: () => []
3603
+ }
3604
+ },
3605
+ setup(a) {
3606
+ const e = new A("chat-input-toolbar"), {
3607
+ handleItemClick: t
3608
+ } = oe(a), s = [{
3609
+ label: "重置对话",
3610
+ title: "重置对话",
3611
+ icon: () => at,
3612
+ onClick: () => {
3613
+ a.controller.resetTopic();
3614
+ }
3615
+ }, {
3616
+ label: "清空对话",
3617
+ title: "清空对话",
3618
+ icon: () => nt,
3619
+ onClick: () => {
3620
+ a.controller.clearTopic();
3621
+ }
3622
+ }];
3623
+ return (() => {
3624
+ s.push(...a.items);
3625
+ })(), {
3626
+ ns: e,
3627
+ toolbarItems: s,
3628
+ handleItemClick: t
3629
+ };
3630
+ },
3631
+ render() {
3632
+ return vue.createVNode("div", {
3633
+ class: this.ns.b()
3634
+ }, [vue.createVNode("div", {
3635
+ class: this.ns.e("wrapper")
3636
+ }, [this.toolbarItems.map((a) => vue.createVNode(N, {
3637
+ data: this.data,
3638
+ model: a,
3639
+ disabled: !1,
3640
+ onClick: this.handleItemClick
3641
+ }, null))])]);
3642
+ }
3643
+ });
3644
+ const bt = /* @__PURE__ */ vue.defineComponent({
3645
+ props: {
3646
+ controller: {
3647
+ type: Object,
3648
+ required: !0
3649
+ },
3650
+ data: {
3651
+ type: Object,
3652
+ required: !0
3653
+ },
3654
+ items: {
3655
+ type: Array,
3656
+ default: () => []
3657
+ },
3658
+ enableBackFill: {
3659
+ type: Boolean,
3660
+ default: !0
3661
+ }
3662
+ },
3663
+ setup(a) {
3664
+ const e = new A("chat-message-toolbar"), {
3665
+ handleItemClick: t
3666
+ } = oe(a), s = vue.ref([]), i = vue.ref([]), o = [{
3667
+ label: "刷新",
3668
+ title: "刷新",
3669
+ icon: () => K,
3670
+ onClick: () => {
3671
+ a.controller.refreshMessage(a.data);
3672
+ }
3673
+ }, {
3674
+ label: "删除",
3675
+ title: "删除",
3676
+ hidden: () => {
3677
+ var d;
3678
+ return !((d = a.data) != null && d.realmessageid);
3679
+ },
3680
+ icon: () => ae,
3681
+ onClick: () => {
3682
+ a.controller.deleteMessage(a.data);
3683
+ }
3684
+ }, {
3685
+ label: "复制",
3686
+ title: "复制",
3687
+ icon: () => ie,
3688
+ onClick: () => {
3689
+ a.controller.copyMessage(a.data);
3690
+ }
3691
+ }];
3692
+ a.enableBackFill && o.unshift({
3693
+ label: "回填",
3694
+ title: "回填",
3695
+ icon: () => it,
3696
+ onClick: () => {
3697
+ a.controller.backfill(a.data);
3698
+ }
3699
+ });
3700
+ const n = [{
3701
+ label: "刷新",
3702
+ title: "刷新",
3703
+ icon: () => K,
3704
+ onClick: () => {
3705
+ a.controller.refreshMessage(a.data, !0);
3706
+ }
3707
+ }], l = () => a.data.state === 20 && a.data.completed !== !0 || a.controller.resourceMode !== "REMOTE" || !a.data.realmessageid || a.controller.currentTopicDisableStorage, h = [{
3708
+ id: "islike",
3709
+ label: "点赞",
3710
+ title: "点赞",
3711
+ icon: () => tt,
3712
+ onClick: () => {
3713
+ a.controller.messageLike(a.data._origin);
3714
+ },
3715
+ hidden: () => l()
3716
+ }, {
3717
+ id: "isdislike",
3718
+ label: "点踩",
3719
+ title: "点踩",
3720
+ icon: () => st,
3721
+ onClick: () => {
3722
+ a.controller.messageDisLike(a.data._origin);
3723
+ },
3724
+ hidden: () => l()
3725
+ }];
3726
+ (() => {
3727
+ switch (a.data.type) {
3728
+ case "DEFAULT":
3729
+ a.data.role === "ASSISTANT" ? (s.value = [...h], i.value = [...o, ...a.items]) : i.value = [...n];
3730
+ break;
3731
+ case "ERROR":
3732
+ i.value = [...o, ...a.items];
3733
+ break;
3734
+ }
3735
+ })();
3736
+ const u = vue.computed(() => {
3737
+ var d, p;
3738
+ return ((d = a.data) == null ? void 0 : d.state) === 20 && ((p = a.data) == null ? void 0 : p.completed) !== !0;
3739
+ });
3740
+ return {
3741
+ ns: e,
3742
+ isLoadding: u,
3743
+ topItems: s,
3744
+ centerItems: i,
3745
+ handleItemClick: t
3746
+ };
3747
+ },
3748
+ render() {
3749
+ return vue.createVNode("div", {
3750
+ ref: "btnRef",
3751
+ class: this.ns.b()
3752
+ }, [this.topItems.length ? vue.createVNode("div", {
3753
+ class: this.ns.e("top")
3754
+ }, [this.topItems.map((a) => {
3755
+ const e = a.id === "islike" && this.data.islike === "1" || a.id === "isdislike" && this.data.isdislike === "1";
3756
+ return vue.createVNode(N, {
3757
+ data: this.data,
3758
+ model: a,
3759
+ disabled: this.isLoadding,
3760
+ class: [this.ns.em("top", "item"), this.ns.is("actived", !!e)],
3761
+ onClick: this.handleItemClick
3762
+ }, null);
3763
+ })]) : null, this.centerItems.length ? vue.createVNode("div", {
3764
+ class: this.ns.e("center")
3765
+ }, [this.centerItems.map((a) => vue.createVNode(N, {
3766
+ data: this.data,
3767
+ model: a,
3768
+ disabled: this.isLoadding,
3769
+ onClick: this.handleItemClick
3770
+ }, null))]) : null]);
3771
+ }
3772
+ });
3773
+ const wt = /* @__PURE__ */ vue.defineComponent({
3774
+ emits: {
3775
+ close: () => !0
3776
+ },
3777
+ setup(a, {
3778
+ emit: e
3779
+ }) {
3780
+ return {
3781
+ ns: new A("custom-modal"),
3782
+ handleMaskClick: () => {
3783
+ e("close");
3784
+ }
3785
+ };
3786
+ },
3787
+ render() {
3788
+ var a, e;
3789
+ return vue.createVNode("div", {
3790
+ class: this.ns.b(),
3791
+ onClick: this.handleMaskClick
3792
+ }, [vue.createVNode("div", {
3793
+ class: this.ns.e("mask")
3794
+ }, null), vue.createVNode("div", {
3795
+ id: "modal-wrapper",
3796
+ class: this.ns.e("wrapper")
3797
+ }, [(e = (a = this.$slots).default) == null ? void 0 : e.call(a)])]);
3798
+ }
3799
+ });
3800
+ function yt(a) {
3801
+ const e = vue.ref();
3802
+ let t;
3803
+ const s = (l) => {
3804
+ if (!a.value || !a.value.$el)
3805
+ return;
3806
+ const h = 6;
3807
+ let c, u;
3808
+ l.touches && l.touches[0] ? (c = l.touches[0].clientX, u = l.touches[0].clientY) : (c = l.clientX, u = l.clientY);
3809
+ let d = c + h, p = u + h;
3810
+ const f = a.value.$el.querySelector("#modal-wrapper");
3811
+ if (!f)
3812
+ return;
3813
+ const m = f.getBoundingClientRect(), b = m.width, y = m.height, S = window.innerWidth, E = window.innerHeight, C = 8;
3814
+ d + b + C > S ? d = c - b - h : d < C && (d = C), p + y + C > E ? p = u - y - h : p < C && (p = C), f.style.top = "".concat(p, "px"), f.style.left = "".concat(d, "px"), f.style.visibility = "visible";
3815
+ };
3816
+ return { message: e, handleTouchStart: (l, h) => {
3817
+ clearTimeout(t), t = setTimeout(() => {
3818
+ e.value = h, vue.nextTick(() => s(l));
3819
+ }, 500);
3820
+ }, handleTouchEnd: () => {
3821
+ clearTimeout(t);
3822
+ }, closeToolbar: () => {
3823
+ e.value = void 0;
3824
+ } };
3825
+ }
3826
+ const Tt = /* @__PURE__ */ vue.defineComponent({
3827
+ props: {
3828
+ controller: {
3829
+ type: Object,
3830
+ required: !0
3831
+ },
3832
+ toolbarItems: {
3833
+ type: Array
3834
+ },
3835
+ enableBackFill: {
3836
+ type: Boolean,
3837
+ default: !0
3838
+ }
3839
+ },
3840
+ setup(a) {
3841
+ const e = new A("chat-messages"), t = vue.ref(), s = vue.ref(), {
3842
+ message: i,
3843
+ handleTouchStart: o,
3844
+ handleTouchEnd: n,
3845
+ closeToolbar: l
3846
+ } = yt(s), h = 5, c = vue.ref(h), u = vue.ref(!1), d = vue.ref(!0), p = vue.ref(!1), {
3847
+ messages: f
3848
+ } = a.controller, m = vue.computed(() => {
3849
+ const C = Math.max(0, f.value.length - c.value);
3850
+ return f.value.slice(C);
3851
+ }), b = vue.computed(() => c.value < f.value.length), y = () => {
3852
+ const C = t.value;
3853
+ C && (p.value = !0, setTimeout(() => {
3854
+ C.scrollTo({
3855
+ top: C.scrollHeight,
3856
+ behavior: "auto"
3857
+ }), p.value = !1;
3858
+ }, 500));
3859
+ };
3860
+ return vue.watch(() => f.value, () => {
3861
+ d.value && y();
3862
+ }), {
3863
+ ns: e,
3864
+ message: i,
3865
+ messages: f,
3866
+ modalRef: s,
3867
+ containerRef: t,
3868
+ visibleMessages: m,
3869
+ handleScroll: () => {
3870
+ if (p.value)
3871
+ return;
3872
+ const C = t.value;
3873
+ if (!C)
3874
+ return;
3875
+ const {
3876
+ scrollTop: U,
3877
+ scrollHeight: re,
3878
+ clientHeight: le
3879
+ } = C;
3880
+ U < 100 && !u.value && b.value && (u.value = !0, setTimeout(() => {
3881
+ c.value = Math.min(c.value + h, f.value.length);
3882
+ const he = C.scrollHeight;
3883
+ setTimeout(() => {
3884
+ const ue = C.scrollHeight;
3885
+ C.scrollTop = ue - he + C.scrollTop, u.value = !1;
3886
+ }, 0);
3887
+ }, 300));
3888
+ const ce = re - (U + le) < 50;
3889
+ d.value = ce;
3890
+ },
3891
+ closeToolbar: l,
3892
+ renderMessage: (C) => {
3893
+ switch (C.type) {
3894
+ case "DEFAULT":
3895
+ return C.role === "ASSISTANT" ? vue.createVNode(pt, {
3896
+ message: C,
3897
+ controller: a.controller
3898
+ }, null) : vue.createVNode(ft, {
3899
+ message: C,
3900
+ controller: a.controller
3901
+ }, null);
3902
+ case "ERROR":
3903
+ return vue.createVNode(lt, {
3904
+ message: C
3905
+ }, null);
3906
+ default:
3907
+ return vue.createVNode(gt, {
3908
+ message: C
3909
+ }, null);
3910
+ }
3911
+ },
3912
+ handleTouchStart: o,
3913
+ handleTouchEnd: n
3914
+ };
3915
+ },
3916
+ render() {
3917
+ return vue.createVNode("div", {
3918
+ ref: "containerRef",
3919
+ class: this.ns.b(),
3920
+ onScroll: this.handleScroll
3921
+ }, [this.visibleMessages.map((a) => vue.createVNode("div", {
3922
+ key: a.messageid,
3923
+ class: this.ns.e("item"),
3924
+ onMouseup: this.handleTouchEnd,
3925
+ onTouchend: this.handleTouchEnd,
3926
+ onMousedown: (e) => this.handleTouchStart(e, a),
3927
+ onTouchstart: (e) => this.handleTouchStart(e, a)
3928
+ }, [this.renderMessage(a)])), vue.createVNode(vt, null, null), this.message && vue.createVNode(wt, {
3929
+ ref: "modalRef",
3930
+ onClose: this.closeToolbar
3931
+ }, {
3932
+ default: () => [vue.createVNode(bt, {
3933
+ data: this.message,
3934
+ items: this.toolbarItems,
3935
+ controller: this.controller,
3936
+ enableBackFill: this.enableBackFill
3937
+ }, null)]
3938
+ })]);
3939
+ }
3940
+ });
3941
+ const At = /* @__PURE__ */ vue.defineComponent({
3942
+ props: {
3943
+ controller: {
3944
+ type: Object,
3945
+ required: !0
3946
+ },
3947
+ toolbarItems: {
3948
+ type: Array
3949
+ }
3950
+ },
3951
+ setup(a) {
3952
+ const e = new A("chat-input"), t = vue.ref([]), s = vue.ref(""), i = vue.ref(!1), o = vue.ref(), n = vue.computed(() => a.controller.isLoading.value), l = () => {
3953
+ const f = window.SpeechRecognition || window.webkitSpeechRecognition;
3954
+ f && (o.value = new f(), o.value.onstart = () => {
3955
+ i.value = !0;
3956
+ }, o.value.onend = () => {
3957
+ i.value = !1;
3958
+ }, o.value.onresult = (m) => {
3959
+ var y, S, E;
3960
+ const b = (E = (S = (y = m.results) == null ? void 0 : y[0]) == null ? void 0 : S[0]) == null ? void 0 : E.transcript;
3961
+ b && (s.value += "".concat(b));
3962
+ });
3963
+ };
3964
+ return vue.onMounted(() => {
3965
+ l();
3966
+ }), {
3967
+ ns: e,
3968
+ message: s,
3969
+ isLoading: n,
3970
+ recording: i,
3971
+ imageList: t,
3972
+ uploadImage: async () => {
3973
+ const f = await window.ibiz.util.file.chooseFileAndUpload(a.controller.context, a.controller.params, {}, {
3974
+ multiple: !0,
3975
+ accept: "image/*",
3976
+ extraParams: {
3977
+ enableNoAccess: !0
3978
+ }
3979
+ });
3980
+ if (!f || !Array.isArray(f))
3981
+ return;
3982
+ const {
3983
+ downloadUrl: m
3984
+ } = window.ibiz.util.file.calcFileUpDownUrl(a.controller.context, a.controller.params, {}, {
3985
+ enableNoAccess: !0
3986
+ });
3987
+ f.forEach((b) => {
3988
+ t.value.push({
3989
+ isImage: !0,
3990
+ name: b.name,
3991
+ url: m.replace("%fileId%", b.fileid)
3992
+ });
3993
+ });
3994
+ },
3995
+ onSendMessage: async () => {
3996
+ if (n.value)
3997
+ await a.controller.abortQuestion();
3998
+ else {
3999
+ const f = t.value.map((b) => "![".concat(b.name, "](").concat(b.url, ")")).join("\n"), m = "".concat(f, "\n").concat(s.value);
4000
+ s.value = "", t.value = [], await a.controller.question(m);
4001
+ }
4002
+ },
4003
+ uploadMaterial: async (f) => {
4004
+ await He.getMaterialHelper("ossfile", a.controller).excuteAction(f);
4005
+ },
4006
+ onRemoveMaterial: (f) => {
4007
+ a.controller.deleteMaterial(f);
4008
+ },
4009
+ onSpeechRecognition: () => {
4010
+ o.value && (i.value ? o.value.end() : o.value.start());
4011
+ }
4012
+ };
4013
+ },
4014
+ render() {
4015
+ return vue.createVNode("div", {
4016
+ class: this.ns.b()
4017
+ }, [vue.createVNode(ne, {
4018
+ class: this.ns.e("material"),
4019
+ materials: this.controller.materials.value,
4020
+ onRemove: this.onRemoveMaterial
4021
+ }, null), vue.createVNode(vue.resolveComponent("van-uploader"), {
4022
+ previewSize: "4rem",
4023
+ showUpload: !1,
4024
+ modelValue: this.imageList,
4025
+ "onUpdate:modelValue": (a) => this.imageList = a,
4026
+ class: this.ns.e("image")
4027
+ }, null), vue.createVNode("div", {
4028
+ class: this.ns.e("content")
4029
+ }, [vue.createVNode("div", {
4030
+ class: [this.ns.e("icon"), this.ns.em("icon", "voice"), this.ns.is("recording", this.recording)],
4031
+ onClick: this.onSpeechRecognition
4032
+ }, [this.recording ? Ue : Pe]), vue.withDirectives(vue.createVNode("textarea", {
4033
+ rows: 1,
4034
+ "onUpdate:modelValue": (a) => this.message = a,
4035
+ placeholder: "输入消息...",
4036
+ class: this.ns.e("input")
4037
+ }, null), [[vue.vModelText, this.message]]), vue.createVNode("div", {
4038
+ class: [this.ns.e("icon"), this.ns.em("icon", "image")],
4039
+ onClick: this.uploadImage
4040
+ }, [ot]), vue.createVNode("div", {
4041
+ class: [this.ns.e("icon"), this.ns.em("icon", "upload")],
4042
+ onClick: this.uploadMaterial
4043
+ }, [Ze]), vue.createVNode("div", {
4044
+ class: [this.ns.e("icon"), this.ns.em("icon", "send"), this.ns.is("disabled", !this.message && !this.isLoading)],
4045
+ onClick: this.onSendMessage
4046
+ }, [this.isLoading ? Xe : Ve])])]);
4047
+ }
4048
+ });
4049
+ const Q = /* @__PURE__ */ vue.defineComponent({
4050
+ props: {
4051
+ enableBackFill: {
4052
+ type: Boolean,
4053
+ default: !0
4054
+ },
4055
+ aiTopic: {
4056
+ type: Object,
4057
+ required: !0
4058
+ },
4059
+ aiChat: {
4060
+ type: Object,
4061
+ required: !0
4062
+ },
4063
+ openMode: {
4064
+ type: String,
4065
+ default: "default"
4066
+ },
4067
+ caption: {
4068
+ type: String,
4069
+ default: "AI助手"
4070
+ },
4071
+ contentToolbarItems: {
4072
+ type: Array
4073
+ },
4074
+ footerToolbarItems: {
4075
+ type: Array
4076
+ },
4077
+ questionToolbarItems: {
4078
+ type: Array
4079
+ },
4080
+ containerOptions: {
4081
+ type: Object
4082
+ },
4083
+ autoClose: {
4084
+ type: Object
4085
+ }
4086
+ },
4087
+ emits: {
4088
+ close: () => !0
4089
+ },
4090
+ setup(a, {
4091
+ emit: e
4092
+ }) {
4093
+ var n;
4094
+ const t = new A("chat-container"), s = ((n = a.containerOptions) == null ? void 0 : n.zIndex) || 10, i = () => {
4095
+ e("close");
4096
+ };
4097
+ return a.aiChat.evt.on("onCompleteMessage", () => {
4098
+ if (a.autoClose) {
4099
+ const {
4100
+ mode: l,
4101
+ duration: h = 3
4102
+ } = a.autoClose;
4103
+ switch (l) {
4104
+ case "close":
4105
+ i();
4106
+ break;
4107
+ case "closetime":
4108
+ setTimeout(() => {
4109
+ i();
4110
+ }, h * 1e3);
4111
+ break;
4112
+ }
4113
+ }
4114
+ }), {
4115
+ ns: t,
4116
+ zIndex: s,
4117
+ onClose: i,
4118
+ onClickOverlay: () => {
4119
+ a.openMode !== "default" && i();
4120
+ }
4121
+ };
4122
+ },
4123
+ render() {
4124
+ return vue.createVNode("div", {
4125
+ style: {
4126
+ zIndex: this.zIndex
4127
+ },
4128
+ class: [this.ns.b(), this.ns.e("overlay")],
4129
+ onClick: this.onClickOverlay
4130
+ }, [vue.createVNode("div", {
4131
+ class: [this.ns.e("dialog"), this.ns.em("dialog", this.openMode)],
4132
+ onClick: (a) => a.stopPropagation()
4133
+ }, [vue.createVNode("div", {
4134
+ class: this.ns.e("header")
4135
+ }, [vue.createVNode("div", {
4136
+ class: this.ns.em("header", "left")
4137
+ }, [vue.createVNode("div", {
4138
+ class: this.ns.em("header", "icon")
4139
+ }, [q]), vue.createVNode("div", {
4140
+ class: this.ns.em("header", "caption")
4141
+ }, [this.caption])]), vue.createVNode("div", {
4142
+ class: this.ns.em("header", "reght")
4143
+ }, [vue.createVNode("div", {
4144
+ class: this.ns.e("icon"),
4145
+ onClick: this.onClose
4146
+ }, [rt])])]), vue.createVNode("div", {
4147
+ class: this.ns.e("content")
4148
+ }, [vue.createVNode(Tt, {
4149
+ controller: this.aiChat,
4150
+ toolbarItems: this.contentToolbarItems,
4151
+ enableBackFill: this.enableBackFill
4152
+ }, null)]), vue.createVNode("div", {
4153
+ class: this.ns.e("footer")
4154
+ }, [vue.createVNode(Ct, {
4155
+ data: this.aiTopic.activedTopic.value,
4156
+ controller: this.aiChat,
4157
+ items: this.footerToolbarItems
4158
+ }, null), vue.createVNode(At, {
4159
+ controller: this.aiChat,
4160
+ toolbarItems: this.questionToolbarItems
4161
+ }, null)])])]);
4162
+ }
4163
+ });
4164
+ class It {
4165
+ /**
4166
+ * Creates an instance of ChatController.
4167
+ * @author tony001
4168
+ * @date 2025-02-24 11:02:20
4169
+ */
4170
+ constructor() {
4171
+ /**
4172
+ * @description 应用
4173
+ * @private
4174
+ * @type {(App | null)}
4175
+ * @memberof ChatController
4176
+ */
4177
+ v(this, "App", null);
4178
+ /**
4179
+ * 聊天框容器
4180
+ *
4181
+ * @author chitanda
4182
+ * @date 2023-10-13 17:10:03
4183
+ * @protected
4184
+ * @type {HTMLDivElement}
4185
+ */
4186
+ v(this, "container");
4187
+ /**
4188
+ * 默认模式(聊天框)和话题模式(支持多话题切换),聊天框为默认模式
4189
+ *
4190
+ * @author tony001
4191
+ * @date 2025-02-20 16:02:50
4192
+ * @protected
4193
+ * @type {('DEFAULT' | 'TOPIC')}
4194
+ */
4195
+ v(this, "mode", "DEFAULT");
4196
+ /**
4197
+ * 资源配置数据
4198
+ */
4199
+ v(this, "resourceOptions");
4200
+ /**
4201
+ * 容器配置备份
4202
+ *
4203
+ * @author tony001
4204
+ * @date 2025-02-24 11:02:49
4205
+ * @protected
4206
+ * @type {(IContainerOptions | undefined)}
4207
+ */
4208
+ v(this, "backupChatOptions");
4209
+ /**
4210
+ * 话题控制器
4211
+ *
4212
+ * @author tony001
4213
+ * @date 2025-02-23 16:02:56
4214
+ * @public
4215
+ * @type {AITopicController}
4216
+ */
4217
+ v(this, "aiTopic");
4218
+ /**
4219
+ * 话题map
4220
+ *
4221
+ * @private
4222
+ * @type {Map<string, AIChatController>}
4223
+ * @memberof ChatController
4224
+ */
4225
+ v(this, "aiTopicMap", /* @__PURE__ */ new Map());
4226
+ this.aiTopic = new _e(this);
4227
+ }
4228
+ /**
4229
+ * 聊天控制器
4230
+ *
4231
+ * @readonly
4232
+ * @type {(AIChatController | undefined)}
4233
+ * @memberof ChatController
4234
+ */
4235
+ get aiChat() {
4236
+ var e;
4237
+ return this.aiTopicMap.get("".concat((e = this.aiTopic.activedTopic.value) == null ? void 0 : e.id));
4238
+ }
4239
+ /**
4240
+ * 初始化IndexDB
4241
+ *
4242
+ * @author tony001
4243
+ * @date 2025-02-24 18:02:50
4244
+ * @return {*} {Promise<void>}
4245
+ */
4246
+ async initIndexDB() {
4247
+ await x.checkTableExists(
4248
+ I.DATA_BASE_NAME,
4249
+ I.DATA_TABLE_NAME
4250
+ ) || await x.createTable(
4251
+ I.DATA_BASE_NAME,
4252
+ I.DATA_TABLE_NAME,
4253
+ I.DATA_TABLE_KEY_NAME,
4254
+ !1
4255
+ );
4256
+ }
4257
+ /**
4258
+ * 创建聊天窗口(会同时显示出来)
4259
+ *
4260
+ * @author tony001
4261
+ * @date 2025-02-24 12:02:58
4262
+ * @param {IContainerOptions} opts
4263
+ * @return {*} {Promise<AIChatController>}
4264
+ */
4265
+ async create(e) {
4266
+ var n, l, h, c;
4267
+ this.resourceOptions = e.resourceOptions, (((n = e.resourceOptions) == null ? void 0 : n.resourceMode) || "LOCAL") === "LOCAL" && await this.initIndexDB(), this.backupChatOptions = e, await this.close(), this.container = document.createElement("div"), this.container.classList.add("ibiz-ai-chat"), document.body.appendChild(this.container);
4268
+ const s = e.chatOptions;
4269
+ let i;
4270
+ e.mode && e.mode === "TOPIC" ? (this.aiTopic.injectResourceOptions(e.resourceOptions), await this.aiTopic.fetchHistory(e.topicOptions), i = e.topicOptions, Object.assign(i, {
4271
+ aiChat: {
4272
+ caption: s.caption,
4273
+ context: s.context,
4274
+ params: s.params,
4275
+ appDataEntityId: s.appDataEntityId,
4276
+ sessionid: s.sessionid,
4277
+ contentToolbarItems: s.contentToolbarItems,
4278
+ footerToolbarItems: s.footerToolbarItems,
4279
+ questionToolbarItems: s.questionToolbarItems,
4280
+ otherToolbarItems: s.otherToolbarItems,
4281
+ appendCurData: s.appendCurData,
4282
+ appendCurContent: s.appendCurContent,
4283
+ enableAIAgentChange: s.enableAIAgentChange,
4284
+ activeAIAgentID: s.activeAIAgentID,
4285
+ aiAgentlist: s.aiAgentlist,
4286
+ srfMode: s.srfMode,
4287
+ appendCurResource: s.appendCurResource
4288
+ }
4289
+ }), this.syncHistoryOptions(i, s, e.resourceOptions), await this.aiTopic.asyncTopic(i)) : this.aiTopic.activedTopic.value = void 0, Object.assign(s, {
4290
+ topicId: i == null ? void 0 : i.id,
4291
+ topic: i,
4292
+ aiTopic: this.aiTopic
4293
+ });
4294
+ const o = new Y(s, this.resourceOptions);
4295
+ return this.aiTopicMap.set("".concat(i == null ? void 0 : i.id), o), this.App = vue.createApp(Q, {
4296
+ aiChat: o,
4297
+ aiTopic: this.aiTopic,
4298
+ mode: e.mode ? e.mode : "DEFAULT",
4299
+ containerOptions: e.containerOptions,
4300
+ caption: e.mode && e.mode === "TOPIC" ? "AI助手" : s.caption,
4301
+ autoClose: (l = e.containerOptions) == null ? void 0 : l.autoClose,
4302
+ enableBackFill: (h = e.containerOptions) == null ? void 0 : h.enableBackFill,
4303
+ contentToolbarItems: s.contentToolbarItems,
4304
+ footerToolbarItems: s.footerToolbarItems,
4305
+ questionToolbarItems: s.questionToolbarItems,
4306
+ openMode: (c = e.containerOptions) == null ? void 0 : c.openMode,
4307
+ onClose: async () => {
4308
+ await this.close(), s.closed && s.closed(
4309
+ s.context,
4310
+ s.params,
4311
+ o.getAllMessages()
4312
+ );
4313
+ }
4314
+ }), this.App.use(Vant), this.App.mount(this.container), o;
4315
+ }
4316
+ /**
4317
+ * 同步历史参数(历史激活标识、历史会话标识)
4318
+ * @param topicOptions
4319
+ * @param chatOptions
4320
+ */
4321
+ syncHistoryOptions(e, t, s) {
4322
+ if (e.disableStorage) {
4323
+ const n = De("TEMP");
4324
+ t.sessionid = n, e.aiChat.sessionid = n, e.caption = "临时会话", e.sourceCaption = "临时会话", e.captionFilled = !0;
4325
+ return;
4326
+ }
4327
+ const i = this.aiTopic.getCurrentTopicByID(
4328
+ e.id
4329
+ );
4330
+ if (i && (e.sequence = i.sequence, e.isTop = i.isTop), i && i.aiChat && i.aiChat.activeAIAgentID)
4331
+ t.activeAIAgentID = i.aiChat.activeAIAgentID, e.aiChat.activeAIAgentID = i.aiChat.activeAIAgentID;
4332
+ else if (t.aiAgentlist && t.aiAgentlist.length > 0 && !t.activeAIAgentID) {
4333
+ const n = t.aiAgentlist.find(
4334
+ (l) => l.default === 1
4335
+ );
4336
+ n ? (t.activeAIAgentID = n.id, e.aiChat.activeAIAgentID = n.id) : (t.activeAIAgentID = t.aiAgentlist[0].id, e.aiChat.activeAIAgentID = t.aiAgentlist[0].id);
4337
+ }
4338
+ i && i.aiChat && i.aiChat.sessionid && (t.sessionid = i.aiChat.sessionid, e.aiChat.sessionid = i.aiChat.sessionid);
4339
+ const o = s.resourceMode;
4340
+ o === "LOCAL" ? e.captionMode !== "default" ? (e.sourceCaption = "新会话", i && i.captionFilled && i.caption ? (e.captionFilled = i.captionFilled, e.caption = i.caption) : e.caption = "新会话") : (e.sourceCaption = e.caption, e.captionFilled = !0) : o === "REMOTE" && (e.sourceCaption = e.caption, i && i.caption && (e.caption = i.caption), e.captionFilled = !1), o === "REMOTE" && i && i.realid && (e.realid = i.realid);
4341
+ }
4342
+ /**
4343
+ * 切换聊天控制器
4344
+ *
4345
+ * @author tony001
4346
+ * @date 2025-02-24 11:02:24
4347
+ * @param {ChatTopic} topic
4348
+ */
4349
+ switchAiChatController(e) {
4350
+ var i, o, n, l, h, c, u, d, p;
4351
+ const t = {
4352
+ ...this.backupChatOptions.chatOptions
4353
+ };
4354
+ e.aiChat && Object.assign(t, {
4355
+ caption: e.aiChat.caption,
4356
+ context: e.aiChat.context,
4357
+ params: e.aiChat.params,
4358
+ sessionid: e.aiChat.sessionid,
4359
+ contentToolbarItems: e.aiChat.contentToolbarItems,
4360
+ footerToolbarItems: e.aiChat.footerToolbarItems,
4361
+ questionToolbarItems: e.aiChat.questionToolbarItems,
4362
+ otherToolbarItems: e.aiChat.otherToolbarItems,
4363
+ appendCurData: e.aiChat.appendCurData,
4364
+ appendCurContent: e.aiChat.appendCurContent,
4365
+ aiAgentlist: e.aiChat.aiAgentlist,
4366
+ activeAIAgentID: e.aiChat.activeAIAgentID,
4367
+ enableAIAgentChange: e.aiChat.enableAIAgentChange,
4368
+ srfMode: e.aiChat.srfMode,
4369
+ appendCurResource: e.aiChat.appendCurResource,
4370
+ appDataEntityId: e.aiChat.appDataEntityId,
4371
+ topicId: e.id,
4372
+ topic: e,
4373
+ aiTopic: this.aiTopic,
4374
+ extendToolbarClick: this.backupChatOptions.chatOptions.extendToolbarClick,
4375
+ recommendPrompt: this.backupChatOptions.chatOptions.recommendPrompt
4376
+ });
4377
+ let s;
4378
+ this.aiTopicMap.has("".concat(e.id)) ? s = this.aiTopicMap.get("".concat(e.id)) : (s = new Y(t, this.resourceOptions), this.aiTopicMap.set("".concat(e.id), s)), this.container && this.App && (this.App.unmount(), this.App = vue.createApp(Q, {
4379
+ aiChat: s,
4380
+ aiTopic: this.aiTopic,
4381
+ mode: (i = this.backupChatOptions) != null && i.mode ? this.backupChatOptions.mode : "DEFAULT",
4382
+ containerOptions: (o = this.backupChatOptions) == null ? void 0 : o.containerOptions,
4383
+ caption: (n = this.backupChatOptions) != null && n.mode && this.backupChatOptions.mode === "TOPIC" ? "AI助手" : t.caption,
4384
+ enableBackFill: (h = (l = this.backupChatOptions) == null ? void 0 : l.containerOptions) == null ? void 0 : h.enableBackFill,
4385
+ autoClose: (u = (c = this.backupChatOptions) == null ? void 0 : c.containerOptions) == null ? void 0 : u.autoClose,
4386
+ contentToolbarItems: t.contentToolbarItems,
4387
+ footerToolbarItems: t.footerToolbarItems,
4388
+ questionToolbarItems: t.questionToolbarItems,
4389
+ openMode: (p = (d = this.backupChatOptions) == null ? void 0 : d.containerOptions) == null ? void 0 : p.openMode,
4390
+ onClose: async () => {
4391
+ await this.close(), t.closed && t.closed(t.context, t.params, s.getAllMessages());
4392
+ }
4393
+ }), this.App.mount(this.container));
4394
+ }
4395
+ /**
4396
+ * 隐藏聊天窗口(必须先创建)
4397
+ *
4398
+ * @author chitanda
4399
+ * @date 2023-10-13 17:10:55
4400
+ */
4401
+ hidden() {
4402
+ this.container && (this.container.style.display = "none");
4403
+ }
4404
+ /**
4405
+ * 显示聊天窗窗口(必须先创建)
4406
+ *
4407
+ * @author chitanda
4408
+ * @date 2023-10-13 17:10:29
4409
+ */
4410
+ show() {
4411
+ this.container && (this.container.style.display = "flex");
4412
+ }
4413
+ /**
4414
+ * 关闭聊天窗口
4415
+ *
4416
+ * @author chitanda
4417
+ * @date 2023-10-13 17:10:10
4418
+ */
4419
+ async close() {
4420
+ await Promise.all(
4421
+ Array.from(this.aiTopicMap).map((e) => e[1].destroyed())
4422
+ ), this.App && this.container && (this.App.unmount(), this.App = null), this.container && document.body.contains(this.container) && (document.body.removeChild(this.container), this.container = void 0);
4423
+ }
4424
+ }
4425
+ const Dt = new It();
4426
+
4427
+ exports.chat = Dt;