@aakash58/chatbot 1.1.21 → 1.1.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/README.md +22 -298
- package/esm2022/aakash58-chatbot.mjs +5 -0
- package/esm2022/lib/app/chat/chat-ui-state.service.mjs +170 -0
- package/esm2022/lib/app/chat/chat.service.mjs +445 -0
- package/esm2022/lib/app/chat/components/chat-button/chat-button.component.mjs +50 -0
- package/esm2022/lib/app/chat/components/chat-footer/chat-footer.component.mjs +12 -0
- package/esm2022/lib/app/chat/components/chat-header/chat-header.component.mjs +66 -0
- package/esm2022/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.mjs +186 -0
- package/esm2022/lib/app/chat/components/chat-window/chat-window.component.mjs +312 -0
- package/esm2022/lib/app/chat/components/message-input/message-input.component.mjs +36 -0
- package/esm2022/lib/app/chat/components/message-list/message-list.component.mjs +115 -0
- package/esm2022/lib/app/chat/model/chat-history.model.mjs +2 -0
- package/esm2022/lib/app/chat/model/chat-request.model.mjs +2 -0
- package/esm2022/lib/app/chat/model/chat-response.model.mjs +2 -0
- package/esm2022/lib/app/chat/model/chat-session.model.mjs +2 -0
- package/esm2022/lib/app/chat/model/chat-stream-message.model.mjs +2 -0
- package/esm2022/lib/app/chat/model/chat-stream-response.model.mjs +2 -0
- package/esm2022/lib/app/chat/services/chat-api.service.mjs +61 -0
- package/esm2022/lib/app/chat/services/chat-audio.service.mjs +50 -0
- package/esm2022/lib/app/chat/services/chat-history.service.mjs +252 -0
- package/esm2022/lib/app/login/login-form.component.mjs +46 -0
- package/esm2022/lib/app/personalization/personalization-dialog.component.mjs +194 -0
- package/esm2022/lib/app/personalization/personalization.service.mjs +149 -0
- package/esm2022/lib/app/personalization/sections/account/account-section.component.mjs +122 -0
- package/esm2022/lib/app/personalization/sections/preferences/color-picker-dialog.component.mjs +86 -0
- package/esm2022/lib/app/personalization/sections/preferences/preferences-section.component.mjs +115 -0
- package/esm2022/lib/app/personalization/sections/profile/profile-section.component.mjs +29 -0
- package/esm2022/lib/app/personalization/sections/settings/setting-section.component.mjs +30 -0
- package/esm2022/lib/app/personalization/sections/terms/terms-section.component.mjs +12 -0
- package/esm2022/lib/constant/doohbot-constant.mjs +28 -0
- package/esm2022/lib/constant/html-entities.mjs +9 -0
- package/esm2022/lib/constant/utf8.mjs +10 -0
- package/esm2022/lib/core/app-const.mjs +61 -0
- package/esm2022/lib/core/auth/account-api.service.mjs +40 -0
- package/esm2022/lib/core/auth/auth.service.mjs +391 -0
- package/esm2022/lib/core/auth/models/auth-result.model.mjs +3 -0
- package/esm2022/lib/core/auth/models/federated-login-request.model.mjs +6 -0
- package/esm2022/lib/core/auth/models/login-request.model.mjs +6 -0
- package/esm2022/lib/core/auth/storage.service.mjs +110 -0
- package/esm2022/lib/core/directives/draggable/draggable-dialog.directive.mjs +112 -0
- package/esm2022/lib/core/directives/fullscreen/fullscreen.directive.mjs +55 -0
- package/esm2022/lib/core/directives/resizable/resizable-dialog.directive.mjs +179 -0
- package/esm2022/lib/core/environments/environment.mjs +15 -0
- package/esm2022/lib/core/environments/environment.prod.mjs +15 -0
- package/esm2022/lib/core/helpers/crypto-helper.service.mjs +52 -0
- package/esm2022/lib/core/http/http-stream.service.mjs +97 -0
- package/esm2022/lib/core/http/http.service.mjs +103 -0
- package/esm2022/lib/core/interceptors/auth.interceptor.mjs +96 -0
- package/esm2022/lib/core/interceptors/license.interceptor.mjs +44 -0
- package/esm2022/lib/core/models/api-config.model.mjs +18 -0
- package/esm2022/lib/core/models/api-request.model.mjs +2 -0
- package/esm2022/lib/core/models/api-response.model.mjs +8 -0
- package/esm2022/lib/core/models/doohbot-config.model.mjs +18 -0
- package/esm2022/lib/core/models/license.model.mjs +2 -0
- package/esm2022/lib/core/models/message.mjs +2 -0
- package/esm2022/lib/core/models/theme-config.model.mjs +2 -0
- package/esm2022/lib/core/services/core-config.service.mjs +52 -0
- package/esm2022/lib/core/services/license.service.mjs +145 -0
- package/esm2022/lib/core/services/markdown.service.mjs +64 -0
- package/esm2022/lib/core/services/theme.service.mjs +248 -0
- package/esm2022/lib/core/types/auth-mode.type.mjs +2 -0
- package/esm2022/lib/core/types/auth-status.type.mjs +5 -0
- package/esm2022/lib/core/types/chat-stream.type.mjs +2 -0
- package/esm2022/lib/core/types/message-role.type.mjs +2 -0
- package/esm2022/lib/core/types/prompt-mode.type.mjs +5 -0
- package/esm2022/lib/core/types/snackbar-error.type.mjs +5 -0
- package/esm2022/lib/core/types/tenant-resolution-strategy.type.mjs +2 -0
- package/esm2022/lib/core/utils/logger.service.mjs +42 -0
- package/esm2022/lib/doohbot-input.mjs +20 -0
- package/esm2022/lib/doohbot.component.mjs +444 -0
- package/esm2022/lib/predefined_messages.mjs +15 -0
- package/esm2022/lib/shared/chips/chips.component.mjs +28 -0
- package/esm2022/lib/shared/dialog/dialog.component.mjs +36 -0
- package/esm2022/lib/shared/dialog/dialog.service.mjs +64 -0
- package/esm2022/lib/shared/dialog/dialog.utils.mjs +85 -0
- package/esm2022/lib/shared/dropdown-menu/dropdown-menu.component.mjs +29 -0
- package/esm2022/lib/shared/input-dialog/input-dialog.component.mjs +38 -0
- package/esm2022/lib/shared/menu-item/menu-item.component.mjs +24 -0
- package/esm2022/lib/shared/pipes/simple-markdown.pipe.mjs +27 -0
- package/esm2022/lib/shared/snackbar/snackbar.component.mjs +43 -0
- package/esm2022/lib/shared/snackbar/snackbar.service.mjs +46 -0
- package/esm2022/lib/shared/snackbar/snackbar.utils.mjs +43 -0
- package/esm2022/public-api.mjs +37 -0
- package/fesm2022/aakash58-chatbot.mjs +5193 -0
- package/fesm2022/aakash58-chatbot.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/app/chat/chat-ui-state.service.d.ts +96 -0
- package/lib/app/chat/chat.service.d.ts +88 -0
- package/lib/app/chat/components/chat-button/chat-button.component.d.ts +16 -0
- package/lib/app/chat/components/chat-footer/chat-footer.component.d.ts +5 -0
- package/lib/app/chat/components/chat-header/chat-header.component.d.ts +24 -0
- package/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.d.ts +49 -0
- package/lib/app/chat/components/chat-window/chat-window.component.d.ts +107 -0
- package/lib/app/chat/components/message-input/message-input.component.d.ts +12 -0
- package/lib/app/chat/components/message-list/message-list.component.d.ts +40 -0
- package/lib/app/chat/model/chat-history.model.d.ts +51 -0
- package/lib/app/chat/model/chat-request.model.d.ts +10 -0
- package/lib/app/chat/model/chat-response.model.d.ts +9 -0
- package/lib/app/chat/model/chat-session.model.d.ts +12 -0
- package/{projects/doohbot/src/lib/app/chat/model/chat-stream-message.model.ts → lib/app/chat/model/chat-stream-message.model.d.ts} +5 -6
- package/lib/app/chat/model/chat-stream-response.model.d.ts +10 -0
- package/lib/app/chat/services/chat-api.service.d.ts +30 -0
- package/lib/app/chat/services/chat-audio.service.d.ts +19 -0
- package/lib/app/chat/services/chat-history.service.d.ts +53 -0
- package/lib/app/login/login-form.component.d.ts +20 -0
- package/lib/app/personalization/personalization-dialog.component.d.ts +53 -0
- package/lib/app/personalization/personalization.service.d.ts +66 -0
- package/lib/app/personalization/sections/account/account-section.component.d.ts +30 -0
- package/lib/app/personalization/sections/preferences/color-picker-dialog.component.d.ts +17 -0
- package/lib/app/personalization/sections/preferences/preferences-section.component.d.ts +27 -0
- package/lib/app/personalization/sections/profile/profile-section.component.d.ts +17 -0
- package/lib/app/personalization/sections/settings/setting-section.component.d.ts +10 -0
- package/lib/app/personalization/sections/terms/terms-section.component.d.ts +5 -0
- package/lib/constant/doohbot-constant.d.ts +12 -0
- package/lib/constant/html-entities.d.ts +8 -0
- package/lib/constant/utf8.d.ts +9 -0
- package/lib/core/app-const.d.ts +11 -0
- package/lib/core/auth/account-api.service.d.ts +20 -0
- package/lib/core/auth/auth.service.d.ts +90 -0
- package/lib/core/auth/models/auth-result.model.d.ts +4 -0
- package/lib/core/auth/models/federated-login-request.model.d.ts +5 -0
- package/lib/core/auth/models/login-request.model.d.ts +6 -0
- package/lib/core/auth/storage.service.d.ts +21 -0
- package/lib/core/directives/draggable/draggable-dialog.directive.d.ts +23 -0
- package/lib/core/directives/fullscreen/fullscreen.directive.d.ts +14 -0
- package/lib/core/directives/resizable/resizable-dialog.directive.d.ts +30 -0
- package/lib/core/environments/environment.d.ts +7 -0
- package/lib/core/environments/environment.prod.d.ts +7 -0
- package/lib/core/helpers/crypto-helper.service.d.ts +12 -0
- package/lib/core/http/http-stream.service.d.ts +18 -0
- package/lib/core/http/http.service.d.ts +20 -0
- package/lib/core/interceptors/auth.interceptor.d.ts +18 -0
- package/lib/core/interceptors/license.interceptor.d.ts +11 -0
- package/lib/core/models/api-config.model.d.ts +58 -0
- package/lib/core/models/api-request.model.d.ts +77 -0
- package/lib/core/models/api-response.model.d.ts +6 -0
- package/lib/core/models/doohbot-config.model.d.ts +81 -0
- package/{projects/doohbot/src/lib/core/models/license.model.ts → lib/core/models/license.model.d.ts} +23 -27
- package/lib/core/models/message.d.ts +16 -0
- package/lib/core/models/theme-config.model.d.ts +28 -0
- package/lib/core/services/core-config.service.d.ts +23 -0
- package/lib/core/services/license.service.d.ts +33 -0
- package/lib/core/services/markdown.service.d.ts +8 -0
- package/lib/core/services/theme.service.d.ts +40 -0
- package/{projects/doohbot/src/lib/core/types/auth-mode.type.ts → lib/core/types/auth-mode.type.d.ts} +4 -4
- package/{projects/doohbot/src/lib/core/types/auth-status.type.ts → lib/core/types/auth-status.type.d.ts} +4 -5
- package/{projects/doohbot/src/lib/core/types/chat-stream.type.ts → lib/core/types/chat-stream.type.d.ts} +4 -4
- package/{projects/doohbot/src/lib/core/types/message-role.type.ts → lib/core/types/message-role.type.d.ts} +4 -4
- package/{projects/doohbot/src/lib/core/types/prompt-mode.type.ts → lib/core/types/prompt-mode.type.d.ts} +4 -5
- package/{projects/doohbot/src/lib/core/types/snackbar-error.type.ts → lib/core/types/snackbar-error.type.d.ts} +4 -5
- package/{projects/doohbot/src/lib/core/types/tenant-resolution-strategy.type.ts → lib/core/types/tenant-resolution-strategy.type.d.ts} +4 -4
- package/lib/core/utils/logger.service.d.ts +11 -0
- package/lib/doohbot-input.d.ts +19 -0
- package/lib/doohbot.component.d.ts +108 -0
- package/lib/predefined_messages.d.ts +2 -0
- package/lib/shared/chips/chips.component.d.ts +10 -0
- package/lib/shared/dialog/dialog.component.d.ts +19 -0
- package/lib/shared/dialog/dialog.service.d.ts +29 -0
- package/lib/shared/dialog/dialog.utils.d.ts +41 -0
- package/lib/shared/dropdown-menu/dropdown-menu.component.d.ts +11 -0
- package/lib/shared/input-dialog/input-dialog.component.d.ts +20 -0
- package/lib/shared/menu-item/menu-item.component.d.ts +9 -0
- package/lib/shared/pipes/simple-markdown.pipe.d.ts +10 -0
- package/lib/shared/snackbar/snackbar.component.d.ts +14 -0
- package/lib/shared/snackbar/snackbar.service.d.ts +19 -0
- package/{projects/doohbot/src/lib/shared/snackbar/snackbar.utils.ts → lib/shared/snackbar/snackbar.utils.d.ts} +33 -49
- package/package.json +29 -75
- package/public-api.d.ts +11 -0
- package/.editorconfig +0 -17
- package/.vscode/extensions.json +0 -4
- package/.vscode/launch.json +0 -41
- package/.vscode/settings.json +0 -14
- package/.vscode/tasks.json +0 -60
- package/angular.json +0 -132
- package/docs/PUBLISHING_GUIDE.md +0 -104
- package/projects/app-doohbot/public/assets/const/app-const.json +0 -15
- package/projects/app-doohbot/public/assets/const/doohclick_license.json +0 -6
- package/projects/app-doohbot/public/favicon.ico +0 -0
- package/projects/app-doohbot/src/app/app.config.ts +0 -13
- package/projects/app-doohbot/src/app/app.html +0 -31
- package/projects/app-doohbot/src/app/app.routes.ts +0 -3
- package/projects/app-doohbot/src/app/app.scss +0 -279
- package/projects/app-doohbot/src/app/app.spec.ts +0 -23
- package/projects/app-doohbot/src/app/app.ts +0 -72
- package/projects/app-doohbot/src/index.html +0 -15
- package/projects/app-doohbot/src/main.ts +0 -6
- package/projects/app-doohbot/src/styles.scss +0 -15
- package/projects/app-doohbot/tsconfig.app.json +0 -15
- package/projects/app-doohbot/tsconfig.spec.json +0 -14
- package/projects/doohbot/README.md +0 -64
- package/projects/doohbot/docs/README.md +0 -140
- package/projects/doohbot/ng-package.json +0 -10
- package/projects/doohbot/package.json +0 -16
- package/projects/doohbot/src/lib/app/chat/chat-ui-state.service.ts +0 -194
- package/projects/doohbot/src/lib/app/chat/chat.service.ts +0 -547
- package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.html +0 -27
- package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.scss +0 -115
- package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.ts +0 -35
- package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.html +0 -3
- package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.scss +0 -20
- package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.ts +0 -12
- package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.html +0 -34
- package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.scss +0 -78
- package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.ts +0 -52
- package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.html +0 -77
- package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.scss +0 -346
- package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.ts +0 -188
- package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.html +0 -146
- package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.scss +0 -187
- package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.ts +0 -256
- package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.html +0 -17
- package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.scss +0 -59
- package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.ts +0 -28
- package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.html +0 -138
- package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.scss +0 -436
- package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.ts +0 -106
- package/projects/doohbot/src/lib/app/chat/model/chat-history.model.ts +0 -57
- package/projects/doohbot/src/lib/app/chat/model/chat-request.model.ts +0 -17
- package/projects/doohbot/src/lib/app/chat/model/chat-response.model.ts +0 -9
- package/projects/doohbot/src/lib/app/chat/model/chat-session.model.ts +0 -14
- package/projects/doohbot/src/lib/app/chat/model/chat-stream-response.model.ts +0 -12
- package/projects/doohbot/src/lib/app/chat/services/chat-api.service.ts +0 -82
- package/projects/doohbot/src/lib/app/chat/services/chat-audio.service.ts +0 -44
- package/projects/doohbot/src/lib/app/chat/services/chat-history.service.ts +0 -303
- package/projects/doohbot/src/lib/app/login/login-form.component.html +0 -80
- package/projects/doohbot/src/lib/app/login/login-form.component.scss +0 -189
- package/projects/doohbot/src/lib/app/login/login-form.component.ts +0 -45
- package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.html +0 -81
- package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.scss +0 -179
- package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.ts +0 -217
- package/projects/doohbot/src/lib/app/personalization/personalization.service.ts +0 -197
- package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.html +0 -111
- package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.scss +0 -218
- package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.ts +0 -121
- package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.html +0 -46
- package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.scss +0 -138
- package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.ts +0 -28
- package/projects/doohbot/src/lib/app/personalization/sections/preferences/color-picker-dialog.component.ts +0 -92
- package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.html +0 -198
- package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.scss +0 -107
- package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.ts +0 -103
- package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.html +0 -46
- package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.scss +0 -131
- package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.ts +0 -23
- package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.html +0 -33
- package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.scss +0 -61
- package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.ts +0 -20
- package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.html +0 -30
- package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.scss +0 -59
- package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.ts +0 -12
- package/projects/doohbot/src/lib/constant/doohbot-constant.ts +0 -40
- package/projects/doohbot/src/lib/constant/html-entities.ts +0 -8
- package/projects/doohbot/src/lib/constant/utf8.ts +0 -9
- package/projects/doohbot/src/lib/core/app-const.ts +0 -63
- package/projects/doohbot/src/lib/core/auth/account-api.service.ts +0 -53
- package/projects/doohbot/src/lib/core/auth/auth.service.ts +0 -478
- package/projects/doohbot/src/lib/core/auth/models/auth-result.model.ts +0 -4
- package/projects/doohbot/src/lib/core/auth/models/federated-login-request.model.ts +0 -5
- package/projects/doohbot/src/lib/core/auth/models/login-request.model.ts +0 -6
- package/projects/doohbot/src/lib/core/auth/storage.service.ts +0 -113
- package/projects/doohbot/src/lib/core/directives/draggable/draggable-dialog.directive.ts +0 -123
- package/projects/doohbot/src/lib/core/directives/draggable/draggable-dialog.module.ts +0 -9
- package/projects/doohbot/src/lib/core/directives/fullscreen/fullscreen.directive.ts +0 -58
- package/projects/doohbot/src/lib/core/directives/fullscreen/fullscreen.module.ts +0 -9
- package/projects/doohbot/src/lib/core/directives/popout/popout.directive.ts +0 -169
- package/projects/doohbot/src/lib/core/directives/popout/popout.module.ts +0 -9
- package/projects/doohbot/src/lib/core/directives/resizable/resizable-dialog.directive.ts +0 -197
- package/projects/doohbot/src/lib/core/directives/resizable/resizable-dialog.module.ts +0 -9
- package/projects/doohbot/src/lib/core/enums/api-request-state.enum.ts +0 -9
- package/projects/doohbot/src/lib/core/environments/environment.prod.ts +0 -14
- package/projects/doohbot/src/lib/core/environments/environment.ts +0 -14
- package/projects/doohbot/src/lib/core/helpers/crypto-helper.service.ts +0 -72
- package/projects/doohbot/src/lib/core/http/http-stream.service.ts +0 -105
- package/projects/doohbot/src/lib/core/http/http.service.ts +0 -148
- package/projects/doohbot/src/lib/core/interceptors/auth.interceptor.ts +0 -118
- package/projects/doohbot/src/lib/core/interceptors/license.interceptor.ts +0 -50
- package/projects/doohbot/src/lib/core/models/api-config.model.ts +0 -82
- package/projects/doohbot/src/lib/core/models/api-request.model.ts +0 -92
- package/projects/doohbot/src/lib/core/models/api-response.model.ts +0 -13
- package/projects/doohbot/src/lib/core/models/doohbot-config.model.ts +0 -109
- package/projects/doohbot/src/lib/core/models/message.ts +0 -18
- package/projects/doohbot/src/lib/core/models/theme-config.model.ts +0 -48
- package/projects/doohbot/src/lib/core/services/core-config.service.ts +0 -53
- package/projects/doohbot/src/lib/core/services/doohbot-api.service.ts +0 -207
- package/projects/doohbot/src/lib/core/services/license.service.ts +0 -171
- package/projects/doohbot/src/lib/core/services/markdown.service.ts +0 -73
- package/projects/doohbot/src/lib/core/services/theme.service.ts +0 -305
- package/projects/doohbot/src/lib/core/utils/error-handler.util.ts +0 -31
- package/projects/doohbot/src/lib/core/utils/logger.service.ts +0 -45
- package/projects/doohbot/src/lib/doohbot-input.ts +0 -19
- package/projects/doohbot/src/lib/doohbot.component.html +0 -34
- package/projects/doohbot/src/lib/doohbot.component.scss +0 -17
- package/projects/doohbot/src/lib/doohbot.component.spec.ts +0 -31
- package/projects/doohbot/src/lib/doohbot.component.ts +0 -545
- package/projects/doohbot/src/lib/elements.ts +0 -25
- package/projects/doohbot/src/lib/predefined_messages.ts +0 -14
- package/projects/doohbot/src/lib/shared/chips/chips.component.html +0 -9
- package/projects/doohbot/src/lib/shared/chips/chips.component.scss +0 -29
- package/projects/doohbot/src/lib/shared/chips/chips.component.spec.ts +0 -22
- package/projects/doohbot/src/lib/shared/chips/chips.component.ts +0 -20
- package/projects/doohbot/src/lib/shared/dialog/dialog.component.html +0 -29
- package/projects/doohbot/src/lib/shared/dialog/dialog.component.scss +0 -100
- package/projects/doohbot/src/lib/shared/dialog/dialog.component.ts +0 -42
- package/projects/doohbot/src/lib/shared/dialog/dialog.service.ts +0 -62
- package/projects/doohbot/src/lib/shared/dialog/dialog.utils.ts +0 -102
- package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.html +0 -30
- package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.scss +0 -53
- package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.spec.ts +0 -22
- package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.ts +0 -35
- package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.html +0 -16
- package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.scss +0 -45
- package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.ts +0 -46
- package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.html +0 -5
- package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.scss +0 -0
- package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.spec.ts +0 -22
- package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.ts +0 -20
- package/projects/doohbot/src/lib/shared/pipes/simple-markdown.pipe.ts +0 -19
- package/projects/doohbot/src/lib/shared/popout/popout.html +0 -1
- package/projects/doohbot/src/lib/shared/popout/popout.scss +0 -0
- package/projects/doohbot/src/lib/shared/popout/popout.spec.ts +0 -23
- package/projects/doohbot/src/lib/shared/popout/popout.ts +0 -11
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.html +0 -7
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.scss +0 -125
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.spec.ts +0 -21
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.ts +0 -44
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.service.ts +0 -54
- package/projects/doohbot/src/lib/styles/_theme.scss +0 -132
- package/projects/doohbot/src/lib/styles/material-override.scss +0 -302
- package/projects/doohbot/src/lib/styles/utility.scss +0 -588
- package/projects/doohbot/src/public-api.ts +0 -42
- package/projects/doohbot/tsconfig.lib.json +0 -15
- package/projects/doohbot/tsconfig.lib.prod.json +0 -11
- package/projects/doohbot/tsconfig.spec.json +0 -10
- package/proxy.conf.json +0 -8
- package/publish.config.js +0 -25
- package/scripts/publishing/index.ts +0 -67
- package/scripts/publishing/pipeline/01-clean.ts +0 -11
- package/scripts/publishing/pipeline/02-validate-pre.ts +0 -8
- package/scripts/publishing/pipeline/03-build.ts +0 -7
- package/scripts/publishing/pipeline/04-validate-post.ts +0 -8
- package/scripts/publishing/pipeline/05-prepare-package.ts +0 -29
- package/scripts/publishing/pipeline/06-version.ts +0 -23
- package/scripts/publishing/pipeline/07-publish.ts +0 -14
- package/scripts/publishing/pipeline/08-cleanup.ts +0 -5
- package/scripts/publishing/types.ts +0 -36
- package/scripts/publishing/utils/command.ts +0 -15
- package/scripts/publishing/utils/config.ts +0 -17
- package/scripts/validate.ts +0 -166
- package/tsconfig.json +0 -45
- package/tsconfig.scripts.json +0 -15
- /package/{projects/doohbot/src → src}/assets/bot.mp3 +0 -0
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Injectable({
|
|
4
|
-
providedIn: 'root',
|
|
5
|
-
})
|
|
6
|
-
export class CryptoHelperService {
|
|
7
|
-
private encoder = new TextEncoder();
|
|
8
|
-
private decoder = new TextDecoder();
|
|
9
|
-
private secretKey = ''; // Will be set by AuthService
|
|
10
|
-
|
|
11
|
-
setSecretKey(key: string) {
|
|
12
|
-
this.secretKey = key;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
private async getKey() {
|
|
16
|
-
const salt = this.encoder.encode('fixed_salt'); // Keep constant
|
|
17
|
-
const baseKey = await crypto.subtle.importKey(
|
|
18
|
-
'raw',
|
|
19
|
-
this.encoder.encode(this.secretKey),
|
|
20
|
-
'PBKDF2',
|
|
21
|
-
false,
|
|
22
|
-
['deriveKey'],
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return crypto.subtle.deriveKey(
|
|
26
|
-
{
|
|
27
|
-
name: 'PBKDF2',
|
|
28
|
-
salt,
|
|
29
|
-
iterations: 100000,
|
|
30
|
-
hash: 'SHA-256',
|
|
31
|
-
},
|
|
32
|
-
baseKey,
|
|
33
|
-
{ name: 'AES-GCM', length: 256 },
|
|
34
|
-
false,
|
|
35
|
-
['encrypt', 'decrypt'],
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async encrypt(value: string): Promise<string | null> {
|
|
40
|
-
if (!value) return null;
|
|
41
|
-
|
|
42
|
-
const key = await this.getKey();
|
|
43
|
-
const iv = crypto.getRandomValues(new Uint8Array(12));
|
|
44
|
-
|
|
45
|
-
const encrypted = await crypto.subtle.encrypt(
|
|
46
|
-
{ name: 'AES-GCM', iv },
|
|
47
|
-
key,
|
|
48
|
-
this.encoder.encode(value),
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const merged = new Uint8Array(iv.length + encrypted.byteLength);
|
|
52
|
-
merged.set(iv, 0);
|
|
53
|
-
merged.set(new Uint8Array(encrypted), iv.length);
|
|
54
|
-
|
|
55
|
-
return btoa(String.fromCharCode(...merged));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async decrypt(value: string): Promise<string | null> {
|
|
59
|
-
if (!value) return null;
|
|
60
|
-
|
|
61
|
-
const raw = Uint8Array.from(atob(value), (c) => c.charCodeAt(0));
|
|
62
|
-
|
|
63
|
-
const iv = raw.slice(0, 12);
|
|
64
|
-
const data = raw.slice(12);
|
|
65
|
-
|
|
66
|
-
const key = await this.getKey();
|
|
67
|
-
|
|
68
|
-
const decrypted = await crypto.subtle.decrypt({ name: 'AES-GCM', iv }, key, data);
|
|
69
|
-
|
|
70
|
-
return this.decoder.decode(decrypted);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { Injectable, NgZone } from '@angular/core';
|
|
2
|
-
import { HttpClient, HttpEventType, HttpHeaders } from '@angular/common/http';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { StorageService } from '../auth/storage.service';
|
|
5
|
-
import { ChatStreamResponse } from '../../app/chat/model/chat-stream-response.model';
|
|
6
|
-
import logger from '../utils/logger.service';
|
|
7
|
-
|
|
8
|
-
@Injectable({
|
|
9
|
-
providedIn: 'root',
|
|
10
|
-
})
|
|
11
|
-
export class HttpStreamService {
|
|
12
|
-
constructor(
|
|
13
|
-
private ngZone: NgZone,
|
|
14
|
-
private tokenStorage: StorageService,
|
|
15
|
-
private http: HttpClient,
|
|
16
|
-
) {}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Creates a POST-based HTTP streaming connection using fetch()
|
|
20
|
-
*/
|
|
21
|
-
createHttpStream(
|
|
22
|
-
url: string,
|
|
23
|
-
body: any,
|
|
24
|
-
headers?: Record<string, string>,
|
|
25
|
-
): Observable<ChatStreamResponse> {
|
|
26
|
-
return new Observable<ChatStreamResponse>((observer) => {
|
|
27
|
-
// Note: Authorization header is added automatically by AuthInterceptor
|
|
28
|
-
let requestHeaders = new HttpHeaders({
|
|
29
|
-
'content-type': 'application/json',
|
|
30
|
-
accept: 'text/event-stream',
|
|
31
|
-
'cache-control': 'no-cache',
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
if (headers) {
|
|
35
|
-
Object.keys(headers).forEach((key) => {
|
|
36
|
-
requestHeaders = requestHeaders.set(key, headers[key]);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const req = this.http.request('POST', url, {
|
|
41
|
-
body,
|
|
42
|
-
headers: requestHeaders,
|
|
43
|
-
reportProgress: true,
|
|
44
|
-
observe: 'events',
|
|
45
|
-
responseType: 'text',
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
let lastLoaded = 0;
|
|
49
|
-
|
|
50
|
-
const sub = req.subscribe({
|
|
51
|
-
next: (event) => {
|
|
52
|
-
if (event.type === HttpEventType.DownloadProgress) {
|
|
53
|
-
// Process the new chunk of data
|
|
54
|
-
const fullText = (event as any).partialText;
|
|
55
|
-
if (!fullText) return;
|
|
56
|
-
|
|
57
|
-
const newText = fullText.slice(lastLoaded);
|
|
58
|
-
lastLoaded = fullText.length;
|
|
59
|
-
|
|
60
|
-
const lines = newText.split('\n');
|
|
61
|
-
|
|
62
|
-
for (const line of lines) {
|
|
63
|
-
if (line.trim() === '') continue;
|
|
64
|
-
|
|
65
|
-
if (line.startsWith('data: ')) {
|
|
66
|
-
const dataStr = line.substring(6).trim();
|
|
67
|
-
|
|
68
|
-
if (dataStr === '[DONE]') {
|
|
69
|
-
this.ngZone.run(() => observer.complete());
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
const parsed = JSON.parse(dataStr);
|
|
75
|
-
this.ngZone.run(() =>
|
|
76
|
-
observer.next({
|
|
77
|
-
content: parsed.content ?? parsed.message ?? '',
|
|
78
|
-
type: parsed.type ?? 'chunk',
|
|
79
|
-
id: parsed.response_id ?? '',
|
|
80
|
-
created_at: parsed.created_at ?? '',
|
|
81
|
-
sources: parsed.sources ?? [],
|
|
82
|
-
error: parsed.error,
|
|
83
|
-
}),
|
|
84
|
-
);
|
|
85
|
-
} catch (e) {
|
|
86
|
-
logger.warn('Failed to parse SSE data:', dataStr, e);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
} else if (event.type === HttpEventType.Response) {
|
|
91
|
-
this.ngZone.run(() => observer.complete());
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
error: (err) => {
|
|
95
|
-
this.ngZone.run(() => observer.error(err));
|
|
96
|
-
},
|
|
97
|
-
complete: () => {
|
|
98
|
-
this.ngZone.run(() => observer.complete());
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
return () => sub.unsubscribe();
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
|
2
|
-
import { Injectable } from '@angular/core';
|
|
3
|
-
import { Observable, delay, retry, map, catchError, of } from 'rxjs';
|
|
4
|
-
import { CoreConfigService } from '../services/core-config.service';
|
|
5
|
-
import { StorageService } from '../auth/storage.service';
|
|
6
|
-
import logger from '../utils/logger.service';
|
|
7
|
-
|
|
8
|
-
@Injectable({
|
|
9
|
-
providedIn: 'root',
|
|
10
|
-
})
|
|
11
|
-
export class HttpService {
|
|
12
|
-
// @BlockUI() blockUI!: NgBlockUI;
|
|
13
|
-
|
|
14
|
-
get apiUrl(): string {
|
|
15
|
-
return this.coreConfig.apiUrl;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
constructor(
|
|
19
|
-
private http: HttpClient,
|
|
20
|
-
private tokenStorage: StorageService,
|
|
21
|
-
private coreConfig: CoreConfigService,
|
|
22
|
-
) {
|
|
23
|
-
logger.log('HttpService: Initialized');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get(
|
|
27
|
-
url: string,
|
|
28
|
-
param?: object,
|
|
29
|
-
nestedParam = false,
|
|
30
|
-
showLoader = false,
|
|
31
|
-
refresh = true,
|
|
32
|
-
headers?: HttpHeaders,
|
|
33
|
-
): Observable<any> {
|
|
34
|
-
// if (showLoader && !this.blockUI.isActive) {
|
|
35
|
-
|
|
36
|
-
// this.blockUI.start();
|
|
37
|
-
|
|
38
|
-
// }
|
|
39
|
-
|
|
40
|
-
let params = {};
|
|
41
|
-
|
|
42
|
-
if (nestedParam) {
|
|
43
|
-
this.buildHttpParams(params, param, '');
|
|
44
|
-
} else {
|
|
45
|
-
params = param as HttpParams;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return this.http
|
|
49
|
-
.get(`${this.apiUrl}${url}`, {
|
|
50
|
-
params: params,
|
|
51
|
-
// withCredentials: true,
|
|
52
|
-
headers,
|
|
53
|
-
})
|
|
54
|
-
.pipe(
|
|
55
|
-
delay(100),
|
|
56
|
-
|
|
57
|
-
retry(0),
|
|
58
|
-
|
|
59
|
-
map((response) => this.returnResponse(response, showLoader)),
|
|
60
|
-
|
|
61
|
-
catchError((error) => {
|
|
62
|
-
// if (this.blockUI.isActive) {
|
|
63
|
-
|
|
64
|
-
// this.blockUI.stop();
|
|
65
|
-
|
|
66
|
-
// }
|
|
67
|
-
|
|
68
|
-
return of(error);
|
|
69
|
-
}),
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
private buildHttpParams(params: any, data: any, currentPath: string) {
|
|
74
|
-
Object.keys(data).forEach((key) => {
|
|
75
|
-
if (data[key] instanceof Object && !(data[key] instanceof Array)) {
|
|
76
|
-
this.buildHttpParams(params, data[key], `${currentPath}${key}.`);
|
|
77
|
-
} else {
|
|
78
|
-
params[`${currentPath}${key}`] = data[key];
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
post(url: string, param?: object, showLoader = false, headers?: HttpHeaders): Observable<any> {
|
|
84
|
-
// if (showLoader && !this.blockUI.isActive) {
|
|
85
|
-
// this.blockUI.start();
|
|
86
|
-
// }
|
|
87
|
-
|
|
88
|
-
return this.http.post(`${this.apiUrl}${url}`, param as HttpParams, { headers }).pipe(
|
|
89
|
-
delay(100),
|
|
90
|
-
retry(0),
|
|
91
|
-
map((response: any) => this.returnResponse(response, showLoader)),
|
|
92
|
-
catchError((error) => {
|
|
93
|
-
// if (this.blockUI.isActive) {
|
|
94
|
-
// this.blockUI.stop();
|
|
95
|
-
// }
|
|
96
|
-
|
|
97
|
-
return of(error);
|
|
98
|
-
}),
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
patch(url: string, param?: object, showLoader = false, headers?: HttpHeaders): Observable<any> {
|
|
103
|
-
// if (showLoader && !this.blockUI.isActive) {
|
|
104
|
-
// this.blockUI.start();
|
|
105
|
-
// }
|
|
106
|
-
|
|
107
|
-
return this.http.patch(`${this.apiUrl}${url}`, param as HttpParams, { headers }).pipe(
|
|
108
|
-
delay(100),
|
|
109
|
-
retry(0),
|
|
110
|
-
map((response: any) => this.returnResponse(response, showLoader)),
|
|
111
|
-
catchError((error) => {
|
|
112
|
-
// if (this.blockUI.isActive) {
|
|
113
|
-
// this.blockUI.stop();
|
|
114
|
-
// }
|
|
115
|
-
|
|
116
|
-
return of(error);
|
|
117
|
-
}),
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
delete(url: string, param?: object, showLoader = false, headers?: HttpHeaders): Observable<any> {
|
|
122
|
-
// if (showLoader && !this.blockUI.isActive) {
|
|
123
|
-
// this.blockUI.start();
|
|
124
|
-
// }
|
|
125
|
-
let params = {};
|
|
126
|
-
params = param as HttpParams;
|
|
127
|
-
|
|
128
|
-
return this.http.delete(`${this.apiUrl}${url}`, { body: param, headers }).pipe(
|
|
129
|
-
delay(100),
|
|
130
|
-
retry(0),
|
|
131
|
-
map((response: any) => this.returnResponse(response, showLoader)),
|
|
132
|
-
catchError((error) => {
|
|
133
|
-
// if (this.blockUI.isActive) {
|
|
134
|
-
// this.blockUI.stop();
|
|
135
|
-
// }
|
|
136
|
-
|
|
137
|
-
return of(error);
|
|
138
|
-
}),
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
private returnResponse(value: any, showLoader: boolean = true): any {
|
|
143
|
-
// if (showLoader && this.blockUI.isActive) {
|
|
144
|
-
// this.blockUI.reset();
|
|
145
|
-
// }
|
|
146
|
-
return value;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HttpErrorResponse,
|
|
3
|
-
HttpEvent,
|
|
4
|
-
HttpHandler,
|
|
5
|
-
HttpInterceptor,
|
|
6
|
-
HttpRequest,
|
|
7
|
-
} from '@angular/common/http';
|
|
8
|
-
import { Injectable } from '@angular/core';
|
|
9
|
-
import { BehaviorSubject, catchError, filter, Observable, switchMap, take, throwError } from 'rxjs';
|
|
10
|
-
import { AuthService } from '../auth/auth.service';
|
|
11
|
-
import { StorageService } from '../auth/storage.service';
|
|
12
|
-
import { Injector } from '@angular/core';
|
|
13
|
-
import logger from '../utils/logger.service';
|
|
14
|
-
|
|
15
|
-
@Injectable({
|
|
16
|
-
providedIn: 'root',
|
|
17
|
-
})
|
|
18
|
-
export class AuthInterceptor implements HttpInterceptor {
|
|
19
|
-
private isRefreshing = false;
|
|
20
|
-
private clearingAuth = false; // Prevent multiple clearAuth calls
|
|
21
|
-
private refreshTokenSubject: BehaviorSubject<any> = new BehaviorSubject<any>(null);
|
|
22
|
-
|
|
23
|
-
constructor(
|
|
24
|
-
private tokenStorage: StorageService,
|
|
25
|
-
private injector: Injector,
|
|
26
|
-
) {}
|
|
27
|
-
|
|
28
|
-
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
|
29
|
-
const authReq = this.getRequestWithHeaders(req);
|
|
30
|
-
|
|
31
|
-
return next.handle(authReq).pipe(
|
|
32
|
-
catchError((error) => {
|
|
33
|
-
// Handle 401 Unauthorized errors
|
|
34
|
-
if (
|
|
35
|
-
error instanceof HttpErrorResponse &&
|
|
36
|
-
error.status === 401 &&
|
|
37
|
-
!authReq.url.includes('auth/login') && // Don't retry login
|
|
38
|
-
!authReq.url.includes('auth/federated/login') && // Don't retry federated login
|
|
39
|
-
!authReq.url.includes('auth/logout') && // Don't retry logout
|
|
40
|
-
!authReq.url.includes('auth/refresh') // Don't retry refresh itself
|
|
41
|
-
) {
|
|
42
|
-
logger.error('[AuthInterceptor] 401 Unauthorized:', {
|
|
43
|
-
url: authReq.url,
|
|
44
|
-
userId: this.tokenStorage.get('user_id'),
|
|
45
|
-
});
|
|
46
|
-
return this.handle401Error(authReq, next);
|
|
47
|
-
}
|
|
48
|
-
return throwError(() => error);
|
|
49
|
-
}),
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
private handle401Error(request: HttpRequest<any>, next: HttpHandler) {
|
|
54
|
-
// If already clearing, don't retry
|
|
55
|
-
if (this.clearingAuth) {
|
|
56
|
-
logger.log('[AuthInterceptor] Already clearing auth, rejecting request');
|
|
57
|
-
return throwError(() => new Error('Authentication cleared'));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (!this.isRefreshing) {
|
|
61
|
-
this.isRefreshing = true;
|
|
62
|
-
this.refreshTokenSubject.next(null);
|
|
63
|
-
|
|
64
|
-
const authService = this.injector.get(AuthService);
|
|
65
|
-
return authService.refreshToken().pipe(
|
|
66
|
-
switchMap((token: any) => {
|
|
67
|
-
this.isRefreshing = false;
|
|
68
|
-
this.refreshTokenSubject.next(token.access_token);
|
|
69
|
-
// Retry the original request with the new token
|
|
70
|
-
return next.handle(this.getRequestWithHeaders(request));
|
|
71
|
-
}),
|
|
72
|
-
catchError((err) => {
|
|
73
|
-
this.isRefreshing = false;
|
|
74
|
-
// Refresh failed - logout user (only once)
|
|
75
|
-
if (!this.clearingAuth) {
|
|
76
|
-
this.clearingAuth = true;
|
|
77
|
-
const authService = this.injector.get(AuthService);
|
|
78
|
-
authService.clearAuth();
|
|
79
|
-
this.clearingAuth = false;
|
|
80
|
-
}
|
|
81
|
-
return throwError(() => err);
|
|
82
|
-
}),
|
|
83
|
-
);
|
|
84
|
-
} else {
|
|
85
|
-
// Wait while getting new token
|
|
86
|
-
return this.refreshTokenSubject.pipe(
|
|
87
|
-
filter((token) => token != null),
|
|
88
|
-
take(1),
|
|
89
|
-
switchMap((jwt) => {
|
|
90
|
-
// Rewrite with new token and retry
|
|
91
|
-
return next.handle(this.getRequestWithHeaders(request));
|
|
92
|
-
}),
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
getRequestWithHeaders(req: HttpRequest<any>): HttpRequest<any> {
|
|
98
|
-
// Skip adding token for login/refresh/logout endpoints
|
|
99
|
-
if (
|
|
100
|
-
req.url.includes('auth/login') ||
|
|
101
|
-
req.url.includes('auth/federated/login') ||
|
|
102
|
-
req.url.includes('auth/refresh') ||
|
|
103
|
-
req.url.includes('auth/logout')
|
|
104
|
-
) {
|
|
105
|
-
return req;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
let headers = req.headers;
|
|
109
|
-
// Get fresh token from new storage service
|
|
110
|
-
const token = this.tokenStorage.get('access_token') ?? '';
|
|
111
|
-
|
|
112
|
-
if (token != '') {
|
|
113
|
-
headers = headers.set('authorization', `Bearer ${token}`);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return req.clone({ headers });
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
|
2
|
-
import { Injectable, Injector } from '@angular/core';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { AuthService } from '../auth/auth.service';
|
|
5
|
-
import { LicenseService } from '../services/license.service';
|
|
6
|
-
|
|
7
|
-
@Injectable()
|
|
8
|
-
export class LicenseInterceptor implements HttpInterceptor {
|
|
9
|
-
constructor(private injector: Injector) {}
|
|
10
|
-
|
|
11
|
-
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
|
12
|
-
const authService = this.injector.get(AuthService);
|
|
13
|
-
const licenseService = this.injector.get(LicenseService);
|
|
14
|
-
|
|
15
|
-
// Skip if this is a login/auth request (AccountService handles it explicitly)
|
|
16
|
-
if (
|
|
17
|
-
req.url.includes('auth/login') ||
|
|
18
|
-
req.url.includes('auth/federated/login') ||
|
|
19
|
-
req.url.includes('auth/refresh') ||
|
|
20
|
-
req.url.includes('auth/logout')
|
|
21
|
-
) {
|
|
22
|
-
return next.handle(req);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Determine if this is an internal API request
|
|
26
|
-
const apiUrl = authService.apiUrl;
|
|
27
|
-
|
|
28
|
-
const isInternalApi =
|
|
29
|
-
(apiUrl && req.url.startsWith(apiUrl)) ||
|
|
30
|
-
(!req.url.startsWith('http') && !req.url.startsWith('assets/'));
|
|
31
|
-
|
|
32
|
-
if (!isInternalApi) {
|
|
33
|
-
return next.handle(req);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Resolve License Key for Authenticated Request
|
|
37
|
-
const context = authService.getLicensingContext();
|
|
38
|
-
// Post-login, context.tenantId should be company_id
|
|
39
|
-
const licenseKey = licenseService.resolveLicenseKey(context, '');
|
|
40
|
-
|
|
41
|
-
if (licenseKey) {
|
|
42
|
-
const clonedReq = req.clone({
|
|
43
|
-
headers: req.headers.set('x-license-key', licenseKey),
|
|
44
|
-
});
|
|
45
|
-
return next.handle(clonedReq);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return next.handle(req);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
|
2
|
-
import { environment } from '../environments/environment.prod';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Configuration for Doohbot API integration
|
|
6
|
-
*/
|
|
7
|
-
export interface DoohbotApiConfig {
|
|
8
|
-
/**
|
|
9
|
-
* Backend API endpoint URL
|
|
10
|
-
* Example: 'https://api.example.com/chat'
|
|
11
|
-
*/
|
|
12
|
-
apiUrl: string;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Optional API key for authentication
|
|
16
|
-
*/
|
|
17
|
-
apiKey?: string;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Request timeout in milliseconds
|
|
21
|
-
* @default 30000 (30 seconds)
|
|
22
|
-
*/
|
|
23
|
-
timeout?: number; // no need
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Enable API mode (true) or use local intent matching (false)
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
enableApi?: boolean; // no need
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Include message history in API requests
|
|
33
|
-
* @default false
|
|
34
|
-
*/
|
|
35
|
-
includeHistory?: boolean; // no need
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Maximum number of history messages to include in requests
|
|
39
|
-
* @default 10
|
|
40
|
-
*/
|
|
41
|
-
maxHistoryMessages?: number; // no need
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Custom headers to include in API requests
|
|
45
|
-
*/
|
|
46
|
-
customHeaders?: Record<string, string>;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Enable retry on failure
|
|
50
|
-
* @default true
|
|
51
|
-
*/
|
|
52
|
-
enableRetry?: boolean;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Number of retry attempts
|
|
56
|
-
* @default 2
|
|
57
|
-
*/
|
|
58
|
-
retryAttempts?: number;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Delay between retries in milliseconds
|
|
62
|
-
* @default 1000
|
|
63
|
-
*/
|
|
64
|
-
retryDelay?: number;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Injection token for providing Doohbot API configuration
|
|
69
|
-
*/
|
|
70
|
-
export const DOOHBOT_API_CONFIG = new InjectionToken<DoohbotApiConfig>('DOOHBOT_API_CONFIG', {
|
|
71
|
-
providedIn: 'root',
|
|
72
|
-
factory: () => ({
|
|
73
|
-
apiUrl: '',
|
|
74
|
-
timeout: 30000,
|
|
75
|
-
enableApi: false,
|
|
76
|
-
includeHistory: false,
|
|
77
|
-
maxHistoryMessages: 10,
|
|
78
|
-
enableRetry: true,
|
|
79
|
-
retryAttempts: 2,
|
|
80
|
-
retryDelay: 1000,
|
|
81
|
-
}),
|
|
82
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { PromptMode } from '../types/prompt-mode.type';
|
|
2
|
-
import { Message } from './message';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Request payload for chat API
|
|
6
|
-
*/
|
|
7
|
-
export interface ChatApiRequest {
|
|
8
|
-
/**
|
|
9
|
-
* User's message text
|
|
10
|
-
*/
|
|
11
|
-
message: string;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Prompt mode
|
|
15
|
-
*/
|
|
16
|
-
prompt_mode?: PromptMode;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Optional message history for context
|
|
20
|
-
*/
|
|
21
|
-
history?: Message[];
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Optional metadata
|
|
25
|
-
*/
|
|
26
|
-
metadata?: Record<string, any>;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Timestamp of the request
|
|
30
|
-
*/
|
|
31
|
-
timestamp?: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Response from chat API
|
|
36
|
-
*/
|
|
37
|
-
export interface ChatApiResponse {
|
|
38
|
-
/**
|
|
39
|
-
* Bot's reply message
|
|
40
|
-
*/
|
|
41
|
-
reply: string;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Optional confidence score (0-1)
|
|
45
|
-
*/
|
|
46
|
-
confidence?: number;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Whether to show suggestion chips
|
|
50
|
-
*/
|
|
51
|
-
showSuggestions?: boolean;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Optional suggested responses
|
|
55
|
-
*/
|
|
56
|
-
suggestions?: string[];
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Optional metadata from the API
|
|
60
|
-
*/
|
|
61
|
-
metadata?: Record<string, any>;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Optional message ID from the backend
|
|
65
|
-
*/
|
|
66
|
-
messageId?: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Error response from chat API
|
|
71
|
-
*/
|
|
72
|
-
export interface ChatApiError {
|
|
73
|
-
/**
|
|
74
|
-
* Error message
|
|
75
|
-
*/
|
|
76
|
-
message: string;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Error code
|
|
80
|
-
*/
|
|
81
|
-
code?: string;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* HTTP status code
|
|
85
|
-
*/
|
|
86
|
-
statusCode?: number;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Additional error details
|
|
90
|
-
*/
|
|
91
|
-
details?: any;
|
|
92
|
-
}
|