@glodon-aiot/agent-cli-ui 2.4.7
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/README.git.md +73 -0
- package/README.lib.md +135 -0
- package/dist/es/AgentClientUI.mjs +155 -0
- package/dist/es/Dialog/AgentChat/index.mjs +757 -0
- package/dist/es/Dialog/AgentChat/style.less.mjs +4 -0
- package/dist/es/Dialog/ConnectToNetwork/index.mjs +92 -0
- package/dist/es/Dialog/ConnectToNetwork/style.less.mjs +4 -0
- package/dist/es/Dialog/FileCard/doc-icons/doc.svg.mjs +4 -0
- package/dist/es/Dialog/FileCard/doc-icons/docx.svg.mjs +4 -0
- package/dist/es/Dialog/FileCard/doc-icons/pdf.svg.mjs +4 -0
- package/dist/es/Dialog/FileCard/index.mjs +142 -0
- package/dist/es/Dialog/FileCard/style.less.mjs +4 -0
- package/dist/es/Dialog/FilePreview/index.mjs +90 -0
- package/dist/es/Dialog/FilePreview/style.less.mjs +4 -0
- package/dist/es/Dialog/Greeting/index.mjs +31 -0
- package/dist/es/Dialog/Greeting/style.less.mjs +4 -0
- package/dist/es/Dialog/HistoryContent/index.mjs +14 -0
- package/dist/es/Dialog/HistoryContent/style.less.mjs +4 -0
- package/dist/es/Dialog/HistoryItem/index.mjs +355 -0
- package/dist/es/Dialog/HistoryItem/style.less.mjs +4 -0
- package/dist/es/Dialog/HistoryItem/think.svg.mjs +4 -0
- package/dist/es/Dialog/KnowledgeDoc/index.mjs +46 -0
- package/dist/es/Dialog/KnowledgeDoc/style.less.mjs +4 -0
- package/dist/es/Dialog/KnowledgeList/KnowledgeSelect/index.mjs +68 -0
- package/dist/es/Dialog/KnowledgeList/KnowledgeSelect/style.less.mjs +4 -0
- package/dist/es/Dialog/KnowledgeList/index.mjs +69 -0
- package/dist/es/Dialog/KnowledgeList/style.less.mjs +4 -0
- package/dist/es/Dialog/PromptManager/PromptList/PromptListItem.mjs +89 -0
- package/dist/es/Dialog/PromptManager/PromptList/PublicPromptList.mjs +48 -0
- package/dist/es/Dialog/PromptManager/PromptList/access/empty.svg.mjs +4 -0
- package/dist/es/Dialog/PromptManager/PromptList/style.less.mjs +4 -0
- package/dist/es/Dialog/PromptManager/index.mjs +128 -0
- package/dist/es/Dialog/PromptManager/style.less.mjs +4 -0
- package/dist/es/Dialog/PromptSetting/index.mjs +130 -0
- package/dist/es/Dialog/PromptSetting/style.less.mjs +4 -0
- package/dist/es/Dialog/Recommend/RecommendItem.mjs +96 -0
- package/dist/es/Dialog/Recommend/index.mjs +60 -0
- package/dist/es/Dialog/Recommend/style.less.mjs +4 -0
- package/dist/es/Dialog/Recommend/tip.svg.mjs +4 -0
- package/dist/es/Dialog/ReferCollapse/index.mjs +65 -0
- package/dist/es/Dialog/ReferCollapse/style.less.mjs +4 -0
- package/dist/es/Dialog/SearchReference/index.mjs +64 -0
- package/dist/es/Dialog/SearchReference/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionAction/index.mjs +232 -0
- package/dist/es/Dialog/SessionAction/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionList/index.mjs +197 -0
- package/dist/es/Dialog/SessionList/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/NameEditPanel.mjs +48 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/SessionItem.mjs +142 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/doc-icons/doc.svg.mjs +4 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/doc-icons/docx.svg.mjs +4 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/doc-icons/pdf.svg.mjs +4 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/index.mjs +120 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionListDrawer/index.mjs +44 -0
- package/dist/es/Dialog/SessionListDrawer/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionRefer/ReferItem/index.mjs +94 -0
- package/dist/es/Dialog/SessionRefer/ReferItem/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionRefer/index.mjs +86 -0
- package/dist/es/Dialog/SessionRefer/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionRelated/index.mjs +43 -0
- package/dist/es/Dialog/SessionRelated/style.less.mjs +4 -0
- package/dist/es/Dialog/UploadKnowledgeFiles/ClearModal/index.mjs +51 -0
- package/dist/es/Dialog/UploadKnowledgeFiles/ClearModal/style.less.mjs +4 -0
- package/dist/es/Dialog/UploadKnowledgeFiles/index.mjs +368 -0
- package/dist/es/Dialog/UploadKnowledgeFiles/style.less.mjs +4 -0
- package/dist/es/Dialog/UploadingPrompt/index.mjs +67 -0
- package/dist/es/Dialog/UploadingPrompt/style.less.mjs +4 -0
- package/dist/es/Dialog/index.mjs +128 -0
- package/dist/es/Dialog/style.less.mjs +4 -0
- package/dist/es/FileCard/doc-icons/doc.svg.mjs +4 -0
- package/dist/es/FileCard/doc-icons/docx.svg.mjs +4 -0
- package/dist/es/FileCard/doc-icons/pdf.svg.mjs +4 -0
- package/dist/es/FileItem/index.mjs +85 -0
- package/dist/es/FileItem/style.less.mjs +4 -0
- package/dist/es/Footer/FooterWarning.mjs +25 -0
- package/dist/es/Footer/index.mjs +18 -0
- package/dist/es/Footer/style.less.mjs +4 -0
- package/dist/es/Iconfont/index.mjs +12 -0
- package/dist/es/InputProgress/index.mjs +39 -0
- package/dist/es/InputProgress/style.less.mjs +4 -0
- package/dist/es/QuillEditor/index.mjs +219 -0
- package/dist/es/QuillEditor/style.less.mjs +4 -0
- package/dist/es/_virtual/_cloneBuffer.mjs +4 -0
- package/dist/es/_virtual/_commonjsHelpers.mjs +8 -0
- package/dist/es/_virtual/_nodeUtil.mjs +4 -0
- package/dist/es/_virtual/index.mjs +4 -0
- package/dist/es/_virtual/index2.mjs +4 -0
- package/dist/es/_virtual/index3.mjs +4 -0
- package/dist/es/_virtual/index4.mjs +4 -0
- package/dist/es/_virtual/isBuffer.mjs +4 -0
- package/dist/es/_virtual/jsx-runtime.mjs +7 -0
- package/dist/es/_virtual/jsx-runtime2.mjs +4 -0
- package/dist/es/_virtual/minio-zj.mjs +4 -0
- package/dist/es/_virtual/react-jsx-runtime.production.min.mjs +4 -0
- package/dist/es/assets/brand.svg.mjs +4 -0
- package/dist/es/assets/icon.svg.mjs +4 -0
- package/dist/es/components/Copy/index.mjs +44 -0
- package/dist/es/components/Copy/style.less.mjs +4 -0
- package/dist/es/components/JsonDisplay/index.mjs +16 -0
- package/dist/es/components/JsonDisplay/style.less.mjs +4 -0
- package/dist/es/components/Markdown/Code/index.mjs +69 -0
- package/dist/es/components/Markdown/Image/index.mjs +26 -0
- package/dist/es/components/Markdown/index.mjs +48 -0
- package/dist/es/components/Markdown/style.less.mjs +4 -0
- package/dist/es/components/WebLink/index.mjs +26 -0
- package/dist/es/constant.mjs +96 -0
- package/dist/es/context.mjs +7 -0
- package/dist/es/favicon.ico +0 -0
- package/dist/es/favicon2.ico +0 -0
- package/dist/es/font/font_4108228_4w5nlhafpte.js +1 -0
- package/dist/es/font/font_4439177_0sppkcnqiqgs.js +1 -0
- package/dist/es/font/gos-font.js +64 -0
- package/dist/es/images/empty.svg +40 -0
- package/dist/es/images/loading.gif +0 -0
- package/dist/es/images/logo.png +0 -0
- package/dist/es/images/map-example.png +0 -0
- package/dist/es/images/sketch.png +0 -0
- package/dist/es/index.html +43 -0
- package/dist/es/index.mjs +325 -0
- package/dist/es/logo192.png +0 -0
- package/dist/es/logo512.png +0 -0
- package/dist/es/manifest.json +25 -0
- package/dist/es/node_modules/@babel/runtime/helpers/esm/extends.mjs +13 -0
- package/dist/es/node_modules/@glodon-aiot/minio/dist/minio-zj.mjs +26485 -0
- package/dist/es/node_modules/@socket.io/component-emitter/lib/esm/index.mjs +54 -0
- package/dist/es/node_modules/ahooks/es/useKeyPress/index.mjs +221 -0
- package/dist/es/node_modules/ahooks/es/useLatest/index.mjs +8 -0
- package/dist/es/node_modules/ahooks/es/useMemoizedFn/index.mjs +19 -0
- package/dist/es/node_modules/ahooks/es/useUnmount/index.mjs +17 -0
- package/dist/es/node_modules/ahooks/es/utils/createEffectWithTarget.mjs +27 -0
- package/dist/es/node_modules/ahooks/es/utils/depsAreSame.mjs +11 -0
- package/dist/es/node_modules/ahooks/es/utils/depsEqual.mjs +7 -0
- package/dist/es/node_modules/ahooks/es/utils/domTarget.mjs +13 -0
- package/dist/es/node_modules/ahooks/es/utils/index.mjs +12 -0
- package/dist/es/node_modules/ahooks/es/utils/isAppleDevice.mjs +5 -0
- package/dist/es/node_modules/ahooks/es/utils/isBrowser.mjs +5 -0
- package/dist/es/node_modules/ahooks/es/utils/isDev.mjs +5 -0
- package/dist/es/node_modules/ahooks/es/utils/useDeepCompareWithTarget.mjs +11 -0
- package/dist/es/node_modules/ahooks/es/utils/useEffectWithTarget.mjs +7 -0
- package/dist/es/node_modules/antd/es/calendar/locale/zh_CN.mjs +4 -0
- package/dist/es/node_modules/antd/es/date-picker/locale/zh_CN.mjs +23 -0
- package/dist/es/node_modules/antd/es/locale/zh_CN.mjs +132 -0
- package/dist/es/node_modules/antd/es/time-picker/locale/zh_CN.mjs +8 -0
- package/dist/es/node_modules/base64-js/index.mjs +47 -0
- package/dist/es/node_modules/buffer/index.mjs +927 -0
- package/dist/es/node_modules/classnames/index.mjs +42 -0
- package/dist/es/node_modules/copy-to-clipboard/index.mjs +46 -0
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/has-cors.mjs +9 -0
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseqs.mjs +18 -0
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseuri.mjs +24 -0
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/yeast.mjs +19 -0
- package/dist/es/node_modules/engine.io-client/build/esm/globalThis.browser.mjs +4 -0
- package/dist/es/node_modules/engine.io-client/build/esm/socket.mjs +317 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transport.mjs +113 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/index.mjs +11 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/polling.mjs +273 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.mjs +8 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket.mjs +87 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/webtransport.mjs +52 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.mjs +21 -0
- package/dist/es/node_modules/engine.io-client/build/esm/util.mjs +23 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/commons.mjs +21 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.mjs +14 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/decodePacket.browser.mjs +39 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/encodePacket.browser.mjs +28 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/index.mjs +105 -0
- package/dist/es/node_modules/ieee754/index.mjs +28 -0
- package/dist/es/node_modules/js-base64/base64.mjs +31 -0
- package/dist/es/node_modules/lodash/_Hash.mjs +22 -0
- package/dist/es/node_modules/lodash/_ListCache.mjs +22 -0
- package/dist/es/node_modules/lodash/_Map.mjs +6 -0
- package/dist/es/node_modules/lodash/_MapCache.mjs +22 -0
- package/dist/es/node_modules/lodash/_Stack.mjs +20 -0
- package/dist/es/node_modules/lodash/_Symbol.mjs +5 -0
- package/dist/es/node_modules/lodash/_Uint8Array.mjs +5 -0
- package/dist/es/node_modules/lodash/_apply.mjs +17 -0
- package/dist/es/node_modules/lodash/_arrayLikeKeys.mjs +21 -0
- package/dist/es/node_modules/lodash/_assignMergeValue.mjs +10 -0
- package/dist/es/node_modules/lodash/_assignValue.mjs +11 -0
- package/dist/es/node_modules/lodash/_assocIndexOf.mjs +12 -0
- package/dist/es/node_modules/lodash/_baseAssignValue.mjs +14 -0
- package/dist/es/node_modules/lodash/_baseCreate.mjs +17 -0
- package/dist/es/node_modules/lodash/_baseFor.mjs +5 -0
- package/dist/es/node_modules/lodash/_baseGetTag.mjs +11 -0
- package/dist/es/node_modules/lodash/_baseIsArguments.mjs +10 -0
- package/dist/es/node_modules/lodash/_baseIsNative.mjs +15 -0
- package/dist/es/node_modules/lodash/_baseIsTypedArray.mjs +13 -0
- package/dist/es/node_modules/lodash/_baseKeysIn.mjs +16 -0
- package/dist/es/node_modules/lodash/_baseMerge.mjs +22 -0
- package/dist/es/node_modules/lodash/_baseMergeDeep.mjs +33 -0
- package/dist/es/node_modules/lodash/_baseRest.mjs +11 -0
- package/dist/es/node_modules/lodash/_baseSetToString.mjs +14 -0
- package/dist/es/node_modules/lodash/_baseTimes.mjs +9 -0
- package/dist/es/node_modules/lodash/_baseTrim.mjs +9 -0
- package/dist/es/node_modules/lodash/_baseUnary.mjs +9 -0
- package/dist/es/node_modules/lodash/_cloneArrayBuffer.mjs +10 -0
- package/dist/es/node_modules/lodash/_cloneBuffer.mjs +17 -0
- package/dist/es/node_modules/lodash/_cloneTypedArray.mjs +10 -0
- package/dist/es/node_modules/lodash/_copyArray.mjs +10 -0
- package/dist/es/node_modules/lodash/_copyObject.mjs +16 -0
- package/dist/es/node_modules/lodash/_coreJsData.mjs +5 -0
- package/dist/es/node_modules/lodash/_createAssigner.mjs +17 -0
- package/dist/es/node_modules/lodash/_createBaseFor.mjs +14 -0
- package/dist/es/node_modules/lodash/_defineProperty.mjs +11 -0
- package/dist/es/node_modules/lodash/_freeGlobal.mjs +5 -0
- package/dist/es/node_modules/lodash/_getMapData.mjs +10 -0
- package/dist/es/node_modules/lodash/_getNative.mjs +11 -0
- package/dist/es/node_modules/lodash/_getPrototype.mjs +5 -0
- package/dist/es/node_modules/lodash/_getRawTag.mjs +16 -0
- package/dist/es/node_modules/lodash/_getValue.mjs +7 -0
- package/dist/es/node_modules/lodash/_hashClear.mjs +9 -0
- package/dist/es/node_modules/lodash/_hashDelete.mjs +8 -0
- package/dist/es/node_modules/lodash/_hashGet.mjs +14 -0
- package/dist/es/node_modules/lodash/_hashHas.mjs +10 -0
- package/dist/es/node_modules/lodash/_hashSet.mjs +10 -0
- package/dist/es/node_modules/lodash/_initCloneObject.mjs +11 -0
- package/dist/es/node_modules/lodash/_isIndex.mjs +9 -0
- package/dist/es/node_modules/lodash/_isIterateeCall.mjs +15 -0
- package/dist/es/node_modules/lodash/_isKeyable.mjs +8 -0
- package/dist/es/node_modules/lodash/_isMasked.mjs +12 -0
- package/dist/es/node_modules/lodash/_isPrototype.mjs +9 -0
- package/dist/es/node_modules/lodash/_listCacheClear.mjs +7 -0
- package/dist/es/node_modules/lodash/_listCacheDelete.mjs +13 -0
- package/dist/es/node_modules/lodash/_listCacheGet.mjs +10 -0
- package/dist/es/node_modules/lodash/_listCacheHas.mjs +9 -0
- package/dist/es/node_modules/lodash/_listCacheSet.mjs +10 -0
- package/dist/es/node_modules/lodash/_mapCacheClear.mjs +15 -0
- package/dist/es/node_modules/lodash/_mapCacheDelete.mjs +10 -0
- package/dist/es/node_modules/lodash/_mapCacheGet.mjs +9 -0
- package/dist/es/node_modules/lodash/_mapCacheHas.mjs +9 -0
- package/dist/es/node_modules/lodash/_mapCacheSet.mjs +10 -0
- package/dist/es/node_modules/lodash/_nativeCreate.mjs +5 -0
- package/dist/es/node_modules/lodash/_nativeKeysIn.mjs +11 -0
- package/dist/es/node_modules/lodash/_nodeUtil.mjs +17 -0
- package/dist/es/node_modules/lodash/_objectToString.mjs +8 -0
- package/dist/es/node_modules/lodash/_overArg.mjs +9 -0
- package/dist/es/node_modules/lodash/_overRest.mjs +16 -0
- package/dist/es/node_modules/lodash/_root.mjs +5 -0
- package/dist/es/node_modules/lodash/_safeGet.mjs +8 -0
- package/dist/es/node_modules/lodash/_setToString.mjs +6 -0
- package/dist/es/node_modules/lodash/_shortOut.mjs +17 -0
- package/dist/es/node_modules/lodash/_stackClear.mjs +9 -0
- package/dist/es/node_modules/lodash/_stackDelete.mjs +8 -0
- package/dist/es/node_modules/lodash/_stackGet.mjs +7 -0
- package/dist/es/node_modules/lodash/_stackHas.mjs +7 -0
- package/dist/es/node_modules/lodash/_stackSet.mjs +18 -0
- package/dist/es/node_modules/lodash/_toSource.mjs +18 -0
- package/dist/es/node_modules/lodash/_trimmedEndIndex.mjs +10 -0
- package/dist/es/node_modules/lodash/constant.mjs +9 -0
- package/dist/es/node_modules/lodash/debounce.mjs +57 -0
- package/dist/es/node_modules/lodash/eq.mjs +7 -0
- package/dist/es/node_modules/lodash/identity.mjs +7 -0
- package/dist/es/node_modules/lodash/isArguments.mjs +10 -0
- package/dist/es/node_modules/lodash/isArray.mjs +4 -0
- package/dist/es/node_modules/lodash/isArrayLike.mjs +10 -0
- package/dist/es/node_modules/lodash/isArrayLikeObject.mjs +10 -0
- package/dist/es/node_modules/lodash/isBuffer.mjs +12 -0
- package/dist/es/node_modules/lodash/isFunction.mjs +13 -0
- package/dist/es/node_modules/lodash/isLength.mjs +8 -0
- package/dist/es/node_modules/lodash/isObject.mjs +8 -0
- package/dist/es/node_modules/lodash/isObjectLike.mjs +7 -0
- package/dist/es/node_modules/lodash/isPlainObject.mjs +17 -0
- package/dist/es/node_modules/lodash/isSymbol.mjs +10 -0
- package/dist/es/node_modules/lodash/isTypedArray.mjs +7 -0
- package/dist/es/node_modules/lodash/keysIn.mjs +11 -0
- package/dist/es/node_modules/lodash/merge.mjs +10 -0
- package/dist/es/node_modules/lodash/now.mjs +7 -0
- package/dist/es/node_modules/lodash/stubFalse.mjs +7 -0
- package/dist/es/node_modules/lodash/toNumber.mjs +23 -0
- package/dist/es/node_modules/lodash/toPlainObject.mjs +10 -0
- package/dist/es/node_modules/object-assign/index.mjs +34 -0
- package/dist/es/node_modules/rc-pagination/es/locale/zh_CN.mjs +18 -0
- package/dist/es/node_modules/rc-picker/es/locale/zh_CN.mjs +31 -0
- package/dist/es/node_modules/react/cjs/react-jsx-runtime.production.min.mjs +45 -0
- package/dist/es/node_modules/react/jsx-runtime.mjs +8 -0
- package/dist/es/node_modules/react-fast-compare/index.mjs +78 -0
- package/dist/es/node_modules/react-infinite-scroll-component/dist/index.es.mjs +188 -0
- package/dist/es/node_modules/react-quill/dist/quill.snow.css.mjs +4 -0
- package/dist/es/node_modules/socket.io-client/build/esm/contrib/backo2.mjs +26 -0
- package/dist/es/node_modules/socket.io-client/build/esm/index.mjs +25 -0
- package/dist/es/node_modules/socket.io-client/build/esm/manager.mjs +242 -0
- package/dist/es/node_modules/socket.io-client/build/esm/on.mjs +8 -0
- package/dist/es/node_modules/socket.io-client/build/esm/socket.mjs +608 -0
- package/dist/es/node_modules/socket.io-client/build/esm/url.mjs +19 -0
- package/dist/es/node_modules/socket.io-parser/build/esm/binary.mjs +52 -0
- package/dist/es/node_modules/socket.io-parser/build/esm/index.mjs +203 -0
- package/dist/es/node_modules/socket.io-parser/build/esm/is-binary.mjs +26 -0
- package/dist/es/node_modules/toggle-selection/index.mjs +25 -0
- package/dist/es/node_modules/tslib/tslib.es6.mjs +15 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +6 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +10 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +9 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +19 -0
- package/dist/es/packages/agent-cli-sdk/src/AgentSession.mjs +243 -0
- package/dist/es/packages/agent-cli-sdk/src/BotClient.mjs +242 -0
- package/dist/es/packages/agent-cli-sdk/src/Config.mjs +34 -0
- package/dist/es/packages/agent-cli-sdk/src/DialogSession.mjs +281 -0
- package/dist/es/packages/agent-cli-sdk/src/EventBus.mjs +64 -0
- package/dist/es/packages/agent-cli-sdk/src/Logger.mjs +31 -0
- package/dist/es/packages/agent-cli-sdk/src/PayloadTypes.mjs +4 -0
- package/dist/es/packages/agent-cli-sdk/src/Session.mjs +527 -0
- package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/fetch.mjs +112 -0
- package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/parse.mjs +97 -0
- package/dist/es/packages/agent-cli-sdk/src/api/index.mjs +48 -0
- package/dist/es/packages/agent-cli-sdk/src/utils.mjs +11 -0
- package/dist/es/packages/apis/dist/es/aecpilot/cosntant.mjs +5 -0
- package/dist/es/packages/apis/dist/es/aecpilot/model.mjs +9 -0
- package/dist/es/packages/apis/dist/es/aecpilotui/index.mjs +8 -0
- package/dist/es/packages/apis/dist/es/agentcliui/index.mjs +414 -0
- package/dist/es/packages/apis/dist/es/base/index.mjs +154 -0
- package/dist/es/packages/apis/dist/es/cvforce/index.mjs +431 -0
- package/dist/es/packages/apis/dist/es/cvforce/model.mjs +6 -0
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +6 -0
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +10 -0
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +9 -0
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +19 -0
- package/dist/es/packages/apis/dist/es/utils/fetchEventSource/fetch.mjs +106 -0
- package/dist/es/packages/apis/dist/es/utils/fetchEventSource/parse.mjs +97 -0
- package/dist/es/robots.txt +3 -0
- package/dist/es/style.less.mjs +4 -0
- package/dist/es/types.mjs +4 -0
- package/dist/es/utils/clipboard.mjs +38 -0
- package/dist/es/utils/index.mjs +33 -0
- package/dist/lib/favicon.ico +0 -0
- package/dist/lib/favicon2.ico +0 -0
- package/dist/lib/font/font_4108228_4w5nlhafpte.js +1 -0
- package/dist/lib/font/font_4439177_0sppkcnqiqgs.js +1 -0
- package/dist/lib/font/gos-font.js +64 -0
- package/dist/lib/images/empty.svg +40 -0
- package/dist/lib/images/loading.gif +0 -0
- package/dist/lib/images/logo.png +0 -0
- package/dist/lib/images/map-example.png +0 -0
- package/dist/lib/images/sketch.png +0 -0
- package/dist/lib/index.html +43 -0
- package/dist/lib/index.js +169 -0
- package/dist/lib/logo192.png +0 -0
- package/dist/lib/logo512.png +0 -0
- package/dist/lib/manifest.json +25 -0
- package/dist/lib/robots.txt +3 -0
- package/dist/src/AgentClientUI.d.ts +4 -0
- package/dist/src/ConnectToNetwork/index.d.ts +13 -0
- package/dist/src/Dialog/AgentChat/index.d.ts +17 -0
- package/dist/src/Dialog/ChatEmptyView/index.d.ts +6 -0
- package/dist/src/Dialog/ConnectToNetwork/index.d.ts +13 -0
- package/dist/src/Dialog/FileCard/index.d.ts +22 -0
- package/dist/src/Dialog/FilePreview/index.d.ts +20 -0
- package/dist/src/Dialog/Greeting/index.d.ts +7 -0
- package/dist/src/Dialog/HistoryContent/index.d.ts +5 -0
- package/dist/src/Dialog/HistoryItem/index.d.ts +17 -0
- package/dist/src/Dialog/KnowledgeDoc/index.d.ts +9 -0
- package/dist/src/Dialog/KnowledgeList/KnowledgeSelect/index.d.ts +12 -0
- package/dist/src/Dialog/KnowledgeList/index.d.ts +13 -0
- package/dist/src/Dialog/PromptManager/PromptList/EditPromptModal/index.d.ts +11 -0
- package/dist/src/Dialog/PromptManager/PromptList/PrivatePromptList.d.ts +12 -0
- package/dist/src/Dialog/PromptManager/PromptList/PromptListItem.d.ts +13 -0
- package/dist/src/Dialog/PromptManager/PromptList/PublicPromptList.d.ts +12 -0
- package/dist/src/Dialog/PromptManager/index.d.ts +13 -0
- package/dist/src/Dialog/PromptSetting/index.d.ts +14 -0
- package/dist/src/Dialog/Recommend/RecommendItem.d.ts +12 -0
- package/dist/src/Dialog/Recommend/index.d.ts +14 -0
- package/dist/src/Dialog/ReferCollapse/index.d.ts +8 -0
- package/dist/src/Dialog/SearchReference/index.d.ts +7 -0
- package/dist/src/Dialog/SessionAction/index.d.ts +11 -0
- package/dist/src/Dialog/SessionList/index.d.ts +20 -0
- package/dist/src/Dialog/SessionListDrawer/HistorySessionList/NameEditPanel.d.ts +9 -0
- package/dist/src/Dialog/SessionListDrawer/HistorySessionList/SessionItem.d.ts +16 -0
- package/dist/src/Dialog/SessionListDrawer/HistorySessionList/index.d.ts +9 -0
- package/dist/src/Dialog/SessionListDrawer/index.d.ts +9 -0
- package/dist/src/Dialog/SessionRefer/ReferItem/index.d.ts +9 -0
- package/dist/src/Dialog/SessionRefer/index.d.ts +8 -0
- package/dist/src/Dialog/SessionRelated/index.d.ts +9 -0
- package/dist/src/Dialog/UploadFiles/ClearModal/index.d.ts +7 -0
- package/dist/src/Dialog/UploadFiles/index.d.ts +21 -0
- package/dist/src/Dialog/UploadKnowledgeFiles/ClearModal/index.d.ts +7 -0
- package/dist/src/Dialog/UploadKnowledgeFiles/index.d.ts +22 -0
- package/dist/src/Dialog/UploadingPrompt/index.d.ts +9 -0
- package/dist/src/Dialog/index.d.ts +9 -0
- package/dist/src/FileCard/index.d.ts +21 -0
- package/dist/src/FileItem/index.d.ts +11 -0
- package/dist/src/Footer/FooterWarning.d.ts +8 -0
- package/dist/src/Footer/index.d.ts +7 -0
- package/dist/src/Greeting/index.d.ts +7 -0
- package/dist/src/Iconfont/font_4108228_8te6zfkclqu.d.ts +0 -0
- package/dist/src/Iconfont/font_4439177_7rytwlvbmjj.d.ts +0 -0
- package/dist/src/Iconfont/index.d.ts +3 -0
- package/dist/src/InputProgress/index.d.ts +7 -0
- package/dist/src/QuillEditor/index.d.ts +19 -0
- package/dist/src/components/Copy/index.d.ts +5 -0
- package/dist/src/components/Header/index.d.ts +6 -0
- package/dist/src/components/JsonDisplay/index.d.ts +6 -0
- package/dist/src/components/Markdown/Code/index.d.ts +3 -0
- package/dist/src/components/Markdown/Image/index.d.ts +3 -0
- package/dist/src/components/Markdown/index.d.ts +6 -0
- package/dist/src/components/PDFViewer/index.d.ts +7 -0
- package/dist/src/components/WebLink/index.d.ts +7 -0
- package/dist/src/constant.d.ts +11 -0
- package/dist/src/context.d.ts +5 -0
- package/dist/src/index.d.ts +33 -0
- package/dist/src/types.d.ts +183 -0
- package/dist/src/utils/clipboard.d.ts +11 -0
- package/dist/src/utils/fetchEventSource/fetch.d.ts +44 -0
- package/dist/src/utils/fetchEventSource/index.d.ts +1 -0
- package/dist/src/utils/fetchEventSource/parse.d.ts +36 -0
- package/dist/src/utils/index.d.ts +17 -0
- package/package.json +138 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var y = (c, i, t) => i in c ? u(c, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[i] = t;
|
|
3
|
+
var a = (c, i, t) => (y(c, typeof i != "symbol" ? i + "" : i, t), t);
|
|
4
|
+
var r = (c, i, t) => new Promise((e, s) => {
|
|
5
|
+
var h = (n) => {
|
|
6
|
+
try {
|
|
7
|
+
o(t.next(n));
|
|
8
|
+
} catch (l) {
|
|
9
|
+
s(l);
|
|
10
|
+
}
|
|
11
|
+
}, p = (n) => {
|
|
12
|
+
try {
|
|
13
|
+
o(t.throw(n));
|
|
14
|
+
} catch (l) {
|
|
15
|
+
s(l);
|
|
16
|
+
}
|
|
17
|
+
}, o = (n) => n.done ? e(n.value) : Promise.resolve(n.value).then(h, p);
|
|
18
|
+
o((t = t.apply(c, i)).next());
|
|
19
|
+
});
|
|
20
|
+
import { parseJWT as d } from "./utils.mjs";
|
|
21
|
+
import v from "./Logger.mjs";
|
|
22
|
+
import { getCVForceService as g } from "./api/index.mjs";
|
|
23
|
+
import { configure as m, configuration as f } from "./Config.mjs";
|
|
24
|
+
import "axios";
|
|
25
|
+
import "../../../node_modules/@glodon-aiot/minio/dist/minio-zj.mjs";
|
|
26
|
+
import "dayjs";
|
|
27
|
+
import "../../apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs";
|
|
28
|
+
import "../../apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs";
|
|
29
|
+
import "../../apis/dist/es/agentcliui/index.mjs";
|
|
30
|
+
import "../../apis/dist/es/aecpilotui/index.mjs";
|
|
31
|
+
import { ApplicationTypes as _ } from "../../apis/dist/es/cvforce/model.mjs";
|
|
32
|
+
import S from "./AgentSession.mjs";
|
|
33
|
+
import w from "./DialogSession.mjs";
|
|
34
|
+
import k from "./EventBus.mjs";
|
|
35
|
+
const A = new v("[BotClient] ");
|
|
36
|
+
class F {
|
|
37
|
+
constructor(i, t, e = !0) {
|
|
38
|
+
a(this, "event", new k());
|
|
39
|
+
a(this, "cvforceApi");
|
|
40
|
+
//从token解析出来的用户信息
|
|
41
|
+
a(this, "_applicationId");
|
|
42
|
+
a(this, "_application", null);
|
|
43
|
+
//session列表,被加载过的session将会被缓存到这个列表中
|
|
44
|
+
a(this, "_sessions", []);
|
|
45
|
+
//活跃的session,只支持一个活跃的session
|
|
46
|
+
a(this, "_activeSession");
|
|
47
|
+
a(this, "_ready", !1);
|
|
48
|
+
//问题长度
|
|
49
|
+
a(this, "_questionContextMaxLength", 4e3);
|
|
50
|
+
a(this, "_promptVariables", []);
|
|
51
|
+
if (this._token = i, this.lazyload = e, m(t), this._applicationId = d(i).rid || f.applicationId, !this._applicationId)
|
|
52
|
+
throw "token is not vaild";
|
|
53
|
+
this.cvforceApi = this.getService(), this.loadApplication().then(() => {
|
|
54
|
+
this.event.emit("ready");
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
checkReady() {
|
|
58
|
+
if (!this.ready)
|
|
59
|
+
throw Error("client is not ready.");
|
|
60
|
+
}
|
|
61
|
+
get ready() {
|
|
62
|
+
return this._ready;
|
|
63
|
+
}
|
|
64
|
+
set ready(i) {
|
|
65
|
+
this._ready = i;
|
|
66
|
+
}
|
|
67
|
+
get questionContextMaxLength() {
|
|
68
|
+
return this.checkReady(), this._questionContextMaxLength;
|
|
69
|
+
}
|
|
70
|
+
get promptVariables() {
|
|
71
|
+
return this.checkReady(), this._promptVariables;
|
|
72
|
+
}
|
|
73
|
+
get knowledges() {
|
|
74
|
+
var i;
|
|
75
|
+
return this.checkReady(), (i = this._application) == null ? void 0 : i.arrange[0].knowledges;
|
|
76
|
+
}
|
|
77
|
+
get sessions() {
|
|
78
|
+
return this.checkReady(), this._sessions;
|
|
79
|
+
}
|
|
80
|
+
set sessions(i) {
|
|
81
|
+
this.checkReady(), this._sessions = i, this.event.emit("sessions:updated", i);
|
|
82
|
+
}
|
|
83
|
+
loadApplication() {
|
|
84
|
+
return r(this, null, function* () {
|
|
85
|
+
var t, e;
|
|
86
|
+
this._application = yield this.cvforceApi.getApplicationId(this._applicationId);
|
|
87
|
+
const i = (e = (t = this._application.arrange) == null ? void 0 : t[0]) == null ? void 0 : e.llmModel;
|
|
88
|
+
return i && (this._questionContextMaxLength = yield this.cvforceApi.getBaseModel(i).then((s) => s.maxModelLength)), this._promptVariables = yield this.cvforceApi.getPrompts(this._applicationId), this._ready = !0, this.event.emit("application:loaded"), this._application;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
getService() {
|
|
92
|
+
return this.cvforceApi ? this.cvforceApi : g(f.apiRoot, this.token, (i, t) => A.error(t));
|
|
93
|
+
}
|
|
94
|
+
get token() {
|
|
95
|
+
return this._token;
|
|
96
|
+
}
|
|
97
|
+
set token(i) {
|
|
98
|
+
this.checkReady(), this._token = i, this.ready = !1;
|
|
99
|
+
const t = d(i).rid;
|
|
100
|
+
this._applicationId !== t && (this._applicationId = t, this._application = null, this.loadApplication().then(() => {
|
|
101
|
+
this.event.emit("ready");
|
|
102
|
+
}), this.clean());
|
|
103
|
+
}
|
|
104
|
+
get applicationId() {
|
|
105
|
+
return this._applicationId;
|
|
106
|
+
}
|
|
107
|
+
get application() {
|
|
108
|
+
return this.checkReady(), this._application;
|
|
109
|
+
}
|
|
110
|
+
get activeSession() {
|
|
111
|
+
var i;
|
|
112
|
+
return this.checkReady(), ((i = this._activeSession) == null ? void 0 : i.id) || "";
|
|
113
|
+
}
|
|
114
|
+
set activeSession(i) {
|
|
115
|
+
this.checkReady(), this.loadSession(i).then((t) => {
|
|
116
|
+
this._activeSession && this._activeSession.id !== i && this._activeSession.inactivate(), this._activeSession = t;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
createSession(i, t, e, s) {
|
|
120
|
+
return r(this, null, function* () {
|
|
121
|
+
return new Promise((h, p) => {
|
|
122
|
+
const o = (n) => r(this, null, function* () {
|
|
123
|
+
if (n === _.Agent)
|
|
124
|
+
h(new S(i, t, e, s));
|
|
125
|
+
else if (n === _.Dialog)
|
|
126
|
+
h(new w(i, t, e, s));
|
|
127
|
+
else
|
|
128
|
+
throw Error(`不支持的应用类型:${n}`);
|
|
129
|
+
});
|
|
130
|
+
if (this.ready) {
|
|
131
|
+
if (!this._application)
|
|
132
|
+
throw Error("client is not ready");
|
|
133
|
+
o(this._application.type);
|
|
134
|
+
} else
|
|
135
|
+
this.event.on("ready", () => {
|
|
136
|
+
if (!this._application)
|
|
137
|
+
throw Error("_application is null");
|
|
138
|
+
o(this._application.type);
|
|
139
|
+
}, !0);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
getSessions(i) {
|
|
144
|
+
return r(this, null, function* () {
|
|
145
|
+
return new Promise((t, e) => {
|
|
146
|
+
const s = () => this.cvforceApi.listSessions(this._applicationId, i).then((h) => {
|
|
147
|
+
const p = [];
|
|
148
|
+
return h.forEach((o) => r(this, null, function* () {
|
|
149
|
+
const n = this._sessions.find((l) => o.id === l.id);
|
|
150
|
+
if (n)
|
|
151
|
+
n.data = o, p.push(n);
|
|
152
|
+
else {
|
|
153
|
+
const l = yield this.createSession(this.token, o.id, o, this.lazyload);
|
|
154
|
+
p.push(l);
|
|
155
|
+
}
|
|
156
|
+
})), this.sessions = p, p;
|
|
157
|
+
});
|
|
158
|
+
if (this.ready) {
|
|
159
|
+
if (!this._application)
|
|
160
|
+
throw Error("_application is null");
|
|
161
|
+
t(s());
|
|
162
|
+
} else
|
|
163
|
+
this.event.on("ready", () => {
|
|
164
|
+
if (!this._application)
|
|
165
|
+
throw Error("_application is null");
|
|
166
|
+
t(s());
|
|
167
|
+
}, !0);
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
loadSession(i = "", t) {
|
|
172
|
+
return r(this, null, function* () {
|
|
173
|
+
this.checkReady();
|
|
174
|
+
let e = this.sessions.find((s) => s.id === i);
|
|
175
|
+
if (e || (e = yield this.createSession(this.token, i, t)), this._activeSession) {
|
|
176
|
+
if (this._activeSession === e)
|
|
177
|
+
return e;
|
|
178
|
+
this._activeSession.inactivate();
|
|
179
|
+
}
|
|
180
|
+
return e.id ? (e.activate(), this._activeSession = e) : e.addEventListener("data:loaded", () => {
|
|
181
|
+
e == null || e.activate(), this._activeSession = e;
|
|
182
|
+
}), e;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
reload() {
|
|
186
|
+
return this.loadApplication().then(() => {
|
|
187
|
+
this.event.emit("ready");
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
reloadSession(i) {
|
|
191
|
+
return r(this, null, function* () {
|
|
192
|
+
yield this.reload();
|
|
193
|
+
let t = i ? this._sessions.find((e) => e.id === i) : this._activeSession;
|
|
194
|
+
if (!t) {
|
|
195
|
+
console.warn("reloadSession session failed.");
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
return yield t.reload(), t;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
setTop(i, t, e = "top_time desc, sort_status desc, updated_at desc") {
|
|
202
|
+
return r(this, null, function* () {
|
|
203
|
+
let s = i ? this._sessions.find((h) => h.id === i) : this._activeSession;
|
|
204
|
+
if (!s) {
|
|
205
|
+
console.warn("setTop session failed.");
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
return yield s.setTop(t), this.getSessions({
|
|
209
|
+
order: e
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
addEventListener(i, t, e = !1) {
|
|
214
|
+
if (typeof t != "function")
|
|
215
|
+
throw Error("event listener is not a function");
|
|
216
|
+
if (e) {
|
|
217
|
+
this.event.once(i, t);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
this.event.on(i, t);
|
|
221
|
+
}
|
|
222
|
+
removeEventListener(i, t) {
|
|
223
|
+
this.event.off(i, t);
|
|
224
|
+
}
|
|
225
|
+
removeSession(i, t) {
|
|
226
|
+
return r(this, null, function* () {
|
|
227
|
+
this.checkReady();
|
|
228
|
+
let e = -1;
|
|
229
|
+
if (typeof i == "string" ? e = this._sessions.findIndex((s) => s.id === i) : e = this._sessions.findIndex((s) => s === i), e > -1) {
|
|
230
|
+
const s = this._sessions[e];
|
|
231
|
+
t && (yield s.delete()), this._sessions.splice(e, 1);
|
|
232
|
+
} else
|
|
233
|
+
console.warn("session delete failed, session is not exist.");
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
clean() {
|
|
237
|
+
this._sessions.forEach((i) => i.destroy()), this.sessions = [];
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
export {
|
|
241
|
+
F as default
|
|
242
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var v = Object.defineProperty, s = Object.defineProperties;
|
|
2
|
+
var u = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var n = Object.getOwnPropertySymbols;
|
|
4
|
+
var p = Object.prototype.hasOwnProperty, h = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var d = (o, t, e) => t in o ? v(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, i = (o, t) => {
|
|
6
|
+
for (var e in t || (t = {}))
|
|
7
|
+
p.call(t, e) && d(o, e, t[e]);
|
|
8
|
+
if (n)
|
|
9
|
+
for (var e of n(t))
|
|
10
|
+
h.call(t, e) && d(o, e, t[e]);
|
|
11
|
+
return o;
|
|
12
|
+
}, g = (o, t) => s(o, u(t));
|
|
13
|
+
import l from "./Logger.mjs";
|
|
14
|
+
const R = new l("[Config] ");
|
|
15
|
+
var f = /* @__PURE__ */ ((o) => (o.dev = "https://aiot-dev.glodon.com/api/cvforcepd", o.test = "https://aiot-dev.glodon.com/api/cvforce", o.prod = "https://copilot.glodon.com/api/cvforce", o.local = "http://localhost:3000/api/cvforcepd", o))(f || {});
|
|
16
|
+
let c = {
|
|
17
|
+
debug: !1,
|
|
18
|
+
env: "prod",
|
|
19
|
+
//AIoT 环境, 与apiRoot配对使用
|
|
20
|
+
apiRoot: "https://copilot.glodon.com/api/cvforce",
|
|
21
|
+
//https://${hostname}/${PRODUCD_CODE}
|
|
22
|
+
applicationId: "",
|
|
23
|
+
plugins: {}
|
|
24
|
+
};
|
|
25
|
+
function x(o) {
|
|
26
|
+
console.log("configure", o), l.debug = (o == null ? void 0 : o.debug) || !1, c = g(i(i({}, c), o), {
|
|
27
|
+
apiRoot: (o == null ? void 0 : o.apiRoot) || c.apiRoot || (o != null && o.env ? f[o.env || "prod"] : c.apiRoot)
|
|
28
|
+
}), R.log("updated", c);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
f as ApiUrl,
|
|
32
|
+
c as configuration,
|
|
33
|
+
x as configure
|
|
34
|
+
};
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
var A = Object.defineProperty, O = Object.defineProperties;
|
|
2
|
+
var $ = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var S = Object.getOwnPropertySymbols;
|
|
4
|
+
var _ = Object.prototype.hasOwnProperty, b = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var M = (o, c, t) => c in o ? A(o, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[c] = t, u = (o, c) => {
|
|
6
|
+
for (var t in c || (c = {}))
|
|
7
|
+
_.call(c, t) && M(o, t, c[t]);
|
|
8
|
+
if (S)
|
|
9
|
+
for (var t of S(c))
|
|
10
|
+
b.call(c, t) && M(o, t, c[t]);
|
|
11
|
+
return o;
|
|
12
|
+
}, p = (o, c) => O(o, $(c));
|
|
13
|
+
var I = (o, c, t) => (M(o, typeof c != "symbol" ? c + "" : c, t), t);
|
|
14
|
+
var y = (o, c, t) => new Promise((i, m) => {
|
|
15
|
+
var h = (e) => {
|
|
16
|
+
try {
|
|
17
|
+
g(t.next(e));
|
|
18
|
+
} catch (l) {
|
|
19
|
+
m(l);
|
|
20
|
+
}
|
|
21
|
+
}, s = (e) => {
|
|
22
|
+
try {
|
|
23
|
+
g(t.throw(e));
|
|
24
|
+
} catch (l) {
|
|
25
|
+
m(l);
|
|
26
|
+
}
|
|
27
|
+
}, g = (e) => e.done ? i(e.value) : Promise.resolve(e.value).then(h, s);
|
|
28
|
+
g((t = t.apply(o, c)).next());
|
|
29
|
+
});
|
|
30
|
+
import "axios";
|
|
31
|
+
import "../../../node_modules/@glodon-aiot/minio/dist/minio-zj.mjs";
|
|
32
|
+
import { IHistoryRole as k } from "../../apis/dist/es/aecpilot/model.mjs";
|
|
33
|
+
import D from "dayjs";
|
|
34
|
+
import "../../apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs";
|
|
35
|
+
import "../../apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs";
|
|
36
|
+
import "../../apis/dist/es/agentcliui/index.mjs";
|
|
37
|
+
import "../../apis/dist/es/aecpilotui/index.mjs";
|
|
38
|
+
import { ChatMessageRole as J } from "../../apis/dist/es/cvforce/model.mjs";
|
|
39
|
+
import N from "./Logger.mjs";
|
|
40
|
+
import P from "./Session.mjs";
|
|
41
|
+
import { fetchEventSource as T } from "./api/fetchEventSource/fetch.mjs";
|
|
42
|
+
import { configuration as v } from "./Config.mjs";
|
|
43
|
+
const C = new N("[DialogClient] ");
|
|
44
|
+
class K extends P {
|
|
45
|
+
constructor(t, i = "", m, h) {
|
|
46
|
+
super(t, i, m, h);
|
|
47
|
+
I(this, "ctrl", new AbortController());
|
|
48
|
+
}
|
|
49
|
+
prepareConnection() {
|
|
50
|
+
return new Promise((t) => y(this, null, function* () {
|
|
51
|
+
this._ready || (this._ready = !0, this.event.emit("ready")), this.frozen = !1, t(!0);
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
postChatV2EventSource(t, i, m, h, s, g) {
|
|
55
|
+
return y(this, null, function* () {
|
|
56
|
+
const e = {
|
|
57
|
+
code: 0,
|
|
58
|
+
// messageId: uuidv4(),
|
|
59
|
+
content: "",
|
|
60
|
+
role: k.Robot,
|
|
61
|
+
sessionId: "",
|
|
62
|
+
reference: [],
|
|
63
|
+
searchReference: [],
|
|
64
|
+
messageTime: "",
|
|
65
|
+
llmModel: "",
|
|
66
|
+
comment: {
|
|
67
|
+
isAgree: 0
|
|
68
|
+
},
|
|
69
|
+
isReplying: !1
|
|
70
|
+
}, l = p(u({}, m), {
|
|
71
|
+
stream: !0
|
|
72
|
+
});
|
|
73
|
+
T(`${v.apiRoot}/chat/v2/chat?applicationId=${t}&sessionId=${i}`, {
|
|
74
|
+
method: "POST",
|
|
75
|
+
headers: {
|
|
76
|
+
Authorization: `Bearer ${this.token}`,
|
|
77
|
+
"Content-Type": "application/json"
|
|
78
|
+
},
|
|
79
|
+
body: JSON.stringify(l),
|
|
80
|
+
openWhenHidden: !0,
|
|
81
|
+
signal: h,
|
|
82
|
+
onopen(a) {
|
|
83
|
+
return a.ok && s != null && s.onopen && s.onopen(), Promise.resolve();
|
|
84
|
+
},
|
|
85
|
+
onmessage(a) {
|
|
86
|
+
if (!a.data.includes('{"code": ')) {
|
|
87
|
+
let n = {};
|
|
88
|
+
try {
|
|
89
|
+
n = JSON.parse(a.data);
|
|
90
|
+
} catch (f) {
|
|
91
|
+
}
|
|
92
|
+
(n == null ? void 0 : n.mtype) === "search" ? e.searchReference.push(n) : e.content = e.content + a.data;
|
|
93
|
+
const d = {
|
|
94
|
+
content: e.content,
|
|
95
|
+
role: 1,
|
|
96
|
+
reference: e.reference,
|
|
97
|
+
searchReference: e.searchReference,
|
|
98
|
+
messageId: e.messageId,
|
|
99
|
+
sessionId: i,
|
|
100
|
+
messageTime: D(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
101
|
+
comment: {
|
|
102
|
+
isAgree: 0
|
|
103
|
+
},
|
|
104
|
+
isReplying: !0
|
|
105
|
+
};
|
|
106
|
+
return (s == null ? void 0 : s.onmessage) && s.onmessage(d);
|
|
107
|
+
}
|
|
108
|
+
const r = JSON.parse(a.data);
|
|
109
|
+
if (e.reference = r.data.reference, e.searchReference = r.data.searchReference, e.messageTime = r.data.messageTime, e.messageId = r.data.messageId, e.llmModel = r.data.llmModel, e.content = r.data.content, e.code = r.code, r.code === 200) {
|
|
110
|
+
const n = {
|
|
111
|
+
code: e.code,
|
|
112
|
+
content: e.content,
|
|
113
|
+
role: 1,
|
|
114
|
+
reference: e.reference,
|
|
115
|
+
searchReference: e.searchReference,
|
|
116
|
+
messageId: e.messageId,
|
|
117
|
+
sessionId: i,
|
|
118
|
+
messageTime: e.messageTime,
|
|
119
|
+
isReplying: !0
|
|
120
|
+
};
|
|
121
|
+
s != null && s.onmessage && s.onmessage(n);
|
|
122
|
+
} else
|
|
123
|
+
return g && g({
|
|
124
|
+
code: r.code,
|
|
125
|
+
message: r.message
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
onerror() {
|
|
129
|
+
s != null && s.onerror && s.onerror();
|
|
130
|
+
},
|
|
131
|
+
onclose() {
|
|
132
|
+
const a = {
|
|
133
|
+
code: e.code,
|
|
134
|
+
content: e.content,
|
|
135
|
+
role: 1,
|
|
136
|
+
reference: e.reference,
|
|
137
|
+
searchReference: e.searchReference,
|
|
138
|
+
messageId: e.messageId,
|
|
139
|
+
sessionId: i,
|
|
140
|
+
messageTime: e.messageTime,
|
|
141
|
+
comment: {
|
|
142
|
+
isAgree: 0
|
|
143
|
+
},
|
|
144
|
+
isReplying: !1,
|
|
145
|
+
index: -1
|
|
146
|
+
};
|
|
147
|
+
s != null && s.onclose && s.onclose(a);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
postChatV3EventSource(t, i, m, h, s, g) {
|
|
153
|
+
return y(this, null, function* () {
|
|
154
|
+
const e = {
|
|
155
|
+
code: 0,
|
|
156
|
+
// messageId: uuidv4(),
|
|
157
|
+
content: "",
|
|
158
|
+
role: k.Robot,
|
|
159
|
+
sessionId: "",
|
|
160
|
+
reference: [],
|
|
161
|
+
searchReference: [],
|
|
162
|
+
messageTime: "",
|
|
163
|
+
llmModel: "",
|
|
164
|
+
comment: {
|
|
165
|
+
isAgree: 0
|
|
166
|
+
},
|
|
167
|
+
isReplying: !1,
|
|
168
|
+
reasoningContent: "",
|
|
169
|
+
thinkingSecs: "",
|
|
170
|
+
thinkingStatus: ""
|
|
171
|
+
}, l = p(u({}, m), {
|
|
172
|
+
stream: !0
|
|
173
|
+
});
|
|
174
|
+
T(`${v.apiRoot}/chat/v3/chat?applicationId=${t}&sessionId=${i}`, {
|
|
175
|
+
method: "POST",
|
|
176
|
+
headers: {
|
|
177
|
+
Authorization: `Bearer ${this.token}`,
|
|
178
|
+
"Content-Type": "application/json"
|
|
179
|
+
},
|
|
180
|
+
body: JSON.stringify(l),
|
|
181
|
+
openWhenHidden: !0,
|
|
182
|
+
signal: h,
|
|
183
|
+
onopen(a) {
|
|
184
|
+
return a.ok && s != null && s.onopen && s.onopen(), Promise.resolve();
|
|
185
|
+
},
|
|
186
|
+
onmessage(a) {
|
|
187
|
+
if (!a.data && !a.event && !a.id && !a.retry)
|
|
188
|
+
return;
|
|
189
|
+
let r = {};
|
|
190
|
+
try {
|
|
191
|
+
r = JSON.parse(a.data);
|
|
192
|
+
} catch (f) {
|
|
193
|
+
console.error("parse eventData to JSON failed. ", a.data);
|
|
194
|
+
}
|
|
195
|
+
if (r.code !== 200)
|
|
196
|
+
return g && g({
|
|
197
|
+
code: r.code,
|
|
198
|
+
message: r.message
|
|
199
|
+
});
|
|
200
|
+
const n = r.data.type, d = r.data.payload;
|
|
201
|
+
if (e.isReplying = !0, n === "search" && e.searchReference.push(d), n === "thinking") {
|
|
202
|
+
e.thinkingStatus = "start";
|
|
203
|
+
const R = d.choices[0];
|
|
204
|
+
e.reasoningContent = e.reasoningContent + R.delta.reasoningContent;
|
|
205
|
+
}
|
|
206
|
+
if (n === "thinkingOver") {
|
|
207
|
+
e.thinkingStatus = "end";
|
|
208
|
+
const f = d.thinkingSecs;
|
|
209
|
+
e.thinkingSecs = f;
|
|
210
|
+
}
|
|
211
|
+
if (n === "text") {
|
|
212
|
+
const R = d.choices[0];
|
|
213
|
+
e.content = e.content + R.delta.content;
|
|
214
|
+
}
|
|
215
|
+
if (n === "reference" && (e.reference = d), n === "result") {
|
|
216
|
+
const f = d.messageId, R = d.llmModel, w = d.messageTime;
|
|
217
|
+
e.messageId = f, e.llmModel = R, e.messageTime = w, e.sessionId = i;
|
|
218
|
+
}
|
|
219
|
+
n === "over" ? e.index = -1 : (e.code = r.code, e.message = r.message), s != null && s.onmessage && s.onmessage(e);
|
|
220
|
+
},
|
|
221
|
+
onerror() {
|
|
222
|
+
s != null && s.onerror && s.onerror();
|
|
223
|
+
},
|
|
224
|
+
onclose() {
|
|
225
|
+
const a = p(u({}, e), {
|
|
226
|
+
isReplying: !1
|
|
227
|
+
});
|
|
228
|
+
s != null && s.onclose && s.onclose(a);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
sendQuestion(t, i) {
|
|
234
|
+
return y(this, null, function* () {
|
|
235
|
+
var l;
|
|
236
|
+
const {
|
|
237
|
+
content: m,
|
|
238
|
+
fileIds: h,
|
|
239
|
+
oldMessageId: s
|
|
240
|
+
} = t, {
|
|
241
|
+
stream: g,
|
|
242
|
+
referenceFirst: e
|
|
243
|
+
} = i;
|
|
244
|
+
if (this.active || (yield this.activate()), this._id) {
|
|
245
|
+
let a = {
|
|
246
|
+
content: m,
|
|
247
|
+
fileIds: h,
|
|
248
|
+
referenceFirst: e,
|
|
249
|
+
oldMessageId: s,
|
|
250
|
+
promptVariables: this.promptVariables.reduce((r, n) => p(u({}, r), {
|
|
251
|
+
[n.key]: n.value
|
|
252
|
+
}), {}),
|
|
253
|
+
knowledges: (l = this.knowledges) == null ? void 0 : l.map((r) => r.id)
|
|
254
|
+
};
|
|
255
|
+
this.postChatV3EventSource(this._applicationId, this._id, a, this.ctrl.signal, {
|
|
256
|
+
onopen: () => {
|
|
257
|
+
C.log("open", this.ctrl);
|
|
258
|
+
},
|
|
259
|
+
onmessage: (r) => {
|
|
260
|
+
if (this._stopAnswer)
|
|
261
|
+
return;
|
|
262
|
+
let n = this.messages[this.messages.length - 1];
|
|
263
|
+
n && n.role === J.Robot ? (n = u(u({}, n), r), this.messages[this.messages.length - 1] = n, this.event.emit("message:content", n), this.event.emit("message:updated", n)) : (this.pushMessage(r), this.event.emit("message:content", r));
|
|
264
|
+
},
|
|
265
|
+
onclose: (r) => y(this, null, function* () {
|
|
266
|
+
this._stopAnswer || (C.log(r, "onclose"), this.event.emit("answer:finish", r), console.log("onclose", r));
|
|
267
|
+
}),
|
|
268
|
+
onerror: () => {
|
|
269
|
+
this._stopAnswer || (this.event.emit("message:error", ""), this.frozen = !1);
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
stopAnswer() {
|
|
276
|
+
this.ctrl.abort();
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
export {
|
|
280
|
+
K as default
|
|
281
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var v = Object.getOwnPropertySymbols;
|
|
3
|
+
var o = Object.prototype.hasOwnProperty, L = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var l = (s, e, n) => e in s ? u(s, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : s[e] = n, a = (s, e) => {
|
|
5
|
+
for (var n in e || (e = {}))
|
|
6
|
+
o.call(e, n) && l(s, n, e[n]);
|
|
7
|
+
if (v)
|
|
8
|
+
for (var n of v(e))
|
|
9
|
+
L.call(e, n) && l(s, n, e[n]);
|
|
10
|
+
return s;
|
|
11
|
+
};
|
|
12
|
+
var h = (s, e, n) => (l(s, typeof e != "symbol" ? e + "" : e, n), n);
|
|
13
|
+
import M from "./Logger.mjs";
|
|
14
|
+
const i = new M("[EventBus] ");
|
|
15
|
+
class $ {
|
|
16
|
+
constructor(e = !1) {
|
|
17
|
+
h(this, "eventListenerMap", {});
|
|
18
|
+
e && i.disable();
|
|
19
|
+
}
|
|
20
|
+
getEventListenerMap() {
|
|
21
|
+
return a({}, this.eventListenerMap);
|
|
22
|
+
}
|
|
23
|
+
on(e, n, r = !1) {
|
|
24
|
+
this.eventListenerMap[e] || (this.eventListenerMap[e] = []), r ? this.eventListenerMap[e].push({
|
|
25
|
+
fn: n,
|
|
26
|
+
once: !0
|
|
27
|
+
}) : this.eventListenerMap[e].push(n), i.log(`add event ${e} listener ${r ? ", call once" : ""}`);
|
|
28
|
+
}
|
|
29
|
+
once(e, n) {
|
|
30
|
+
this.on(e, n, !0);
|
|
31
|
+
}
|
|
32
|
+
off(e, n) {
|
|
33
|
+
if (this.eventListenerMap[e]) {
|
|
34
|
+
const r = this.eventListenerMap[e].findIndex((t) => {
|
|
35
|
+
if (typeof t == "function" && n === t)
|
|
36
|
+
return !0;
|
|
37
|
+
if (t = t, t.fn === n)
|
|
38
|
+
return !0;
|
|
39
|
+
});
|
|
40
|
+
r < 0 ? i.log(`event ${e} listener ${n.name} is not found`) : (this.eventListenerMap[e].splice(r, 1), i.log(`remove event ${e} listener`));
|
|
41
|
+
} else
|
|
42
|
+
i.log(`event ${e} listeners is empty`);
|
|
43
|
+
}
|
|
44
|
+
emit(e, n) {
|
|
45
|
+
if (!this.eventListenerMap[e]) {
|
|
46
|
+
i.log(`event ${e} listeners is empty`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const r = [];
|
|
50
|
+
for (let t = 0; t < this.eventListenerMap[e].length; t++) {
|
|
51
|
+
const f = this.eventListenerMap[e][t];
|
|
52
|
+
typeof f == "function" ? f(n) : r.push(f);
|
|
53
|
+
}
|
|
54
|
+
r.forEach((t) => {
|
|
55
|
+
t && (t.fn(n), this.off(e, t.fn));
|
|
56
|
+
}), i.log(`event ${e} is fired, has ${this.eventListenerMap[e].length} listeners`);
|
|
57
|
+
}
|
|
58
|
+
removeAllListeners() {
|
|
59
|
+
this.eventListenerMap = {};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
$ as default
|
|
64
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var n = Object.defineProperty;
|
|
2
|
+
var f = (s, e, i) => e in s ? n(s, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[e] = i;
|
|
3
|
+
var r = (s, e, i) => (f(s, typeof e != "symbol" ? e + "" : e, i), i);
|
|
4
|
+
const o = class o {
|
|
5
|
+
constructor(e, i = !1) {
|
|
6
|
+
this.prefix = e, this.open = i;
|
|
7
|
+
}
|
|
8
|
+
disable() {
|
|
9
|
+
this.open = !1;
|
|
10
|
+
}
|
|
11
|
+
enable() {
|
|
12
|
+
this.open = !0;
|
|
13
|
+
}
|
|
14
|
+
log(...e) {
|
|
15
|
+
!this.open && !o.debug || console.log(this.prefix, ...e);
|
|
16
|
+
}
|
|
17
|
+
info(...e) {
|
|
18
|
+
!this.open && !o.debug || console.info(`%c ${this.prefix} %o`, "color:#0f0;", ...e);
|
|
19
|
+
}
|
|
20
|
+
error(...e) {
|
|
21
|
+
!this.open && !o.debug || console.error(this.prefix, ...e);
|
|
22
|
+
}
|
|
23
|
+
warn(...e) {
|
|
24
|
+
!this.open && !o.debug || console.warn(this.prefix, ...e);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
r(o, "debug", !1);
|
|
28
|
+
let t = o;
|
|
29
|
+
export {
|
|
30
|
+
t as default
|
|
31
|
+
};
|