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