@aakash58/chatbot 1.1.20 → 1.1.21
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/.editorconfig +17 -0
- package/.vscode/extensions.json +4 -0
- package/.vscode/launch.json +41 -0
- package/.vscode/settings.json +14 -0
- package/.vscode/tasks.json +60 -0
- package/README.md +298 -22
- package/angular.json +132 -0
- package/docs/PUBLISHING_GUIDE.md +104 -0
- package/package.json +75 -29
- package/projects/app-doohbot/public/assets/const/app-const.json +15 -0
- package/projects/app-doohbot/public/assets/const/doohclick_license.json +6 -0
- package/projects/app-doohbot/public/favicon.ico +0 -0
- package/projects/app-doohbot/src/app/app.config.ts +13 -0
- package/projects/app-doohbot/src/app/app.html +31 -0
- package/projects/app-doohbot/src/app/app.routes.ts +3 -0
- package/projects/app-doohbot/src/app/app.scss +279 -0
- package/projects/app-doohbot/src/app/app.spec.ts +23 -0
- package/projects/app-doohbot/src/app/app.ts +72 -0
- package/projects/app-doohbot/src/index.html +15 -0
- package/projects/app-doohbot/src/main.ts +6 -0
- package/projects/app-doohbot/src/styles.scss +15 -0
- package/projects/app-doohbot/tsconfig.app.json +15 -0
- package/projects/app-doohbot/tsconfig.spec.json +14 -0
- package/projects/doohbot/README.md +64 -0
- package/projects/doohbot/docs/README.md +140 -0
- package/projects/doohbot/ng-package.json +10 -0
- package/projects/doohbot/package.json +16 -0
- package/projects/doohbot/src/lib/app/chat/chat-ui-state.service.ts +194 -0
- package/projects/doohbot/src/lib/app/chat/chat.service.ts +547 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.html +27 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.scss +115 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.ts +35 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.html +3 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.scss +20 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.ts +12 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.html +34 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.scss +78 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.ts +52 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.html +77 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.scss +346 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.ts +188 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.html +146 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.scss +187 -0
- package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.ts +256 -0
- package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.html +17 -0
- package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.scss +59 -0
- package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.ts +28 -0
- package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.html +138 -0
- package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.scss +436 -0
- package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.ts +106 -0
- package/projects/doohbot/src/lib/app/chat/model/chat-history.model.ts +57 -0
- package/projects/doohbot/src/lib/app/chat/model/chat-request.model.ts +17 -0
- package/projects/doohbot/src/lib/app/chat/model/chat-response.model.ts +9 -0
- package/projects/doohbot/src/lib/app/chat/model/chat-session.model.ts +14 -0
- package/{lib/app/chat/model/chat-stream-message.model.d.ts → projects/doohbot/src/lib/app/chat/model/chat-stream-message.model.ts} +6 -5
- package/projects/doohbot/src/lib/app/chat/model/chat-stream-response.model.ts +12 -0
- package/projects/doohbot/src/lib/app/chat/services/chat-api.service.ts +82 -0
- package/projects/doohbot/src/lib/app/chat/services/chat-audio.service.ts +44 -0
- package/projects/doohbot/src/lib/app/chat/services/chat-history.service.ts +303 -0
- package/projects/doohbot/src/lib/app/login/login-form.component.html +80 -0
- package/projects/doohbot/src/lib/app/login/login-form.component.scss +189 -0
- package/projects/doohbot/src/lib/app/login/login-form.component.ts +45 -0
- package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.html +81 -0
- package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.scss +179 -0
- package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.ts +217 -0
- package/projects/doohbot/src/lib/app/personalization/personalization.service.ts +197 -0
- package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.html +111 -0
- package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.scss +218 -0
- package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.ts +121 -0
- package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.html +46 -0
- package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.scss +138 -0
- package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.ts +28 -0
- package/projects/doohbot/src/lib/app/personalization/sections/preferences/color-picker-dialog.component.ts +92 -0
- package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.html +198 -0
- package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.scss +107 -0
- package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.ts +103 -0
- package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.html +46 -0
- package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.scss +131 -0
- package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.ts +23 -0
- package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.html +33 -0
- package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.scss +61 -0
- package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.ts +20 -0
- package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.html +30 -0
- package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.scss +59 -0
- package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.ts +12 -0
- package/projects/doohbot/src/lib/constant/doohbot-constant.ts +40 -0
- package/projects/doohbot/src/lib/constant/html-entities.ts +8 -0
- package/projects/doohbot/src/lib/constant/utf8.ts +9 -0
- package/projects/doohbot/src/lib/core/app-const.ts +63 -0
- package/projects/doohbot/src/lib/core/auth/account-api.service.ts +53 -0
- package/projects/doohbot/src/lib/core/auth/auth.service.ts +478 -0
- package/projects/doohbot/src/lib/core/auth/models/auth-result.model.ts +4 -0
- package/projects/doohbot/src/lib/core/auth/models/federated-login-request.model.ts +5 -0
- package/projects/doohbot/src/lib/core/auth/models/login-request.model.ts +6 -0
- package/projects/doohbot/src/lib/core/auth/storage.service.ts +113 -0
- package/projects/doohbot/src/lib/core/directives/draggable/draggable-dialog.directive.ts +123 -0
- package/projects/doohbot/src/lib/core/directives/draggable/draggable-dialog.module.ts +9 -0
- package/projects/doohbot/src/lib/core/directives/fullscreen/fullscreen.directive.ts +58 -0
- package/projects/doohbot/src/lib/core/directives/fullscreen/fullscreen.module.ts +9 -0
- package/projects/doohbot/src/lib/core/directives/popout/popout.directive.ts +169 -0
- package/projects/doohbot/src/lib/core/directives/popout/popout.module.ts +9 -0
- package/projects/doohbot/src/lib/core/directives/resizable/resizable-dialog.directive.ts +197 -0
- package/projects/doohbot/src/lib/core/directives/resizable/resizable-dialog.module.ts +9 -0
- package/projects/doohbot/src/lib/core/enums/api-request-state.enum.ts +9 -0
- package/projects/doohbot/src/lib/core/environments/environment.prod.ts +14 -0
- package/projects/doohbot/src/lib/core/environments/environment.ts +14 -0
- package/projects/doohbot/src/lib/core/helpers/crypto-helper.service.ts +72 -0
- package/projects/doohbot/src/lib/core/http/http-stream.service.ts +105 -0
- package/projects/doohbot/src/lib/core/http/http.service.ts +148 -0
- package/projects/doohbot/src/lib/core/interceptors/auth.interceptor.ts +118 -0
- package/projects/doohbot/src/lib/core/interceptors/license.interceptor.ts +50 -0
- package/projects/doohbot/src/lib/core/models/api-config.model.ts +82 -0
- package/projects/doohbot/src/lib/core/models/api-request.model.ts +92 -0
- package/projects/doohbot/src/lib/core/models/api-response.model.ts +13 -0
- package/projects/doohbot/src/lib/core/models/doohbot-config.model.ts +109 -0
- package/{lib/core/models/license.model.d.ts → projects/doohbot/src/lib/core/models/license.model.ts} +27 -23
- package/projects/doohbot/src/lib/core/models/message.ts +18 -0
- package/projects/doohbot/src/lib/core/models/theme-config.model.ts +48 -0
- package/projects/doohbot/src/lib/core/services/core-config.service.ts +53 -0
- package/projects/doohbot/src/lib/core/services/doohbot-api.service.ts +207 -0
- package/projects/doohbot/src/lib/core/services/license.service.ts +171 -0
- package/projects/doohbot/src/lib/core/services/markdown.service.ts +73 -0
- package/projects/doohbot/src/lib/core/services/theme.service.ts +305 -0
- package/{lib/core/types/auth-mode.type.d.ts → projects/doohbot/src/lib/core/types/auth-mode.type.ts} +4 -4
- package/{lib/core/types/auth-status.type.d.ts → projects/doohbot/src/lib/core/types/auth-status.type.ts} +5 -4
- package/{lib/core/types/chat-stream.type.d.ts → projects/doohbot/src/lib/core/types/chat-stream.type.ts} +4 -4
- package/{lib/core/types/message-role.type.d.ts → projects/doohbot/src/lib/core/types/message-role.type.ts} +4 -4
- package/{lib/core/types/prompt-mode.type.d.ts → projects/doohbot/src/lib/core/types/prompt-mode.type.ts} +5 -4
- package/{lib/core/types/snackbar-error.type.d.ts → projects/doohbot/src/lib/core/types/snackbar-error.type.ts} +5 -4
- package/{lib/core/types/tenant-resolution-strategy.type.d.ts → projects/doohbot/src/lib/core/types/tenant-resolution-strategy.type.ts} +4 -4
- package/projects/doohbot/src/lib/core/utils/error-handler.util.ts +31 -0
- package/projects/doohbot/src/lib/core/utils/logger.service.ts +45 -0
- package/projects/doohbot/src/lib/doohbot-input.ts +19 -0
- package/projects/doohbot/src/lib/doohbot.component.html +34 -0
- package/projects/doohbot/src/lib/doohbot.component.scss +17 -0
- package/projects/doohbot/src/lib/doohbot.component.spec.ts +31 -0
- package/projects/doohbot/src/lib/doohbot.component.ts +545 -0
- package/projects/doohbot/src/lib/elements.ts +25 -0
- package/projects/doohbot/src/lib/predefined_messages.ts +14 -0
- package/projects/doohbot/src/lib/shared/chips/chips.component.html +9 -0
- package/projects/doohbot/src/lib/shared/chips/chips.component.scss +29 -0
- package/projects/doohbot/src/lib/shared/chips/chips.component.spec.ts +22 -0
- package/projects/doohbot/src/lib/shared/chips/chips.component.ts +20 -0
- package/projects/doohbot/src/lib/shared/dialog/dialog.component.html +29 -0
- package/projects/doohbot/src/lib/shared/dialog/dialog.component.scss +100 -0
- package/projects/doohbot/src/lib/shared/dialog/dialog.component.ts +42 -0
- package/projects/doohbot/src/lib/shared/dialog/dialog.service.ts +62 -0
- package/projects/doohbot/src/lib/shared/dialog/dialog.utils.ts +102 -0
- package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.html +30 -0
- package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.scss +53 -0
- package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.spec.ts +22 -0
- package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.ts +35 -0
- package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.html +16 -0
- package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.scss +45 -0
- package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.ts +46 -0
- package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.html +5 -0
- 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 +22 -0
- package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.ts +20 -0
- package/projects/doohbot/src/lib/shared/pipes/simple-markdown.pipe.ts +19 -0
- package/projects/doohbot/src/lib/shared/popout/popout.html +1 -0
- package/projects/doohbot/src/lib/shared/popout/popout.scss +0 -0
- package/projects/doohbot/src/lib/shared/popout/popout.spec.ts +23 -0
- package/projects/doohbot/src/lib/shared/popout/popout.ts +11 -0
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.html +7 -0
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.scss +125 -0
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.spec.ts +21 -0
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.ts +44 -0
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.service.ts +54 -0
- package/{lib/shared/snackbar/snackbar.utils.d.ts → projects/doohbot/src/lib/shared/snackbar/snackbar.utils.ts} +49 -33
- package/projects/doohbot/src/lib/styles/_theme.scss +132 -0
- package/projects/doohbot/src/lib/styles/material-override.scss +302 -0
- package/projects/doohbot/src/lib/styles/utility.scss +588 -0
- package/projects/doohbot/src/public-api.ts +42 -0
- package/projects/doohbot/tsconfig.lib.json +15 -0
- package/projects/doohbot/tsconfig.lib.prod.json +11 -0
- package/projects/doohbot/tsconfig.spec.json +10 -0
- package/proxy.conf.json +8 -0
- package/publish.config.js +25 -0
- package/scripts/publishing/index.ts +67 -0
- package/scripts/publishing/pipeline/01-clean.ts +11 -0
- package/scripts/publishing/pipeline/02-validate-pre.ts +8 -0
- package/scripts/publishing/pipeline/03-build.ts +7 -0
- package/scripts/publishing/pipeline/04-validate-post.ts +8 -0
- package/scripts/publishing/pipeline/05-prepare-package.ts +29 -0
- package/scripts/publishing/pipeline/06-version.ts +23 -0
- package/scripts/publishing/pipeline/07-publish.ts +14 -0
- package/scripts/publishing/pipeline/08-cleanup.ts +5 -0
- package/scripts/publishing/types.ts +36 -0
- package/scripts/publishing/utils/command.ts +15 -0
- package/scripts/publishing/utils/config.ts +17 -0
- package/scripts/validate.ts +166 -0
- package/tsconfig.json +45 -0
- package/tsconfig.scripts.json +15 -0
- package/esm2022/aakash58-chatbot.mjs +0 -5
- package/esm2022/lib/app/chat/chat-ui-state.service.mjs +0 -170
- package/esm2022/lib/app/chat/chat.service.mjs +0 -445
- package/esm2022/lib/app/chat/components/chat-button/chat-button.component.mjs +0 -50
- package/esm2022/lib/app/chat/components/chat-footer/chat-footer.component.mjs +0 -12
- package/esm2022/lib/app/chat/components/chat-header/chat-header.component.mjs +0 -66
- package/esm2022/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.mjs +0 -186
- package/esm2022/lib/app/chat/components/chat-window/chat-window.component.mjs +0 -312
- package/esm2022/lib/app/chat/components/message-input/message-input.component.mjs +0 -36
- package/esm2022/lib/app/chat/components/message-list/message-list.component.mjs +0 -115
- package/esm2022/lib/app/chat/model/chat-history.model.mjs +0 -2
- package/esm2022/lib/app/chat/model/chat-request.model.mjs +0 -2
- package/esm2022/lib/app/chat/model/chat-response.model.mjs +0 -2
- package/esm2022/lib/app/chat/model/chat-session.model.mjs +0 -2
- package/esm2022/lib/app/chat/model/chat-stream-message.model.mjs +0 -2
- package/esm2022/lib/app/chat/model/chat-stream-response.model.mjs +0 -2
- package/esm2022/lib/app/chat/services/chat-api.service.mjs +0 -61
- package/esm2022/lib/app/chat/services/chat-audio.service.mjs +0 -50
- package/esm2022/lib/app/chat/services/chat-history.service.mjs +0 -252
- package/esm2022/lib/app/login/login-form.component.mjs +0 -46
- package/esm2022/lib/app/personalization/personalization-dialog.component.mjs +0 -194
- package/esm2022/lib/app/personalization/personalization.service.mjs +0 -149
- package/esm2022/lib/app/personalization/sections/account/account-section.component.mjs +0 -122
- package/esm2022/lib/app/personalization/sections/preferences/color-picker-dialog.component.mjs +0 -86
- package/esm2022/lib/app/personalization/sections/preferences/preferences-section.component.mjs +0 -115
- package/esm2022/lib/app/personalization/sections/profile/profile-section.component.mjs +0 -29
- package/esm2022/lib/app/personalization/sections/settings/setting-section.component.mjs +0 -30
- package/esm2022/lib/app/personalization/sections/terms/terms-section.component.mjs +0 -12
- package/esm2022/lib/constant/doohbot-constant.mjs +0 -28
- package/esm2022/lib/constant/html-entities.mjs +0 -9
- package/esm2022/lib/constant/utf8.mjs +0 -10
- package/esm2022/lib/core/app-const.mjs +0 -61
- package/esm2022/lib/core/auth/account-api.service.mjs +0 -40
- package/esm2022/lib/core/auth/auth.service.mjs +0 -391
- package/esm2022/lib/core/auth/models/auth-result.model.mjs +0 -3
- package/esm2022/lib/core/auth/models/federated-login-request.model.mjs +0 -6
- package/esm2022/lib/core/auth/models/login-request.model.mjs +0 -6
- package/esm2022/lib/core/auth/storage.service.mjs +0 -110
- package/esm2022/lib/core/directives/draggable/draggable-dialog.directive.mjs +0 -112
- package/esm2022/lib/core/directives/fullscreen/fullscreen.directive.mjs +0 -55
- package/esm2022/lib/core/directives/resizable/resizable-dialog.directive.mjs +0 -179
- package/esm2022/lib/core/environments/environment.mjs +0 -15
- package/esm2022/lib/core/environments/environment.prod.mjs +0 -15
- package/esm2022/lib/core/helpers/crypto-helper.service.mjs +0 -52
- package/esm2022/lib/core/http/http-stream.service.mjs +0 -97
- package/esm2022/lib/core/http/http.service.mjs +0 -103
- package/esm2022/lib/core/interceptors/auth.interceptor.mjs +0 -96
- package/esm2022/lib/core/interceptors/license.interceptor.mjs +0 -44
- package/esm2022/lib/core/models/api-config.model.mjs +0 -18
- package/esm2022/lib/core/models/api-request.model.mjs +0 -2
- package/esm2022/lib/core/models/api-response.model.mjs +0 -8
- package/esm2022/lib/core/models/doohbot-config.model.mjs +0 -18
- package/esm2022/lib/core/models/license.model.mjs +0 -2
- package/esm2022/lib/core/models/message.mjs +0 -2
- package/esm2022/lib/core/models/theme-config.model.mjs +0 -2
- package/esm2022/lib/core/services/core-config.service.mjs +0 -52
- package/esm2022/lib/core/services/license.service.mjs +0 -145
- package/esm2022/lib/core/services/markdown.service.mjs +0 -64
- package/esm2022/lib/core/services/theme.service.mjs +0 -248
- package/esm2022/lib/core/types/auth-mode.type.mjs +0 -2
- package/esm2022/lib/core/types/auth-status.type.mjs +0 -5
- package/esm2022/lib/core/types/chat-stream.type.mjs +0 -2
- package/esm2022/lib/core/types/message-role.type.mjs +0 -2
- package/esm2022/lib/core/types/prompt-mode.type.mjs +0 -5
- package/esm2022/lib/core/types/snackbar-error.type.mjs +0 -5
- package/esm2022/lib/core/types/tenant-resolution-strategy.type.mjs +0 -2
- package/esm2022/lib/core/utils/logger.service.mjs +0 -42
- package/esm2022/lib/doohbot-input.mjs +0 -20
- package/esm2022/lib/doohbot.component.mjs +0 -444
- package/esm2022/lib/predefined_messages.mjs +0 -15
- package/esm2022/lib/shared/chips/chips.component.mjs +0 -28
- package/esm2022/lib/shared/dialog/dialog.component.mjs +0 -36
- package/esm2022/lib/shared/dialog/dialog.service.mjs +0 -64
- package/esm2022/lib/shared/dialog/dialog.utils.mjs +0 -85
- package/esm2022/lib/shared/dropdown-menu/dropdown-menu.component.mjs +0 -29
- package/esm2022/lib/shared/input-dialog/input-dialog.component.mjs +0 -38
- package/esm2022/lib/shared/menu-item/menu-item.component.mjs +0 -24
- package/esm2022/lib/shared/pipes/simple-markdown.pipe.mjs +0 -27
- package/esm2022/lib/shared/snackbar/snackbar.component.mjs +0 -43
- package/esm2022/lib/shared/snackbar/snackbar.service.mjs +0 -46
- package/esm2022/lib/shared/snackbar/snackbar.utils.mjs +0 -43
- package/esm2022/public-api.mjs +0 -37
- package/fesm2022/aakash58-chatbot.mjs +0 -5193
- package/fesm2022/aakash58-chatbot.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/app/chat/chat-ui-state.service.d.ts +0 -96
- package/lib/app/chat/chat.service.d.ts +0 -88
- package/lib/app/chat/components/chat-button/chat-button.component.d.ts +0 -16
- package/lib/app/chat/components/chat-footer/chat-footer.component.d.ts +0 -5
- package/lib/app/chat/components/chat-header/chat-header.component.d.ts +0 -24
- package/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.d.ts +0 -49
- package/lib/app/chat/components/chat-window/chat-window.component.d.ts +0 -107
- package/lib/app/chat/components/message-input/message-input.component.d.ts +0 -12
- package/lib/app/chat/components/message-list/message-list.component.d.ts +0 -40
- package/lib/app/chat/model/chat-history.model.d.ts +0 -51
- package/lib/app/chat/model/chat-request.model.d.ts +0 -10
- package/lib/app/chat/model/chat-response.model.d.ts +0 -9
- package/lib/app/chat/model/chat-session.model.d.ts +0 -12
- package/lib/app/chat/model/chat-stream-response.model.d.ts +0 -10
- package/lib/app/chat/services/chat-api.service.d.ts +0 -30
- package/lib/app/chat/services/chat-audio.service.d.ts +0 -19
- package/lib/app/chat/services/chat-history.service.d.ts +0 -53
- package/lib/app/login/login-form.component.d.ts +0 -20
- package/lib/app/personalization/personalization-dialog.component.d.ts +0 -53
- package/lib/app/personalization/personalization.service.d.ts +0 -66
- package/lib/app/personalization/sections/account/account-section.component.d.ts +0 -30
- package/lib/app/personalization/sections/preferences/color-picker-dialog.component.d.ts +0 -17
- package/lib/app/personalization/sections/preferences/preferences-section.component.d.ts +0 -27
- package/lib/app/personalization/sections/profile/profile-section.component.d.ts +0 -17
- package/lib/app/personalization/sections/settings/setting-section.component.d.ts +0 -10
- package/lib/app/personalization/sections/terms/terms-section.component.d.ts +0 -5
- package/lib/constant/doohbot-constant.d.ts +0 -12
- package/lib/constant/html-entities.d.ts +0 -8
- package/lib/constant/utf8.d.ts +0 -9
- package/lib/core/app-const.d.ts +0 -11
- package/lib/core/auth/account-api.service.d.ts +0 -20
- package/lib/core/auth/auth.service.d.ts +0 -90
- package/lib/core/auth/models/auth-result.model.d.ts +0 -4
- package/lib/core/auth/models/federated-login-request.model.d.ts +0 -5
- package/lib/core/auth/models/login-request.model.d.ts +0 -6
- package/lib/core/auth/storage.service.d.ts +0 -21
- package/lib/core/directives/draggable/draggable-dialog.directive.d.ts +0 -23
- package/lib/core/directives/fullscreen/fullscreen.directive.d.ts +0 -14
- package/lib/core/directives/resizable/resizable-dialog.directive.d.ts +0 -30
- package/lib/core/environments/environment.d.ts +0 -7
- package/lib/core/environments/environment.prod.d.ts +0 -7
- package/lib/core/helpers/crypto-helper.service.d.ts +0 -12
- package/lib/core/http/http-stream.service.d.ts +0 -18
- package/lib/core/http/http.service.d.ts +0 -20
- package/lib/core/interceptors/auth.interceptor.d.ts +0 -18
- package/lib/core/interceptors/license.interceptor.d.ts +0 -11
- package/lib/core/models/api-config.model.d.ts +0 -58
- package/lib/core/models/api-request.model.d.ts +0 -77
- package/lib/core/models/api-response.model.d.ts +0 -6
- package/lib/core/models/doohbot-config.model.d.ts +0 -81
- package/lib/core/models/message.d.ts +0 -16
- package/lib/core/models/theme-config.model.d.ts +0 -28
- package/lib/core/services/core-config.service.d.ts +0 -23
- package/lib/core/services/license.service.d.ts +0 -33
- package/lib/core/services/markdown.service.d.ts +0 -8
- package/lib/core/services/theme.service.d.ts +0 -40
- package/lib/core/utils/logger.service.d.ts +0 -11
- package/lib/doohbot-input.d.ts +0 -19
- package/lib/doohbot.component.d.ts +0 -108
- package/lib/predefined_messages.d.ts +0 -2
- package/lib/shared/chips/chips.component.d.ts +0 -10
- package/lib/shared/dialog/dialog.component.d.ts +0 -19
- package/lib/shared/dialog/dialog.service.d.ts +0 -29
- package/lib/shared/dialog/dialog.utils.d.ts +0 -41
- package/lib/shared/dropdown-menu/dropdown-menu.component.d.ts +0 -11
- package/lib/shared/input-dialog/input-dialog.component.d.ts +0 -20
- package/lib/shared/menu-item/menu-item.component.d.ts +0 -9
- package/lib/shared/pipes/simple-markdown.pipe.d.ts +0 -10
- package/lib/shared/snackbar/snackbar.component.d.ts +0 -14
- package/lib/shared/snackbar/snackbar.service.d.ts +0 -19
- package/public-api.d.ts +0 -11
- /package/{src → projects/doohbot/src}/assets/bot.mp3 +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Injectable({
|
|
4
|
+
providedIn: 'root',
|
|
5
|
+
})
|
|
6
|
+
export class MarkdownService {
|
|
7
|
+
constructor() {}
|
|
8
|
+
|
|
9
|
+
convert(markdown: string): string {
|
|
10
|
+
if (!markdown) return '';
|
|
11
|
+
|
|
12
|
+
// 1. Escape HTML first to prevent XSS
|
|
13
|
+
let html = this.escapeHtml(markdown);
|
|
14
|
+
|
|
15
|
+
// 2. Process Heads (h1-h3)
|
|
16
|
+
// # Header -> <h1>Header</h1>
|
|
17
|
+
html = html.replace(/^### (.*$)/gim, '<h3>$1</h3>');
|
|
18
|
+
html = html.replace(/^## (.*$)/gim, '<h2>$1</h2>');
|
|
19
|
+
html = html.replace(/^# (.*$)/gim, '<h1>$1</h1>');
|
|
20
|
+
|
|
21
|
+
// 3. Bold (** or __)
|
|
22
|
+
html = html.replace(/\*\*(.*?)\*\*/gim, '<strong>$1</strong>');
|
|
23
|
+
html = html.replace(/__(.*?)__/gim, '<strong>$1</strong>');
|
|
24
|
+
|
|
25
|
+
// 4. Italic (* or _)
|
|
26
|
+
html = html.replace(/\*(.*?)\*/gim, '<em>$1</em>');
|
|
27
|
+
html = html.replace(/_(.*?)_/gim, '<em>$1</em>');
|
|
28
|
+
|
|
29
|
+
// 5. Lists (unordered)
|
|
30
|
+
// Note: This is a simple regex that wraps each list item in <li>.
|
|
31
|
+
// Full list wrapping <ul> needs state awareness, but for simple chat line-by-line:
|
|
32
|
+
html = html.replace(/^\s*-\s+(.*$)/gim, '<li>$1</li>');
|
|
33
|
+
html = html.replace(/^\s*\*\s+(.*$)/gim, '<li>$1</li>');
|
|
34
|
+
|
|
35
|
+
// 6. Lists (ordered)
|
|
36
|
+
html = html.replace(/^\s*\d+\.\s+(.*$)/gim, '<li>$1</li>');
|
|
37
|
+
|
|
38
|
+
// 7. Paragraphs
|
|
39
|
+
// Split by double newline to form paragraphs, but avoid wrapping existing tags
|
|
40
|
+
// This is a naive implementation; for robust parsing, we'd need a token,
|
|
41
|
+
// but for simple chat, we can just replace \n with <br> inside paragraphs.
|
|
42
|
+
|
|
43
|
+
// Simple line break handling
|
|
44
|
+
html = html.replace(/\n/gim, '<br>');
|
|
45
|
+
|
|
46
|
+
// Optional: Wrap loose text in paragraphs if completely robust is needed,
|
|
47
|
+
// but <br> is usually sufficient for chat bubbles.
|
|
48
|
+
|
|
49
|
+
// Wrap adjacent <li>s in <ul> or <ol> is tricky with pure regex on the whole string.
|
|
50
|
+
// Improvement: We can wrap the whole block.
|
|
51
|
+
|
|
52
|
+
// Basic List Wrapping (very simple heuristic)
|
|
53
|
+
// Replace sequences of <li>...</li> with <ul>...</ul> is hard without multiple passes.
|
|
54
|
+
// For now, we will style straight <li>s if they appear, or just accept that they might lack a parent <ul>
|
|
55
|
+
// which browsers often handle okay visually, OR we try to group them.
|
|
56
|
+
|
|
57
|
+
// Let's try to group <li>s
|
|
58
|
+
html = html.replace(/(<li>.*<\/li>(\s*<br>\s*)*)+/gim, '<ul>$&</ul>');
|
|
59
|
+
|
|
60
|
+
// Clean up <br> inside <ul>
|
|
61
|
+
html = html.replace(/<\/li>\s*<br>\s*<li>/gim, '</li><li>');
|
|
62
|
+
html = html.replace(/<ul>\s*<br>/gim, '<ul>');
|
|
63
|
+
html = html.replace(/<br>\s*<\/ul>/gim, '</ul>');
|
|
64
|
+
|
|
65
|
+
return html;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private escapeHtml(text: string): string {
|
|
69
|
+
const div = document.createElement('div');
|
|
70
|
+
div.textContent = text;
|
|
71
|
+
return div.innerHTML;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { effect, Injectable, OnDestroy, Renderer2, RendererFactory2, signal } from '@angular/core';
|
|
2
|
+
import { OverlayContainer } from '@angular/cdk/overlay';
|
|
3
|
+
import { DoohbotThemeConfig } from '../models/theme-config.model';
|
|
4
|
+
import { PersonalizationService } from '../../app/personalization/personalization.service';
|
|
5
|
+
|
|
6
|
+
export type ThemeMode = 'light' | 'dark' | 'auto';
|
|
7
|
+
|
|
8
|
+
@Injectable({
|
|
9
|
+
providedIn: 'root',
|
|
10
|
+
})
|
|
11
|
+
export class ThemeService implements OnDestroy {
|
|
12
|
+
private renderer: Renderer2;
|
|
13
|
+
private _theme = signal<ThemeMode>('auto');
|
|
14
|
+
public theme = this._theme.asReadonly();
|
|
15
|
+
|
|
16
|
+
private _activeTheme = signal<'light-theme' | 'dark-theme'>('light-theme');
|
|
17
|
+
public activeTheme = this._activeTheme.asReadonly();
|
|
18
|
+
|
|
19
|
+
private observer: MutationObserver | null = null;
|
|
20
|
+
// private mediaQueryListener: ((e: MediaQueryListEvent) => void) | null = null;
|
|
21
|
+
|
|
22
|
+
constructor(
|
|
23
|
+
rendererFactory: RendererFactory2,
|
|
24
|
+
private overlay: OverlayContainer,
|
|
25
|
+
private personalization: PersonalizationService,
|
|
26
|
+
) {
|
|
27
|
+
this.renderer = rendererFactory.createRenderer(null, null);
|
|
28
|
+
|
|
29
|
+
// Sync theme and primary color with PersonalizationService
|
|
30
|
+
effect(
|
|
31
|
+
() => {
|
|
32
|
+
const settings = this.personalization.settings();
|
|
33
|
+
const mode = settings.appearance.theme;
|
|
34
|
+
const primaryColor = settings.appearance.primaryColor;
|
|
35
|
+
|
|
36
|
+
// Update theme
|
|
37
|
+
this._theme.set(mode);
|
|
38
|
+
this.updateActiveTheme(mode);
|
|
39
|
+
|
|
40
|
+
// Update primary color globally
|
|
41
|
+
this.applyPrimaryColorToGlobal(primaryColor);
|
|
42
|
+
},
|
|
43
|
+
{ allowSignalWrites: true },
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// Separate effect to handle re-application of config when activeTheme changes
|
|
47
|
+
effect(() => {
|
|
48
|
+
// const currentTheme = this._activeTheme();
|
|
49
|
+
const config = this._currentConfig();
|
|
50
|
+
if (this.rootElement && config) {
|
|
51
|
+
this.applyCssVariables(this.rootElement, config);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private _currentConfig = signal<DoohbotThemeConfig | undefined>(undefined);
|
|
57
|
+
private rootElement: HTMLElement | null = null;
|
|
58
|
+
|
|
59
|
+
public setThemeConfig(config: DoohbotThemeConfig, rootElement: HTMLElement) {
|
|
60
|
+
this._currentConfig.set(config);
|
|
61
|
+
this.rootElement = rootElement;
|
|
62
|
+
// Initial apply
|
|
63
|
+
this.applyCssVariables(rootElement, config);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public applyPrimaryColorToGlobal(colorInput: string) {
|
|
67
|
+
if (!colorInput) return;
|
|
68
|
+
|
|
69
|
+
let color = colorInput;
|
|
70
|
+
|
|
71
|
+
// Resolve 'default' magic string to developer default
|
|
72
|
+
if (colorInput === 'default') {
|
|
73
|
+
const defaults = this.personalization.developerDefaults();
|
|
74
|
+
color = defaults.primaryColor || 'default';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (color.includes(',')) {
|
|
78
|
+
const parts = color.split(',').map((p) => p.trim());
|
|
79
|
+
const isDark = this._activeTheme() === 'dark-theme';
|
|
80
|
+
color = parts.length >= 2 ? (isDark ? parts[1] : parts[0]) : parts[0];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const root = document.documentElement;
|
|
84
|
+
const overlayContainer = this.overlay.getContainerElement();
|
|
85
|
+
const onPrimary = this.getContrastColor(color);
|
|
86
|
+
|
|
87
|
+
// Standard Material 3 tokens
|
|
88
|
+
root.style.setProperty('--mat-sys-primary', color);
|
|
89
|
+
root.style.setProperty('--mat-sys-on-primary', onPrimary);
|
|
90
|
+
|
|
91
|
+
// Primary Container (using semi-transparent primary as a fallback if no specific logic)
|
|
92
|
+
const primaryContainer = `${color}33`; // 20% opacity
|
|
93
|
+
root.style.setProperty('--mat-sys-primary-container', primaryContainer);
|
|
94
|
+
root.style.setProperty('--mat-sys-on-primary-container', color);
|
|
95
|
+
|
|
96
|
+
overlayContainer.style.setProperty('--mat-sys-primary', color);
|
|
97
|
+
overlayContainer.style.setProperty('--mat-sys-on-primary', onPrimary);
|
|
98
|
+
overlayContainer.style.setProperty('--mat-sys-primary-container', primaryContainer);
|
|
99
|
+
|
|
100
|
+
// Update internal legacy/utility variables
|
|
101
|
+
root.style.setProperty('--primary-color', color);
|
|
102
|
+
root.style.setProperty('--user-message-color', color);
|
|
103
|
+
root.style.setProperty('--user-text-color', onPrimary);
|
|
104
|
+
|
|
105
|
+
overlayContainer.style.setProperty('--primary-color', color);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Simple luminance-based contrast calculation
|
|
110
|
+
* Returns #ffffff for dark colors and #000000 for light colors
|
|
111
|
+
*/
|
|
112
|
+
private getContrastColor(hex: string): string {
|
|
113
|
+
if (!hex || hex.length < 6) return '#ffffff';
|
|
114
|
+
|
|
115
|
+
// Remove # if present
|
|
116
|
+
const cleanHex = hex.replace('#', '');
|
|
117
|
+
const r = parseInt(cleanHex.substring(0, 2), 16);
|
|
118
|
+
const g = parseInt(cleanHex.substring(2, 4), 16);
|
|
119
|
+
const b = parseInt(cleanHex.substring(4, 6), 16);
|
|
120
|
+
|
|
121
|
+
// Calculate luminance (standard formula)
|
|
122
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
123
|
+
|
|
124
|
+
return luminance > 0.6 ? '#000000' : '#ffffff';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
setTheme(mode: ThemeMode): void {
|
|
128
|
+
this.personalization.updateAppearance({ theme: mode });
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private updateActiveTheme(mode: ThemeMode) {
|
|
132
|
+
this.cleanupObservers();
|
|
133
|
+
|
|
134
|
+
if (mode === 'auto') {
|
|
135
|
+
this.handleAutoTheme();
|
|
136
|
+
} else {
|
|
137
|
+
const themeToApply = mode === 'dark' ? 'dark-theme' : 'light-theme';
|
|
138
|
+
this._activeTheme.set(themeToApply);
|
|
139
|
+
this.applyThemeToGlobal(themeToApply);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private handleAutoTheme() {
|
|
144
|
+
// Initial detection
|
|
145
|
+
this.detectAndApplyParentTheme();
|
|
146
|
+
|
|
147
|
+
// Watch for changes in parent
|
|
148
|
+
this.observer = new MutationObserver(() => {
|
|
149
|
+
this.detectAndApplyParentTheme();
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
this.observer.observe(document.documentElement, {
|
|
153
|
+
attributes: true,
|
|
154
|
+
attributeFilter: ['class', 'data-theme'],
|
|
155
|
+
});
|
|
156
|
+
this.observer.observe(document.body, {
|
|
157
|
+
attributes: true,
|
|
158
|
+
attributeFilter: ['class', 'data-theme'],
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private detectAndApplyParentTheme() {
|
|
163
|
+
const isDark = this.isParentDark();
|
|
164
|
+
const newTheme = isDark ? 'dark-theme' : 'light-theme';
|
|
165
|
+
|
|
166
|
+
// Only update if changed to avoid unnecessary DOM updates
|
|
167
|
+
if (this._activeTheme() !== newTheme) {
|
|
168
|
+
this._activeTheme.set(newTheme);
|
|
169
|
+
this.applyThemeToGlobal(newTheme);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private isParentDark(): boolean {
|
|
174
|
+
const body = document.body;
|
|
175
|
+
const html = document.documentElement;
|
|
176
|
+
|
|
177
|
+
// Check for common class names
|
|
178
|
+
const darkClasses = ['dark', 'dark-theme', 'dark-mode', 'night-mode'];
|
|
179
|
+
const hasDarkClass = (el: HTMLElement) => darkClasses.some((c) => el.classList.contains(c));
|
|
180
|
+
|
|
181
|
+
if (hasDarkClass(body) || hasDarkClass(html)) return true;
|
|
182
|
+
|
|
183
|
+
// Check for data-theme attribute
|
|
184
|
+
if (body.getAttribute('data-theme') === 'dark' || html.getAttribute('data-theme') === 'dark')
|
|
185
|
+
return true;
|
|
186
|
+
|
|
187
|
+
// Check for Bootstrap 5.3+ data-bs-theme
|
|
188
|
+
if (
|
|
189
|
+
body.getAttribute('data-bs-theme') === 'dark' ||
|
|
190
|
+
html.getAttribute('data-bs-theme') === 'dark'
|
|
191
|
+
) {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Fallback to system preference
|
|
196
|
+
// return window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
private applyThemeToGlobal(theme: 'light-theme' | 'dark-theme') {
|
|
201
|
+
const overlayContainer = this.overlay.getContainerElement();
|
|
202
|
+
const root = document.documentElement;
|
|
203
|
+
|
|
204
|
+
// Apply to root for global CSS variables (light-dark() support)
|
|
205
|
+
this.renderer.removeClass(root, 'light-theme');
|
|
206
|
+
this.renderer.removeClass(root, 'dark-theme');
|
|
207
|
+
this.renderer.addClass(root, theme);
|
|
208
|
+
|
|
209
|
+
// Also apply to overlay container (for menus/dialogs)
|
|
210
|
+
this.renderer.removeClass(overlayContainer, 'light-theme');
|
|
211
|
+
this.renderer.removeClass(overlayContainer, 'dark-theme');
|
|
212
|
+
this.renderer.addClass(overlayContainer, theme);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
private cleanupObservers() {
|
|
216
|
+
if (this.observer) {
|
|
217
|
+
this.observer.disconnect();
|
|
218
|
+
this.observer = null;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
ngOnDestroy() {
|
|
223
|
+
this.cleanupObservers();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @deprecated Manual CSS variable application is now handled via theme.css tokens
|
|
228
|
+
*/
|
|
229
|
+
public applyCssVariables(element: HTMLElement, config: DoohbotThemeConfig | undefined) {
|
|
230
|
+
if (!config) return;
|
|
231
|
+
|
|
232
|
+
const isDark = this._activeTheme() === 'dark-theme';
|
|
233
|
+
|
|
234
|
+
const applyColor = (input: string | undefined, variableName: string) => {
|
|
235
|
+
if (input) {
|
|
236
|
+
const parts = input.split(',').map((p) => p.trim());
|
|
237
|
+
const colorToUse = parts.length >= 2 ? (isDark ? parts[1] : parts[0]) : parts[0];
|
|
238
|
+
// Apply to Component Host
|
|
239
|
+
element.style.setProperty(`--${variableName}`, colorToUse);
|
|
240
|
+
|
|
241
|
+
// Apply to Overlay Container (for Dialogs/Menus which exist outside host)
|
|
242
|
+
this.overlay.getContainerElement().style.setProperty(`--${variableName}`, colorToUse);
|
|
243
|
+
|
|
244
|
+
// Secondary mapping for specific variables that have derived states
|
|
245
|
+
// if (variableName === 'primary-color') {
|
|
246
|
+
// element.style.setProperty('--user-message-color', colorToUse);
|
|
247
|
+
// element.style.setProperty('--mat-sys-primary', colorToUse);
|
|
248
|
+
// const onPrimary = this.getContrastColor(colorToUse);
|
|
249
|
+
// element.style.setProperty('--user-text-color', onPrimary);
|
|
250
|
+
// element.style.setProperty('--mat-sys-on-primary', onPrimary);
|
|
251
|
+
// }
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
// Font
|
|
256
|
+
if (config.fontFamily) element.style.setProperty('--font-family', config.fontFamily);
|
|
257
|
+
|
|
258
|
+
// Primary & Secondary
|
|
259
|
+
// Handled globally via PersonalizationService/applyPrimaryColorToGlobal to allow user overrides
|
|
260
|
+
// applyColor(config.primaryColor, 'primary-color');
|
|
261
|
+
applyColor(config.secondaryColor, 'secondary-color');
|
|
262
|
+
|
|
263
|
+
// Backgrounds
|
|
264
|
+
applyColor(config.backgroundColor, 'background-color');
|
|
265
|
+
|
|
266
|
+
// Ensure chat input also follows dual mode if provided, or defaults?
|
|
267
|
+
// User only asked for background color "of the entire app".
|
|
268
|
+
applyColor(config.chatInputColor, 'chat-input-color');
|
|
269
|
+
|
|
270
|
+
// Text Colors
|
|
271
|
+
applyColor(config.textAltColor, 'text-alt-color');
|
|
272
|
+
applyColor(config.textColor, 'text-color');
|
|
273
|
+
applyColor(config.secondaryTextColor, 'secondary-text-color');
|
|
274
|
+
applyColor(config.hintTextColor, 'hint-text-color');
|
|
275
|
+
|
|
276
|
+
// Button Colors
|
|
277
|
+
applyColor(config.buttonColor, 'button-color');
|
|
278
|
+
|
|
279
|
+
// Message Colors
|
|
280
|
+
applyColor(config.userMessageColor, 'user-message-color');
|
|
281
|
+
applyColor(config.botMessageColor, 'bot-message-color');
|
|
282
|
+
|
|
283
|
+
// Message Text Colors
|
|
284
|
+
applyColor(config.userTextColor, 'user-text-color');
|
|
285
|
+
applyColor(config.botTextColor, 'bot-text-color');
|
|
286
|
+
|
|
287
|
+
// Borders
|
|
288
|
+
applyColor(config.borderColor, 'border-color');
|
|
289
|
+
applyColor(config.borderShadowColor, 'border-shadow-color');
|
|
290
|
+
applyColor(config.borderTopColor, 'border-top-color');
|
|
291
|
+
|
|
292
|
+
// Indicators
|
|
293
|
+
applyColor(config.typingIndicatorColor, 'typing-indicator-color');
|
|
294
|
+
|
|
295
|
+
// Utility Colors
|
|
296
|
+
applyColor(config.white, 'white');
|
|
297
|
+
applyColor(config.black, 'black');
|
|
298
|
+
applyColor(config.grey, 'grey');
|
|
299
|
+
applyColor(config.red, 'red');
|
|
300
|
+
applyColor(config.yellow, 'yellow');
|
|
301
|
+
applyColor(config.orange, 'orange');
|
|
302
|
+
applyColor(config.green, 'green');
|
|
303
|
+
applyColor(config.blue, 'blue');
|
|
304
|
+
}
|
|
305
|
+
}
|
package/{lib/core/types/auth-mode.type.d.ts → projects/doohbot/src/lib/core/types/auth-mode.type.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Authentication mode for the chatbot
|
|
3
|
-
*/
|
|
4
|
-
export type AuthMode = 'manual' | 'auto';
|
|
1
|
+
/**
|
|
2
|
+
* Authentication mode for the chatbot
|
|
3
|
+
*/
|
|
4
|
+
export type AuthMode = 'manual' | 'auto';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Authentication status
|
|
3
|
-
*/
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Authentication status
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type AuthStatus = 'authenticated' | 'unauthenticated' | 'expired';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Chat stream type
|
|
3
|
-
*/
|
|
4
|
-
export type ChatStream = 'chunk' | 'complete' | 'error';
|
|
1
|
+
/**
|
|
2
|
+
* Chat stream type
|
|
3
|
+
*/
|
|
4
|
+
export type ChatStream = 'chunk' | 'complete' | 'error';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Message role types for chat messages
|
|
3
|
-
*/
|
|
4
|
-
export type MessageRole = 'user' | 'assistant';
|
|
1
|
+
/**
|
|
2
|
+
* Message role types for chat messages
|
|
3
|
+
*/
|
|
4
|
+
export type MessageRole = 'user' | 'assistant';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prompt mode
|
|
3
|
-
*/
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Prompt mode
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type PromptMode = 'markdown' | 'plain';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error types for snackbar
|
|
3
|
-
*/
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Error types for snackbar
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type SnackBarError = 'warn' | 'error' | 'success' | 'info';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tenant resolution strategy
|
|
3
|
-
*/
|
|
4
|
-
export type TenantResolutionStrategy = 'static' | 'dynamic' | 'callback';
|
|
1
|
+
/**
|
|
2
|
+
* Tenant resolution strategy
|
|
3
|
+
*/
|
|
4
|
+
export type TenantResolutionStrategy = 'static' | 'dynamic' | 'callback';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HttpErrorResponse } from '@angular/common/http';
|
|
2
|
+
|
|
3
|
+
export class ErrorHandlerUtil {
|
|
4
|
+
/**
|
|
5
|
+
* Maps an error to a user-friendly message
|
|
6
|
+
*/
|
|
7
|
+
public static handleError(error: any): string {
|
|
8
|
+
if (error instanceof HttpErrorResponse) {
|
|
9
|
+
switch (error.status) {
|
|
10
|
+
case 401:
|
|
11
|
+
return 'Unauthorized. Please check your credentials.';
|
|
12
|
+
case 403:
|
|
13
|
+
return 'Forbidden. You do not have permission to perform this action.';
|
|
14
|
+
case 404:
|
|
15
|
+
return 'The requested resource was not found.';
|
|
16
|
+
case 429:
|
|
17
|
+
return 'Too many requests. Please try again later.';
|
|
18
|
+
case 500:
|
|
19
|
+
return 'Internal server error. Please try again later.';
|
|
20
|
+
default:
|
|
21
|
+
return error.error?.message || 'An unexpected error occurred.';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (error instanceof Error) {
|
|
26
|
+
return error.message;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return 'An unexpected error occurred.';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { isDevMode } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
class Logger {
|
|
4
|
+
private static prefix = '[Doohbot]';
|
|
5
|
+
|
|
6
|
+
// 🎨 Color styles
|
|
7
|
+
private static styles = {
|
|
8
|
+
log: 'color:#2196f3; font-weight:500',
|
|
9
|
+
info: 'color:#4caf50; font-weight:500',
|
|
10
|
+
warn: 'color:#ff9800; font-weight:600',
|
|
11
|
+
error: 'color:#f44336; font-weight:700',
|
|
12
|
+
debug: 'color:#9c27b0; font-weight:500',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
private static canLog(): boolean {
|
|
16
|
+
return isDevMode();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static log(message: string, ...args: any[]): void {
|
|
20
|
+
if (!this.canLog()) return;
|
|
21
|
+
console.log(`%c${this.prefix} ${message}`, this.styles.log, ...args);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static info(message: string, ...args: any[]): void {
|
|
25
|
+
if (!this.canLog()) return;
|
|
26
|
+
console.info(`%c${this.prefix} ${message}`, this.styles.info, ...args);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static warn(message: string, ...args: any[]): void {
|
|
30
|
+
if (!this.canLog()) return;
|
|
31
|
+
console.warn(`%c${this.prefix} ${message}`, this.styles.warn, ...args);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static error(message: string, ...args: any[]): void {
|
|
35
|
+
if (!this.canLog()) return;
|
|
36
|
+
console.error(`%c${this.prefix} ${message}`, this.styles.error, ...args);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static debug(message: string, ...args: any[]): void {
|
|
40
|
+
if (!this.canLog()) return;
|
|
41
|
+
console.debug(`%c${this.prefix} ${message}`, this.styles.debug, ...args);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default Logger;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class DoohbotInput {
|
|
2
|
+
username = '';
|
|
3
|
+
password = '';
|
|
4
|
+
rememberMe?: boolean = false;
|
|
5
|
+
authToken?: string;
|
|
6
|
+
license?: string = '';
|
|
7
|
+
licenseCode?: string = '';
|
|
8
|
+
licenseKey?: string = '';
|
|
9
|
+
licenseFilePath?: string = '';
|
|
10
|
+
apiBaseUrl?: string = '';
|
|
11
|
+
apiSegment?: string = '';
|
|
12
|
+
tenancyName?: string = '';
|
|
13
|
+
storageKey?: string = '';
|
|
14
|
+
secretKey?: string = '';
|
|
15
|
+
companyCode?: string = '';
|
|
16
|
+
buttonStyle?: 'fab' | 'sidebar' | 'sidebar-top' | 'sidebar-bottom';
|
|
17
|
+
primaryColor?: string = '';
|
|
18
|
+
accentColor?: string = '';
|
|
19
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<app-chat-button [buttonStyle]="activeButtonStyle()" [isChatOpen]="isChatOpen()" [unreadCount]="unreadCount()"
|
|
2
|
+
[appTitle]="DoohbotConst.appTitle" [appLogoUrl]="DoohbotConst.appLogo" [appTextLogoUrl]="DoohbotConst.appTextLogo"
|
|
3
|
+
(toggle)="toggleChat()"></app-chat-button>
|
|
4
|
+
|
|
5
|
+
@if (isChatOpen()) {
|
|
6
|
+
<app-chat-window appFullscreen [isChatOpen]="isChatOpen()" [enableDrag]="enableDrag" [enableResize]="enableResize"
|
|
7
|
+
[isFullScreen]="isFullScreen()" [appTitle]="DoohbotConst.appTitle" [appLogoUrl]="DoohbotConst.appLogo"
|
|
8
|
+
[appTextLogoUrl]="DoohbotConst.appTextLogo" [appHeaderLogoUrl]="DoohbotConst.appHeaderLogo" [messages]="messages()"
|
|
9
|
+
[isBotTyping]="isBotTyping()" [isStreaming]="isStreaming()" [appSubtitle]="DoohbotConst.appSubtitle"
|
|
10
|
+
[welcomeDesc]="DoohbotConst.welcomeDescription" [predefinedMessages]="predefinedMessages"
|
|
11
|
+
[suggestedMessages]="suggestedMessages" [botAvatarUrl]="DoohbotConst.botAvatar"
|
|
12
|
+
[userAvatarUrl]="DoohbotConst.userAvatar" [userName]="userName" [trackByMessageId]="trackByMessageId"
|
|
13
|
+
[hintText]="DoohbotConst.hintText" [messageError]="messageError()" [showSuggestionChips]="showSuggestionChips()"
|
|
14
|
+
[buttonStyle]="activeButtonStyle()" [isHistorySidebarOpen]="isHistorySidebarOpen()" [chatSessions]="chatSessions()"
|
|
15
|
+
[isLoadingSessions]="isLoadingSessions()" [processingSessionId]="processingSessionId()"
|
|
16
|
+
[hasMoreSessions]="hasMoreHistory()" [isLoadingMoreSessions]="isLoadingMore()" [chatHistoryUserName]="userName"
|
|
17
|
+
[isLoggingIn]="isLoggingIn()" [isAuthenticated]="isAuthenticated()" [authError]="authError()"
|
|
18
|
+
[authSuccess]="authSuccess()" (toggleChat)="toggleChat()" (loginSubmit)="onNormalLogin($event)"
|
|
19
|
+
(toggleFullScreen)="toggleFullScreen()" (toggleHistorySidebar)="toggleHistorySidebar()"
|
|
20
|
+
(sessionSelected)="loadChatSession($event)" (sessionDeleted)="deleteSession($event)"
|
|
21
|
+
(sessionRenamed)="renameSession($event)" (loadMoreSessions)="loadMoreHistory()" (refreshSessions)="refreshHistory()"
|
|
22
|
+
(suggestionClick)="sendMessage($event)" (send)="sendMessage($event)" (stop)="onStopRequest()"
|
|
23
|
+
(clearMessageError)="clearMessageError()" (clearChat)="clearChat()" (deleteAllSessions)="deleteAllSessions()"
|
|
24
|
+
(logout)="performLogout()"></app-chat-window>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
<!-- Skeleton Loader while auth is unknown or refreshing -->
|
|
28
|
+
<!-- @if (isChatOpen() && (authStatus() === 'expired')) {
|
|
29
|
+
<div class="auth-loading-skeleton">
|
|
30
|
+
<div class="skeleton-header"></div>
|
|
31
|
+
<div class="skeleton-messages"></div>
|
|
32
|
+
<div class="skeleton-input"></div>
|
|
33
|
+
</div>
|
|
34
|
+
} -->
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@use '@angular/material' as mat;
|
|
2
|
+
@use './styles/material-override' as *;
|
|
3
|
+
@use './styles/theme' as *;
|
|
4
|
+
|
|
5
|
+
// Global base styles (since encapsulation is None, these apply globally)
|
|
6
|
+
html,
|
|
7
|
+
body {
|
|
8
|
+
height: 100%;
|
|
9
|
+
margin: 0;
|
|
10
|
+
color-scheme: light dark;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
body {
|
|
14
|
+
font-family: Roboto, 'Helvetica Neue', sans-serif;
|
|
15
|
+
color: var(--mat-sys-on-background);
|
|
16
|
+
background-color: var(--mat-sys-background);
|
|
17
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { Doohbot } from './doohbot.component';
|
|
3
|
+
import { ThemeService } from './core/services/theme.service';
|
|
4
|
+
import { signal } from '@angular/core';
|
|
5
|
+
|
|
6
|
+
describe('Doohbot', () => {
|
|
7
|
+
let component: Doohbot;
|
|
8
|
+
let fixture: ComponentFixture<Doohbot>;
|
|
9
|
+
let themeServiceMock: any;
|
|
10
|
+
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
themeServiceMock = {
|
|
13
|
+
activeTheme: signal('light-theme'),
|
|
14
|
+
setTheme: jasmine.createSpy('setTheme'),
|
|
15
|
+
theme: signal('system'),
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
await TestBed.configureTestingModule({
|
|
19
|
+
imports: [Doohbot],
|
|
20
|
+
providers: [{ provide: ThemeService, useValue: themeServiceMock }],
|
|
21
|
+
}).compileComponents();
|
|
22
|
+
|
|
23
|
+
fixture = TestBed.createComponent(Doohbot);
|
|
24
|
+
component = fixture.componentInstance;
|
|
25
|
+
fixture.detectChanges();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should create', () => {
|
|
29
|
+
expect(component).toBeTruthy();
|
|
30
|
+
});
|
|
31
|
+
});
|