@aakash58/chatbot 1.1.19 → 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.
Files changed (351) hide show
  1. package/.editorconfig +17 -0
  2. package/.vscode/extensions.json +4 -0
  3. package/.vscode/launch.json +41 -0
  4. package/.vscode/settings.json +14 -0
  5. package/.vscode/tasks.json +60 -0
  6. package/README.md +298 -22
  7. package/angular.json +132 -0
  8. package/docs/PUBLISHING_GUIDE.md +104 -0
  9. package/package.json +75 -29
  10. package/projects/app-doohbot/public/assets/const/app-const.json +15 -0
  11. package/projects/app-doohbot/public/assets/const/doohclick_license.json +6 -0
  12. package/projects/app-doohbot/public/favicon.ico +0 -0
  13. package/projects/app-doohbot/src/app/app.config.ts +13 -0
  14. package/projects/app-doohbot/src/app/app.html +31 -0
  15. package/projects/app-doohbot/src/app/app.routes.ts +3 -0
  16. package/projects/app-doohbot/src/app/app.scss +279 -0
  17. package/projects/app-doohbot/src/app/app.spec.ts +23 -0
  18. package/projects/app-doohbot/src/app/app.ts +72 -0
  19. package/projects/app-doohbot/src/index.html +15 -0
  20. package/projects/app-doohbot/src/main.ts +6 -0
  21. package/projects/app-doohbot/src/styles.scss +15 -0
  22. package/projects/app-doohbot/tsconfig.app.json +15 -0
  23. package/projects/app-doohbot/tsconfig.spec.json +14 -0
  24. package/projects/doohbot/README.md +64 -0
  25. package/projects/doohbot/docs/README.md +140 -0
  26. package/projects/doohbot/ng-package.json +10 -0
  27. package/projects/doohbot/package.json +16 -0
  28. package/projects/doohbot/src/lib/app/chat/chat-ui-state.service.ts +194 -0
  29. package/projects/doohbot/src/lib/app/chat/chat.service.ts +547 -0
  30. package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.html +27 -0
  31. package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.scss +115 -0
  32. package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.ts +35 -0
  33. package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.html +3 -0
  34. package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.scss +20 -0
  35. package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.ts +12 -0
  36. package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.html +34 -0
  37. package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.scss +78 -0
  38. package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.ts +52 -0
  39. package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.html +77 -0
  40. package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.scss +346 -0
  41. package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.ts +188 -0
  42. package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.html +146 -0
  43. package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.scss +187 -0
  44. package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.ts +256 -0
  45. package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.html +17 -0
  46. package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.scss +59 -0
  47. package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.ts +28 -0
  48. package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.html +138 -0
  49. package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.scss +436 -0
  50. package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.ts +106 -0
  51. package/projects/doohbot/src/lib/app/chat/model/chat-history.model.ts +57 -0
  52. package/projects/doohbot/src/lib/app/chat/model/chat-request.model.ts +17 -0
  53. package/projects/doohbot/src/lib/app/chat/model/chat-response.model.ts +9 -0
  54. package/projects/doohbot/src/lib/app/chat/model/chat-session.model.ts +14 -0
  55. 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
  56. package/projects/doohbot/src/lib/app/chat/model/chat-stream-response.model.ts +12 -0
  57. package/projects/doohbot/src/lib/app/chat/services/chat-api.service.ts +82 -0
  58. package/projects/doohbot/src/lib/app/chat/services/chat-audio.service.ts +44 -0
  59. package/projects/doohbot/src/lib/app/chat/services/chat-history.service.ts +303 -0
  60. package/projects/doohbot/src/lib/app/login/login-form.component.html +80 -0
  61. package/projects/doohbot/src/lib/app/login/login-form.component.scss +189 -0
  62. package/projects/doohbot/src/lib/app/login/login-form.component.ts +45 -0
  63. package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.html +81 -0
  64. package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.scss +179 -0
  65. package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.ts +217 -0
  66. package/projects/doohbot/src/lib/app/personalization/personalization.service.ts +197 -0
  67. package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.html +111 -0
  68. package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.scss +218 -0
  69. package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.ts +121 -0
  70. package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.html +46 -0
  71. package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.scss +138 -0
  72. package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.ts +28 -0
  73. package/projects/doohbot/src/lib/app/personalization/sections/preferences/color-picker-dialog.component.ts +92 -0
  74. package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.html +198 -0
  75. package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.scss +107 -0
  76. package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.ts +103 -0
  77. package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.html +46 -0
  78. package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.scss +131 -0
  79. package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.ts +23 -0
  80. package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.html +33 -0
  81. package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.scss +61 -0
  82. package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.ts +20 -0
  83. package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.html +30 -0
  84. package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.scss +59 -0
  85. package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.ts +12 -0
  86. package/projects/doohbot/src/lib/constant/doohbot-constant.ts +40 -0
  87. package/projects/doohbot/src/lib/constant/html-entities.ts +8 -0
  88. package/projects/doohbot/src/lib/constant/utf8.ts +9 -0
  89. package/projects/doohbot/src/lib/core/app-const.ts +63 -0
  90. package/projects/doohbot/src/lib/core/auth/account-api.service.ts +53 -0
  91. package/projects/doohbot/src/lib/core/auth/auth.service.ts +478 -0
  92. package/projects/doohbot/src/lib/core/auth/models/auth-result.model.ts +4 -0
  93. package/projects/doohbot/src/lib/core/auth/models/federated-login-request.model.ts +5 -0
  94. package/projects/doohbot/src/lib/core/auth/models/login-request.model.ts +6 -0
  95. package/projects/doohbot/src/lib/core/auth/storage.service.ts +113 -0
  96. package/projects/doohbot/src/lib/core/directives/draggable/draggable-dialog.directive.ts +123 -0
  97. package/projects/doohbot/src/lib/core/directives/draggable/draggable-dialog.module.ts +9 -0
  98. package/projects/doohbot/src/lib/core/directives/fullscreen/fullscreen.directive.ts +58 -0
  99. package/projects/doohbot/src/lib/core/directives/fullscreen/fullscreen.module.ts +9 -0
  100. package/projects/doohbot/src/lib/core/directives/popout/popout.directive.ts +169 -0
  101. package/projects/doohbot/src/lib/core/directives/popout/popout.module.ts +9 -0
  102. package/projects/doohbot/src/lib/core/directives/resizable/resizable-dialog.directive.ts +197 -0
  103. package/projects/doohbot/src/lib/core/directives/resizable/resizable-dialog.module.ts +9 -0
  104. package/projects/doohbot/src/lib/core/enums/api-request-state.enum.ts +9 -0
  105. package/projects/doohbot/src/lib/core/environments/environment.prod.ts +14 -0
  106. package/projects/doohbot/src/lib/core/environments/environment.ts +14 -0
  107. package/projects/doohbot/src/lib/core/helpers/crypto-helper.service.ts +72 -0
  108. package/projects/doohbot/src/lib/core/http/http-stream.service.ts +105 -0
  109. package/projects/doohbot/src/lib/core/http/http.service.ts +148 -0
  110. package/projects/doohbot/src/lib/core/interceptors/auth.interceptor.ts +118 -0
  111. package/projects/doohbot/src/lib/core/interceptors/license.interceptor.ts +50 -0
  112. package/projects/doohbot/src/lib/core/models/api-config.model.ts +82 -0
  113. package/projects/doohbot/src/lib/core/models/api-request.model.ts +92 -0
  114. package/projects/doohbot/src/lib/core/models/api-response.model.ts +13 -0
  115. package/projects/doohbot/src/lib/core/models/doohbot-config.model.ts +109 -0
  116. package/{lib/core/models/license.model.d.ts → projects/doohbot/src/lib/core/models/license.model.ts} +27 -23
  117. package/projects/doohbot/src/lib/core/models/message.ts +18 -0
  118. package/projects/doohbot/src/lib/core/models/theme-config.model.ts +48 -0
  119. package/projects/doohbot/src/lib/core/services/core-config.service.ts +53 -0
  120. package/projects/doohbot/src/lib/core/services/doohbot-api.service.ts +207 -0
  121. package/projects/doohbot/src/lib/core/services/license.service.ts +171 -0
  122. package/projects/doohbot/src/lib/core/services/markdown.service.ts +73 -0
  123. package/projects/doohbot/src/lib/core/services/theme.service.ts +305 -0
  124. package/{lib/core/types/auth-mode.type.d.ts → projects/doohbot/src/lib/core/types/auth-mode.type.ts} +4 -4
  125. package/{lib/core/types/auth-status.type.d.ts → projects/doohbot/src/lib/core/types/auth-status.type.ts} +5 -4
  126. package/{lib/core/types/chat-stream.type.d.ts → projects/doohbot/src/lib/core/types/chat-stream.type.ts} +4 -4
  127. package/{lib/core/types/message-role.type.d.ts → projects/doohbot/src/lib/core/types/message-role.type.ts} +4 -4
  128. package/{lib/core/types/prompt-mode.type.d.ts → projects/doohbot/src/lib/core/types/prompt-mode.type.ts} +5 -4
  129. package/{lib/core/types/snackbar-error.type.d.ts → projects/doohbot/src/lib/core/types/snackbar-error.type.ts} +5 -4
  130. package/{lib/core/types/tenant-resolution-strategy.type.d.ts → projects/doohbot/src/lib/core/types/tenant-resolution-strategy.type.ts} +4 -4
  131. package/projects/doohbot/src/lib/core/utils/error-handler.util.ts +31 -0
  132. package/projects/doohbot/src/lib/core/utils/logger.service.ts +45 -0
  133. package/projects/doohbot/src/lib/doohbot-input.ts +19 -0
  134. package/projects/doohbot/src/lib/doohbot.component.html +34 -0
  135. package/projects/doohbot/src/lib/doohbot.component.scss +17 -0
  136. package/projects/doohbot/src/lib/doohbot.component.spec.ts +31 -0
  137. package/projects/doohbot/src/lib/doohbot.component.ts +545 -0
  138. package/projects/doohbot/src/lib/elements.ts +25 -0
  139. package/projects/doohbot/src/lib/predefined_messages.ts +14 -0
  140. package/projects/doohbot/src/lib/shared/chips/chips.component.html +9 -0
  141. package/projects/doohbot/src/lib/shared/chips/chips.component.scss +29 -0
  142. package/projects/doohbot/src/lib/shared/chips/chips.component.spec.ts +22 -0
  143. package/projects/doohbot/src/lib/shared/chips/chips.component.ts +20 -0
  144. package/projects/doohbot/src/lib/shared/dialog/dialog.component.html +29 -0
  145. package/projects/doohbot/src/lib/shared/dialog/dialog.component.scss +100 -0
  146. package/projects/doohbot/src/lib/shared/dialog/dialog.component.ts +42 -0
  147. package/projects/doohbot/src/lib/shared/dialog/dialog.service.ts +62 -0
  148. package/projects/doohbot/src/lib/shared/dialog/dialog.utils.ts +102 -0
  149. package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.html +30 -0
  150. package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.scss +53 -0
  151. package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.spec.ts +22 -0
  152. package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.ts +35 -0
  153. package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.html +16 -0
  154. package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.scss +45 -0
  155. package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.ts +46 -0
  156. package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.html +5 -0
  157. package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.scss +0 -0
  158. package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.spec.ts +22 -0
  159. package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.ts +20 -0
  160. package/projects/doohbot/src/lib/shared/pipes/simple-markdown.pipe.ts +19 -0
  161. package/projects/doohbot/src/lib/shared/popout/popout.html +1 -0
  162. package/projects/doohbot/src/lib/shared/popout/popout.scss +0 -0
  163. package/projects/doohbot/src/lib/shared/popout/popout.spec.ts +23 -0
  164. package/projects/doohbot/src/lib/shared/popout/popout.ts +11 -0
  165. package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.html +7 -0
  166. package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.scss +125 -0
  167. package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.spec.ts +21 -0
  168. package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.ts +44 -0
  169. package/projects/doohbot/src/lib/shared/snackbar/snackbar.service.ts +54 -0
  170. package/{lib/shared/snackbar/snackbar.utils.d.ts → projects/doohbot/src/lib/shared/snackbar/snackbar.utils.ts} +49 -33
  171. package/projects/doohbot/src/lib/styles/_theme.scss +132 -0
  172. package/projects/doohbot/src/lib/styles/material-override.scss +302 -0
  173. package/projects/doohbot/src/lib/styles/utility.scss +588 -0
  174. package/projects/doohbot/src/public-api.ts +42 -0
  175. package/projects/doohbot/tsconfig.lib.json +15 -0
  176. package/projects/doohbot/tsconfig.lib.prod.json +11 -0
  177. package/projects/doohbot/tsconfig.spec.json +10 -0
  178. package/proxy.conf.json +8 -0
  179. package/publish.config.js +25 -0
  180. package/scripts/publishing/index.ts +67 -0
  181. package/scripts/publishing/pipeline/01-clean.ts +11 -0
  182. package/scripts/publishing/pipeline/02-validate-pre.ts +8 -0
  183. package/scripts/publishing/pipeline/03-build.ts +7 -0
  184. package/scripts/publishing/pipeline/04-validate-post.ts +8 -0
  185. package/scripts/publishing/pipeline/05-prepare-package.ts +29 -0
  186. package/scripts/publishing/pipeline/06-version.ts +23 -0
  187. package/scripts/publishing/pipeline/07-publish.ts +14 -0
  188. package/scripts/publishing/pipeline/08-cleanup.ts +5 -0
  189. package/scripts/publishing/types.ts +36 -0
  190. package/scripts/publishing/utils/command.ts +15 -0
  191. package/scripts/publishing/utils/config.ts +17 -0
  192. package/scripts/validate.ts +166 -0
  193. package/tsconfig.json +45 -0
  194. package/tsconfig.scripts.json +15 -0
  195. package/esm2022/aakash58-chatbot.mjs +0 -5
  196. package/esm2022/lib/app/chat/chat-ui-state.service.mjs +0 -170
  197. package/esm2022/lib/app/chat/chat.service.mjs +0 -445
  198. package/esm2022/lib/app/chat/components/chat-button/chat-button.component.mjs +0 -50
  199. package/esm2022/lib/app/chat/components/chat-footer/chat-footer.component.mjs +0 -12
  200. package/esm2022/lib/app/chat/components/chat-header/chat-header.component.mjs +0 -66
  201. package/esm2022/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.mjs +0 -186
  202. package/esm2022/lib/app/chat/components/chat-window/chat-window.component.mjs +0 -312
  203. package/esm2022/lib/app/chat/components/message-input/message-input.component.mjs +0 -36
  204. package/esm2022/lib/app/chat/components/message-list/message-list.component.mjs +0 -115
  205. package/esm2022/lib/app/chat/model/chat-history.model.mjs +0 -2
  206. package/esm2022/lib/app/chat/model/chat-request.model.mjs +0 -2
  207. package/esm2022/lib/app/chat/model/chat-response.model.mjs +0 -2
  208. package/esm2022/lib/app/chat/model/chat-session.model.mjs +0 -2
  209. package/esm2022/lib/app/chat/model/chat-stream-message.model.mjs +0 -2
  210. package/esm2022/lib/app/chat/model/chat-stream-response.model.mjs +0 -2
  211. package/esm2022/lib/app/chat/services/chat-api.service.mjs +0 -61
  212. package/esm2022/lib/app/chat/services/chat-audio.service.mjs +0 -50
  213. package/esm2022/lib/app/chat/services/chat-history.service.mjs +0 -252
  214. package/esm2022/lib/app/login/login-form.component.mjs +0 -46
  215. package/esm2022/lib/app/personalization/personalization-dialog.component.mjs +0 -194
  216. package/esm2022/lib/app/personalization/personalization.service.mjs +0 -149
  217. package/esm2022/lib/app/personalization/sections/account/account-section.component.mjs +0 -122
  218. package/esm2022/lib/app/personalization/sections/preferences/color-picker-dialog.component.mjs +0 -86
  219. package/esm2022/lib/app/personalization/sections/preferences/preferences-section.component.mjs +0 -115
  220. package/esm2022/lib/app/personalization/sections/profile/profile-section.component.mjs +0 -29
  221. package/esm2022/lib/app/personalization/sections/settings/setting-section.component.mjs +0 -30
  222. package/esm2022/lib/app/personalization/sections/terms/terms-section.component.mjs +0 -12
  223. package/esm2022/lib/constant/doohbot-constant.mjs +0 -28
  224. package/esm2022/lib/constant/html-entities.mjs +0 -9
  225. package/esm2022/lib/constant/utf8.mjs +0 -10
  226. package/esm2022/lib/core/app-const.mjs +0 -61
  227. package/esm2022/lib/core/auth/account-api.service.mjs +0 -40
  228. package/esm2022/lib/core/auth/auth.service.mjs +0 -391
  229. package/esm2022/lib/core/auth/models/auth-result.model.mjs +0 -3
  230. package/esm2022/lib/core/auth/models/federated-login-request.model.mjs +0 -6
  231. package/esm2022/lib/core/auth/models/login-request.model.mjs +0 -6
  232. package/esm2022/lib/core/auth/storage.service.mjs +0 -110
  233. package/esm2022/lib/core/directives/draggable/draggable-dialog.directive.mjs +0 -112
  234. package/esm2022/lib/core/directives/fullscreen/fullscreen.directive.mjs +0 -55
  235. package/esm2022/lib/core/directives/resizable/resizable-dialog.directive.mjs +0 -179
  236. package/esm2022/lib/core/environments/environment.mjs +0 -15
  237. package/esm2022/lib/core/environments/environment.prod.mjs +0 -15
  238. package/esm2022/lib/core/helpers/crypto-helper.service.mjs +0 -52
  239. package/esm2022/lib/core/http/http-stream.service.mjs +0 -97
  240. package/esm2022/lib/core/http/http.service.mjs +0 -103
  241. package/esm2022/lib/core/interceptors/auth.interceptor.mjs +0 -96
  242. package/esm2022/lib/core/interceptors/license.interceptor.mjs +0 -44
  243. package/esm2022/lib/core/models/api-config.model.mjs +0 -18
  244. package/esm2022/lib/core/models/api-request.model.mjs +0 -2
  245. package/esm2022/lib/core/models/api-response.model.mjs +0 -8
  246. package/esm2022/lib/core/models/doohbot-config.model.mjs +0 -18
  247. package/esm2022/lib/core/models/license.model.mjs +0 -2
  248. package/esm2022/lib/core/models/message.mjs +0 -2
  249. package/esm2022/lib/core/models/theme-config.model.mjs +0 -2
  250. package/esm2022/lib/core/services/core-config.service.mjs +0 -52
  251. package/esm2022/lib/core/services/license.service.mjs +0 -145
  252. package/esm2022/lib/core/services/markdown.service.mjs +0 -64
  253. package/esm2022/lib/core/services/theme.service.mjs +0 -248
  254. package/esm2022/lib/core/types/auth-mode.type.mjs +0 -2
  255. package/esm2022/lib/core/types/auth-status.type.mjs +0 -5
  256. package/esm2022/lib/core/types/chat-stream.type.mjs +0 -2
  257. package/esm2022/lib/core/types/message-role.type.mjs +0 -2
  258. package/esm2022/lib/core/types/prompt-mode.type.mjs +0 -5
  259. package/esm2022/lib/core/types/snackbar-error.type.mjs +0 -5
  260. package/esm2022/lib/core/types/tenant-resolution-strategy.type.mjs +0 -2
  261. package/esm2022/lib/core/utils/logger.service.mjs +0 -42
  262. package/esm2022/lib/doohbot-input.mjs +0 -20
  263. package/esm2022/lib/doohbot.component.mjs +0 -444
  264. package/esm2022/lib/predefined_messages.mjs +0 -15
  265. package/esm2022/lib/shared/chips/chips.component.mjs +0 -28
  266. package/esm2022/lib/shared/dialog/dialog.component.mjs +0 -36
  267. package/esm2022/lib/shared/dialog/dialog.service.mjs +0 -64
  268. package/esm2022/lib/shared/dialog/dialog.utils.mjs +0 -85
  269. package/esm2022/lib/shared/dropdown-menu/dropdown-menu.component.mjs +0 -29
  270. package/esm2022/lib/shared/input-dialog/input-dialog.component.mjs +0 -38
  271. package/esm2022/lib/shared/menu-item/menu-item.component.mjs +0 -24
  272. package/esm2022/lib/shared/pipes/simple-markdown.pipe.mjs +0 -27
  273. package/esm2022/lib/shared/snackbar/snackbar.component.mjs +0 -43
  274. package/esm2022/lib/shared/snackbar/snackbar.service.mjs +0 -46
  275. package/esm2022/lib/shared/snackbar/snackbar.utils.mjs +0 -43
  276. package/esm2022/public-api.mjs +0 -37
  277. package/fesm2022/aakash58-chatbot.mjs +0 -5193
  278. package/fesm2022/aakash58-chatbot.mjs.map +0 -1
  279. package/index.d.ts +0 -5
  280. package/lib/app/chat/chat-ui-state.service.d.ts +0 -96
  281. package/lib/app/chat/chat.service.d.ts +0 -88
  282. package/lib/app/chat/components/chat-button/chat-button.component.d.ts +0 -16
  283. package/lib/app/chat/components/chat-footer/chat-footer.component.d.ts +0 -5
  284. package/lib/app/chat/components/chat-header/chat-header.component.d.ts +0 -24
  285. package/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.d.ts +0 -49
  286. package/lib/app/chat/components/chat-window/chat-window.component.d.ts +0 -107
  287. package/lib/app/chat/components/message-input/message-input.component.d.ts +0 -12
  288. package/lib/app/chat/components/message-list/message-list.component.d.ts +0 -40
  289. package/lib/app/chat/model/chat-history.model.d.ts +0 -51
  290. package/lib/app/chat/model/chat-request.model.d.ts +0 -10
  291. package/lib/app/chat/model/chat-response.model.d.ts +0 -9
  292. package/lib/app/chat/model/chat-session.model.d.ts +0 -12
  293. package/lib/app/chat/model/chat-stream-response.model.d.ts +0 -10
  294. package/lib/app/chat/services/chat-api.service.d.ts +0 -30
  295. package/lib/app/chat/services/chat-audio.service.d.ts +0 -19
  296. package/lib/app/chat/services/chat-history.service.d.ts +0 -53
  297. package/lib/app/login/login-form.component.d.ts +0 -20
  298. package/lib/app/personalization/personalization-dialog.component.d.ts +0 -53
  299. package/lib/app/personalization/personalization.service.d.ts +0 -66
  300. package/lib/app/personalization/sections/account/account-section.component.d.ts +0 -30
  301. package/lib/app/personalization/sections/preferences/color-picker-dialog.component.d.ts +0 -17
  302. package/lib/app/personalization/sections/preferences/preferences-section.component.d.ts +0 -27
  303. package/lib/app/personalization/sections/profile/profile-section.component.d.ts +0 -17
  304. package/lib/app/personalization/sections/settings/setting-section.component.d.ts +0 -10
  305. package/lib/app/personalization/sections/terms/terms-section.component.d.ts +0 -5
  306. package/lib/constant/doohbot-constant.d.ts +0 -12
  307. package/lib/constant/html-entities.d.ts +0 -8
  308. package/lib/constant/utf8.d.ts +0 -9
  309. package/lib/core/app-const.d.ts +0 -11
  310. package/lib/core/auth/account-api.service.d.ts +0 -20
  311. package/lib/core/auth/auth.service.d.ts +0 -90
  312. package/lib/core/auth/models/auth-result.model.d.ts +0 -4
  313. package/lib/core/auth/models/federated-login-request.model.d.ts +0 -5
  314. package/lib/core/auth/models/login-request.model.d.ts +0 -6
  315. package/lib/core/auth/storage.service.d.ts +0 -21
  316. package/lib/core/directives/draggable/draggable-dialog.directive.d.ts +0 -23
  317. package/lib/core/directives/fullscreen/fullscreen.directive.d.ts +0 -14
  318. package/lib/core/directives/resizable/resizable-dialog.directive.d.ts +0 -30
  319. package/lib/core/environments/environment.d.ts +0 -7
  320. package/lib/core/environments/environment.prod.d.ts +0 -7
  321. package/lib/core/helpers/crypto-helper.service.d.ts +0 -12
  322. package/lib/core/http/http-stream.service.d.ts +0 -18
  323. package/lib/core/http/http.service.d.ts +0 -20
  324. package/lib/core/interceptors/auth.interceptor.d.ts +0 -18
  325. package/lib/core/interceptors/license.interceptor.d.ts +0 -11
  326. package/lib/core/models/api-config.model.d.ts +0 -58
  327. package/lib/core/models/api-request.model.d.ts +0 -77
  328. package/lib/core/models/api-response.model.d.ts +0 -6
  329. package/lib/core/models/doohbot-config.model.d.ts +0 -81
  330. package/lib/core/models/message.d.ts +0 -16
  331. package/lib/core/models/theme-config.model.d.ts +0 -28
  332. package/lib/core/services/core-config.service.d.ts +0 -23
  333. package/lib/core/services/license.service.d.ts +0 -33
  334. package/lib/core/services/markdown.service.d.ts +0 -8
  335. package/lib/core/services/theme.service.d.ts +0 -40
  336. package/lib/core/utils/logger.service.d.ts +0 -11
  337. package/lib/doohbot-input.d.ts +0 -19
  338. package/lib/doohbot.component.d.ts +0 -108
  339. package/lib/predefined_messages.d.ts +0 -2
  340. package/lib/shared/chips/chips.component.d.ts +0 -10
  341. package/lib/shared/dialog/dialog.component.d.ts +0 -19
  342. package/lib/shared/dialog/dialog.service.d.ts +0 -29
  343. package/lib/shared/dialog/dialog.utils.d.ts +0 -41
  344. package/lib/shared/dropdown-menu/dropdown-menu.component.d.ts +0 -11
  345. package/lib/shared/input-dialog/input-dialog.component.d.ts +0 -20
  346. package/lib/shared/menu-item/menu-item.component.d.ts +0 -9
  347. package/lib/shared/pipes/simple-markdown.pipe.d.ts +0 -10
  348. package/lib/shared/snackbar/snackbar.component.d.ts +0 -14
  349. package/lib/shared/snackbar/snackbar.service.d.ts +0 -19
  350. package/public-api.d.ts +0 -11
  351. /package/{src → projects/doohbot/src}/assets/bot.mp3 +0 -0
@@ -0,0 +1,72 @@
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
+ }
@@ -0,0 +1,105 @@
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
+ }
@@ -0,0 +1,148 @@
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
+ }
@@ -0,0 +1,118 @@
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
+ }
@@ -0,0 +1,50 @@
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
+ }
@@ -0,0 +1,82 @@
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
+ });
@@ -0,0 +1,92 @@
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
+ }
@@ -0,0 +1,13 @@
1
+ export class ApiResponse<T> {
2
+ success!: boolean;
3
+
4
+ message!: string;
5
+
6
+ data?: T;
7
+
8
+ constructor(success: boolean, message: string, data?: T) {
9
+ this.success = success;
10
+ this.message = message;
11
+ this.data = data;
12
+ }
13
+ }