@magmamath/students-features 0.3.3 → 0.4.0-rc.0

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 (234) hide show
  1. package/dist/commonjs/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
  2. package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +6 -4
  3. package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
  4. package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +12 -1
  5. package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
  6. package/dist/commonjs/features/chatbot/components/Chatbot.js +5 -1
  7. package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
  8. package/dist/commonjs/features/chatbot/context/ChatBotContext.js +17 -0
  9. package/dist/commonjs/features/chatbot/context/ChatBotContext.js.map +1 -0
  10. package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.js +58 -0
  11. package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.js.map +1 -0
  12. package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js +99 -0
  13. package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +1 -0
  14. package/dist/commonjs/features/chatbot/index.js +0 -7
  15. package/dist/commonjs/features/chatbot/index.js.map +1 -1
  16. package/dist/commonjs/features/chatbot/model/ChatBotModel.js +136 -117
  17. package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
  18. package/dist/commonjs/features/chatbot/model/{ChatBotMessageHandler.js → ChatBotThreadManager.js} +28 -17
  19. package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -0
  20. package/dist/commonjs/features/chatbot/model/{api.js → ChatbotApi.js} +16 -1
  21. package/dist/commonjs/features/chatbot/model/ChatbotApi.js.map +1 -0
  22. package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js +110 -0
  23. package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js.map +1 -0
  24. package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js +0 -1
  25. package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
  26. package/dist/commonjs/features/chatbot/model/ThreadItem.js +21 -8
  27. package/dist/commonjs/features/chatbot/model/ThreadItem.js.map +1 -1
  28. package/dist/commonjs/features/chatbot/model/messagesHelper.js +1 -5
  29. package/dist/commonjs/features/chatbot/model/messagesHelper.js.map +1 -1
  30. package/dist/commonjs/features/chatbot/model/t2s.js +0 -6
  31. package/dist/commonjs/features/chatbot/model/t2s.js.map +1 -1
  32. package/dist/commonjs/features/chatbot/model/translation.helpers.js.map +1 -1
  33. package/dist/commonjs/features/chatbot/model/translation.js +54 -45
  34. package/dist/commonjs/features/chatbot/model/translation.js.map +1 -1
  35. package/dist/commonjs/features/chatbot/types/api.types.js +4 -0
  36. package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
  37. package/dist/commonjs/features/chatbot/types/units.types.js +2 -0
  38. package/dist/commonjs/features/chatbot/types/units.types.js.map +1 -0
  39. package/dist/commonjs/lib/effector/createEntityFieldStore.js +4 -0
  40. package/dist/commonjs/lib/effector/createEntityFieldStore.js.map +1 -1
  41. package/dist/commonjs/lib/helpers/randomElements.js +24 -0
  42. package/dist/commonjs/lib/helpers/randomElements.js.map +1 -0
  43. package/dist/commonjs/shared/icons/HighlighterIcon.js +36 -0
  44. package/dist/commonjs/shared/icons/HighlighterIcon.js.map +1 -0
  45. package/dist/commonjs/shared/icons/StopIcon.js +33 -0
  46. package/dist/commonjs/shared/icons/StopIcon.js.map +1 -0
  47. package/dist/commonjs/shared/icons/icon.types.js +4 -0
  48. package/dist/module/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
  49. package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +6 -4
  50. package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
  51. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +12 -1
  52. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
  53. package/dist/module/features/chatbot/components/Chatbot.js +6 -2
  54. package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
  55. package/dist/module/features/chatbot/context/ChatBotContext.js +12 -0
  56. package/dist/module/features/chatbot/context/ChatBotContext.js.map +1 -0
  57. package/dist/module/features/chatbot/errorSpotting/ErrorSpottingButton.js +52 -0
  58. package/dist/module/features/chatbot/errorSpotting/ErrorSpottingButton.js.map +1 -0
  59. package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js +94 -0
  60. package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +1 -0
  61. package/dist/module/features/chatbot/index.js +0 -1
  62. package/dist/module/features/chatbot/index.js.map +1 -1
  63. package/dist/module/features/chatbot/model/ChatBotModel.js +138 -119
  64. package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
  65. package/dist/module/features/chatbot/model/{ChatBotMessageHandler.js → ChatBotThreadManager.js} +26 -15
  66. package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -0
  67. package/dist/module/features/chatbot/model/{api.js → ChatbotApi.js} +16 -1
  68. package/dist/module/features/chatbot/model/ChatbotApi.js.map +1 -0
  69. package/dist/module/features/chatbot/model/ChatsCacheModel.js +104 -0
  70. package/dist/module/features/chatbot/model/ChatsCacheModel.js.map +1 -0
  71. package/dist/module/features/chatbot/model/DefaultMessageCreator.js +0 -1
  72. package/dist/module/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
  73. package/dist/module/features/chatbot/model/ThreadItem.js +21 -8
  74. package/dist/module/features/chatbot/model/ThreadItem.js.map +1 -1
  75. package/dist/module/features/chatbot/model/messagesHelper.js +1 -5
  76. package/dist/module/features/chatbot/model/messagesHelper.js.map +1 -1
  77. package/dist/module/features/chatbot/model/t2s.js +1 -7
  78. package/dist/module/features/chatbot/model/t2s.js.map +1 -1
  79. package/dist/module/features/chatbot/model/translation.helpers.js.map +1 -1
  80. package/dist/module/features/chatbot/model/translation.js +54 -45
  81. package/dist/module/features/chatbot/model/translation.js.map +1 -1
  82. package/dist/module/features/chatbot/types/api.types.js +2 -0
  83. package/dist/module/features/chatbot/types/model.types.js.map +1 -1
  84. package/dist/module/features/chatbot/types/units.types.js +2 -0
  85. package/dist/module/features/chatbot/types/units.types.js.map +1 -0
  86. package/dist/module/lib/effector/createEntityFieldStore.js +4 -0
  87. package/dist/module/lib/effector/createEntityFieldStore.js.map +1 -1
  88. package/dist/module/lib/helpers/randomElements.js +20 -0
  89. package/dist/module/lib/helpers/randomElements.js.map +1 -0
  90. package/dist/module/shared/icons/HighlighterIcon.js +29 -0
  91. package/dist/module/shared/icons/HighlighterIcon.js.map +1 -0
  92. package/dist/module/shared/icons/StopIcon.js +26 -0
  93. package/dist/module/shared/icons/StopIcon.js.map +1 -0
  94. package/dist/module/shared/icons/icon.types.js +2 -0
  95. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts +1 -0
  96. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
  97. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts +1 -1
  98. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
  99. package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
  100. package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
  101. package/dist/typescript/commonjs/features/chatbot/context/ChatBotContext.d.ts +8 -0
  102. package/dist/typescript/commonjs/features/chatbot/context/ChatBotContext.d.ts.map +1 -0
  103. package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts +3 -0
  104. package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts.map +1 -0
  105. package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +28 -0
  106. package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +1 -0
  107. package/dist/typescript/commonjs/features/chatbot/index.d.ts +4 -3
  108. package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
  109. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +19 -14
  110. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  111. package/dist/typescript/{module/features/chatbot/model/ChatBotMessageHandler.d.ts → commonjs/features/chatbot/model/ChatBotThreadManager.d.ts} +11 -8
  112. package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -0
  113. package/dist/typescript/commonjs/features/chatbot/model/{api.d.ts → ChatbotApi.d.ts} +4 -3
  114. package/dist/typescript/commonjs/features/chatbot/model/ChatbotApi.d.ts.map +1 -0
  115. package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts +26 -0
  116. package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -0
  117. package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts +3 -2
  118. package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
  119. package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts +12 -6
  120. package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts.map +1 -1
  121. package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts +3 -4
  122. package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts.map +1 -1
  123. package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts +2 -4
  124. package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts.map +1 -1
  125. package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts +7 -8
  126. package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
  127. package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts +2 -1
  128. package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts.map +1 -1
  129. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +2 -11
  130. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
  131. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +26 -19
  132. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
  133. package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts +2 -1
  134. package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts.map +1 -1
  135. package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +31 -0
  136. package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -0
  137. package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts +2 -0
  138. package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts.map +1 -1
  139. package/dist/typescript/commonjs/lib/helpers/randomElements.d.ts +2 -0
  140. package/dist/typescript/commonjs/lib/helpers/randomElements.d.ts.map +1 -0
  141. package/dist/typescript/commonjs/shared/icons/HighlighterIcon.d.ts +4 -0
  142. package/dist/typescript/commonjs/shared/icons/HighlighterIcon.d.ts.map +1 -0
  143. package/dist/typescript/commonjs/shared/icons/StopIcon.d.ts +4 -0
  144. package/dist/typescript/commonjs/shared/icons/StopIcon.d.ts.map +1 -0
  145. package/dist/typescript/commonjs/shared/icons/icon.types.d.ts +2 -0
  146. package/dist/typescript/commonjs/shared/icons/icon.types.d.ts.map +1 -1
  147. package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts +1 -0
  148. package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
  149. package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts +1 -1
  150. package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
  151. package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
  152. package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
  153. package/dist/typescript/module/features/chatbot/context/ChatBotContext.d.ts +8 -0
  154. package/dist/typescript/module/features/chatbot/context/ChatBotContext.d.ts.map +1 -0
  155. package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts +3 -0
  156. package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts.map +1 -0
  157. package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +28 -0
  158. package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +1 -0
  159. package/dist/typescript/module/features/chatbot/index.d.ts +4 -3
  160. package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
  161. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +19 -14
  162. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  163. package/dist/typescript/{commonjs/features/chatbot/model/ChatBotMessageHandler.d.ts → module/features/chatbot/model/ChatBotThreadManager.d.ts} +11 -8
  164. package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -0
  165. package/dist/typescript/module/features/chatbot/model/{api.d.ts → ChatbotApi.d.ts} +4 -3
  166. package/dist/typescript/module/features/chatbot/model/ChatbotApi.d.ts.map +1 -0
  167. package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts +26 -0
  168. package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -0
  169. package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts +3 -2
  170. package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
  171. package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts +12 -6
  172. package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts.map +1 -1
  173. package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts +3 -4
  174. package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts.map +1 -1
  175. package/dist/typescript/module/features/chatbot/model/t2s.d.ts +2 -4
  176. package/dist/typescript/module/features/chatbot/model/t2s.d.ts.map +1 -1
  177. package/dist/typescript/module/features/chatbot/model/translation.d.ts +7 -8
  178. package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
  179. package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts +2 -1
  180. package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts.map +1 -1
  181. package/dist/typescript/module/features/chatbot/types/api.types.d.ts +2 -11
  182. package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
  183. package/dist/typescript/module/features/chatbot/types/model.types.d.ts +26 -19
  184. package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
  185. package/dist/typescript/module/features/chatbot/types/translation.types.d.ts +2 -1
  186. package/dist/typescript/module/features/chatbot/types/translation.types.d.ts.map +1 -1
  187. package/dist/typescript/module/features/chatbot/types/units.types.d.ts +31 -0
  188. package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -0
  189. package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts +2 -0
  190. package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts.map +1 -1
  191. package/dist/typescript/module/lib/helpers/randomElements.d.ts +2 -0
  192. package/dist/typescript/module/lib/helpers/randomElements.d.ts.map +1 -0
  193. package/dist/typescript/module/shared/icons/HighlighterIcon.d.ts +4 -0
  194. package/dist/typescript/module/shared/icons/HighlighterIcon.d.ts.map +1 -0
  195. package/dist/typescript/module/shared/icons/StopIcon.d.ts +4 -0
  196. package/dist/typescript/module/shared/icons/StopIcon.d.ts.map +1 -0
  197. package/dist/typescript/module/shared/icons/icon.types.d.ts +2 -0
  198. package/dist/typescript/module/shared/icons/icon.types.d.ts.map +1 -1
  199. package/package.json +2 -2
  200. package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +1 -0
  201. package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +3 -0
  202. package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +14 -0
  203. package/src/features/chatbot/components/Chatbot.tsx +3 -2
  204. package/src/features/chatbot/context/ChatBotContext.ts +18 -0
  205. package/src/features/chatbot/errorSpotting/ErrorSpottingButton.tsx +53 -0
  206. package/src/features/chatbot/errorSpotting/ErrorSpottingModel.ts +116 -0
  207. package/src/features/chatbot/index.ts +3 -3
  208. package/src/features/chatbot/model/ChatBotModel.ts +123 -124
  209. package/src/features/chatbot/model/{ChatBotMessageHandler.ts → ChatBotThreadManager.ts} +28 -16
  210. package/src/features/chatbot/model/{api.ts → ChatbotApi.ts} +19 -2
  211. package/src/features/chatbot/model/ChatsCacheModel.ts +94 -0
  212. package/src/features/chatbot/model/DefaultMessageCreator.ts +3 -3
  213. package/src/features/chatbot/model/ThreadItem.ts +20 -9
  214. package/src/features/chatbot/model/messagesHelper.ts +2 -6
  215. package/src/features/chatbot/model/t2s.ts +3 -10
  216. package/src/features/chatbot/model/translation.helpers.ts +2 -1
  217. package/src/features/chatbot/model/translation.ts +52 -46
  218. package/src/features/chatbot/types/api.types.ts +2 -12
  219. package/src/features/chatbot/types/model.types.ts +38 -26
  220. package/src/features/chatbot/types/translation.types.ts +2 -1
  221. package/src/features/chatbot/types/units.types.ts +34 -0
  222. package/src/lib/effector/createEntityFieldStore.ts +9 -1
  223. package/src/lib/helpers/randomElements.ts +22 -0
  224. package/src/shared/icons/HighlighterIcon.tsx +21 -0
  225. package/src/shared/icons/StopIcon.tsx +17 -0
  226. package/src/shared/icons/icon.types.ts +9 -6
  227. package/dist/commonjs/features/chatbot/model/ChatBotMessageHandler.js.map +0 -1
  228. package/dist/commonjs/features/chatbot/model/api.js.map +0 -1
  229. package/dist/module/features/chatbot/model/ChatBotMessageHandler.js.map +0 -1
  230. package/dist/module/features/chatbot/model/api.js.map +0 -1
  231. package/dist/typescript/commonjs/features/chatbot/model/ChatBotMessageHandler.d.ts.map +0 -1
  232. package/dist/typescript/commonjs/features/chatbot/model/api.d.ts.map +0 -1
  233. package/dist/typescript/module/features/chatbot/model/ChatBotMessageHandler.d.ts.map +0 -1
  234. package/dist/typescript/module/features/chatbot/model/api.d.ts.map +0 -1
@@ -1,10 +1,10 @@
1
1
  import { generateRandomId } from '../../../lib/helpers/helpers'
2
- import { ConversationMessage, CreateMessageResponse } from '../types/model.types'
2
+ import { CreateMessageResponse } from '../types/model.types'
3
+ import { ConversationMessage } from '../types/units.types'
3
4
 
4
5
  type OwnMessageProps = {
5
6
  message?: string
6
7
  translatedMessage?: string
7
- threadId?: string | null
8
8
  }
9
9
 
10
10
  export class messagesHelper {
@@ -13,7 +13,6 @@ export class messagesHelper {
13
13
  id: generateRandomId(),
14
14
  isOwnMessage: false,
15
15
  message: data.message,
16
- threadId: data.threadId,
17
16
  options: data.options,
18
17
  translatedMessage: data.translatedMessage,
19
18
  }
@@ -26,7 +25,6 @@ export class messagesHelper {
26
25
  translatedMessage: data.translatedMessage,
27
26
  isOwnMessage: false,
28
27
  options: [],
29
- threadId: '',
30
28
  endMessage: true,
31
29
  }
32
30
  }
@@ -34,13 +32,11 @@ export class messagesHelper {
34
32
  public static createOwn({
35
33
  message = '',
36
34
  translatedMessage,
37
- threadId,
38
35
  }: OwnMessageProps): ConversationMessage {
39
36
  return {
40
37
  id: generateRandomId(),
41
38
  message,
42
39
  translatedMessage,
43
- threadId: threadId || '',
44
40
  isOwnMessage: true,
45
41
  options: [],
46
42
  }
@@ -1,10 +1,9 @@
1
- import { restore, createEvent, Store, sample, createEffect } from 'effector'
1
+ import { restore, createEvent, createEffect } from 'effector'
2
2
  import { AUDIO_CONFIG, DEFAULT_VOICE } from '../constants'
3
3
  import { AudioProvider, AudioStatus, PlayTextToSpeechProps } from '../types/t2s.types'
4
- import { ChatbotAPI } from './api'
4
+ import { ChatbotAPI } from './ChatbotApi'
5
5
 
6
6
  type ChatTextToSpeechModelProps = {
7
- $isOpen: Store<boolean>
8
7
  api: ChatbotAPI
9
8
  }
10
9
 
@@ -18,14 +17,8 @@ export class ChatTextToSpeechModel {
18
17
  readonly setStatus = createEvent<AudioStatus>()
19
18
  readonly $status = restore(this.setStatus, AudioStatus.STOPPED)
20
19
 
21
- constructor({ $isOpen, api }: ChatTextToSpeechModelProps) {
20
+ constructor({ api }: ChatTextToSpeechModelProps) {
22
21
  this.api = api
23
-
24
- sample({
25
- source: $isOpen.updates,
26
- filter: isOpen => !isOpen,
27
- target: this.reset,
28
- })
29
22
  }
30
23
 
31
24
  public setAudioProvider(audioProvider: AudioProvider) {
@@ -3,7 +3,8 @@ import {
3
3
  GetOptionsProps,
4
4
  GetOptionsResult,
5
5
  } from '../types/translation.types'
6
- import { ChatAnswer, GetAlternativesResponse } from '../types/api.types'
6
+ import { GetAlternativesResponse } from '../types/api.types'
7
+ import { ChatAnswer } from '../types/units.types'
7
8
 
8
9
  export function getOptionsForTranslation({
9
10
  lastMessage,
@@ -5,27 +5,29 @@ import {
5
5
  TranslateMessageFxProps,
6
6
  TranslateRequestProps,
7
7
  } from '../types/translation.types'
8
- import { ChatbotContext, ChatbotMessages, ConversationMessage } from '../types/model.types'
8
+ import { ChatbotContext, ChatbotMessages } from '../types/model.types'
9
9
  import { GetAlternativesResponse } from '../types/api.types'
10
10
  import { decodeHTMLEntities } from '../helpers'
11
- import { ChatbotAPI } from './api'
12
- import { EntityFieldStore } from '../../../lib/effector/createEntityFieldStore'
11
+ import { ChatbotAPI } from './ChatbotApi'
13
12
  import {
14
13
  addTranslationsToAlternative,
15
14
  addTranslationToOptions,
16
15
  getOptionsForTranslation,
17
16
  } from './translation.helpers'
18
17
 
18
+ import { ChatsCacheModel } from './ChatsCacheModel'
19
+ import { ConversationMessage } from '../types/units.types'
20
+
19
21
  type ChatbotTranslationProps = {
20
22
  api: ChatbotAPI
21
23
  $key: Store<string>
22
24
  defaultMessages: ChatbotMessages
23
- messagesModel: EntityFieldStore<ConversationMessage[]>
24
25
  $context: Store<ChatbotContext | null>
25
26
  alternativesModel: {
26
27
  set: EventCallable<GetAlternativesResponse | null>
27
28
  $store: Store<GetAlternativesResponse | null>
28
29
  }
30
+ chats: ChatsCacheModel
29
31
  }
30
32
 
31
33
  export class ChatbotTranslation {
@@ -33,7 +35,6 @@ export class ChatbotTranslation {
33
35
  private readonly $key
34
36
  private readonly $context
35
37
  private readonly defaultMessages
36
- private readonly messagesModel
37
38
  private readonly alternativesModel
38
39
 
39
40
  readonly setIsTranslated = createEvent<boolean>()
@@ -45,27 +46,32 @@ export class ChatbotTranslation {
45
46
  api,
46
47
  $key,
47
48
  defaultMessages,
48
- messagesModel,
49
49
  alternativesModel,
50
50
  $context,
51
+ chats,
51
52
  }: ChatbotTranslationProps) {
52
53
  this.api = api
53
54
  this.$key = $key
54
55
  this.$context = $context
55
56
  this.defaultMessages = defaultMessages
56
- this.messagesModel = messagesModel
57
57
  this.alternativesModel = alternativesModel
58
58
 
59
59
  this.translateAllMessagesFx = attach({
60
- source: [this.$key, this.messagesModel.$state, this.alternativesModel.$store, this.$context],
61
- mapParams: (_: void, [key, messages, alternatives, context]) => ({
60
+ source: [this.$key, chats.$data, this.alternativesModel.$store, this.$context],
61
+ mapParams: (_: void, [key, chats, alternatives, context]) => ({
62
62
  targetLanguage: context?.translationTargetLanguage ?? '',
63
- messages: messages[key] ?? [],
63
+ messages: chats[key]?.messages ?? [],
64
64
  alternatives,
65
65
  }),
66
66
  effect: this.translateBatchFx,
67
67
  })
68
- this.initTranslationSamples()
68
+
69
+ sample({
70
+ clock: this.translateAllMessagesFx.doneData,
71
+ source: [this.$key] as const,
72
+ fn: ([key], translatedMessages) => ({ key, data: { messages: translatedMessages } }),
73
+ target: chats.update,
74
+ })
69
75
  }
70
76
 
71
77
  private shouldSkipTranslation(messages: ConversationMessage[]) {
@@ -83,15 +89,6 @@ export class ChatbotTranslation {
83
89
  return false
84
90
  }
85
91
 
86
- private initTranslationSamples() {
87
- sample({
88
- clock: this.translateAllMessagesFx.doneData,
89
- source: [this.$key] as const,
90
- fn: ([key], translatedMessages) => ({ key, data: translatedMessages }),
91
- target: this.messagesModel.setField,
92
- })
93
- }
94
-
95
92
  private async translateRequest<List extends Record<string, string[]>>({
96
93
  textList,
97
94
  targetLanguage,
@@ -167,33 +164,42 @@ export class ChatbotTranslation {
167
164
  },
168
165
  )
169
166
 
170
- public readonly translateMessagesFx = createEffect(
171
- async ({
172
- messages,
173
- targetLanguage,
174
- }: TranslateMessageFxProps): Promise<ConversationMessage[]> => {
175
- const text = messages
176
- .map(({ options, message }) => {
177
- return [message, ...options.map(({ text }) => text)]
167
+ public readonly applyTranslationFx = attach({
168
+ source: { isTranslated: this.$isTranslated },
169
+ mapParams: (props: Omit<TranslateMessageFxProps, 'isTranslated'>, source) => ({
170
+ ...props,
171
+ ...source,
172
+ }),
173
+ effect: createEffect(
174
+ async ({
175
+ messages,
176
+ targetLanguage,
177
+ preventTranslate,
178
+ }: TranslateMessageFxProps): Promise<ConversationMessage[]> => {
179
+ if (!preventTranslate) return messages
180
+ const text = messages
181
+ .map(({ options, message }) => {
182
+ return [message, ...options.map(({ text }) => text)]
183
+ })
184
+ .flat()
185
+
186
+ const response = await this.api.translateTextFx({ text, targetLanguage })
187
+ const translatedTexts = response.data.translations.map(({ translatedText }) =>
188
+ decodeHTMLEntities(translatedText),
189
+ )
190
+
191
+ return messages.map((message): ConversationMessage => {
192
+ const options = message.options
193
+ const translatedMessage = translatedTexts.shift()
194
+ return {
195
+ ...message,
196
+ translatedMessage,
197
+ options: addTranslationToOptions(options, translatedTexts.splice(0, options.length)),
198
+ }
178
199
  })
179
- .flat()
180
-
181
- const response = await this.api.translateTextFx({ text, targetLanguage })
182
- const translatedTexts = response.data.translations.map(({ translatedText }) =>
183
- decodeHTMLEntities(translatedText),
184
- )
185
-
186
- return messages.map((message): ConversationMessage => {
187
- const options = message.options
188
- const translatedMessage = translatedTexts.shift()
189
- return {
190
- ...message,
191
- translatedMessage,
192
- options: addTranslationToOptions(options, translatedTexts.splice(0, options.length)),
193
- }
194
- })
195
- },
196
- )
200
+ },
201
+ ),
202
+ })
197
203
 
198
204
  public reset() {
199
205
  this.setIsTranslated(false)
@@ -1,8 +1,4 @@
1
- export type ChatAnswer = {
2
- text: string
3
- promptKey: string
4
- translatedText?: string
5
- }
1
+ import { ChatAnswer, IThreadItem, Stroke } from './units.types'
6
2
 
7
3
  export type GetAlternativesPayload = {
8
4
  municipalityId: string
@@ -21,16 +17,15 @@ export type PostMessagePayload = {
21
17
  language: string
22
18
  problemAnswer: string[]
23
19
  answer?: string | string[]
24
- threadId?: string | null
25
20
  problem: string
26
21
  imageAltText?: string
27
22
  }
28
23
 
29
24
  export type PostMessageResponse = {
30
25
  message: string
31
- threadId: string
32
26
  options: ChatAnswer[]
33
27
  endMessage?: boolean
28
+ thread: IThreadItem
34
29
  }
35
30
 
36
31
  export type GoogleTranslatePayload = {
@@ -61,11 +56,6 @@ export type GoogleText2SpeechPayload = {
61
56
 
62
57
  export type GoogleText2SpeechResponse = string | undefined | { audioContent?: string }
63
58
 
64
- export type Stroke = {
65
- x: number[]
66
- y: number[]
67
- }
68
-
69
59
  export type ChatHintPayload = {
70
60
  problemDescription: string
71
61
  correctAnswer: string[]
@@ -1,27 +1,18 @@
1
1
  import type { Store } from 'effector'
2
2
  import {
3
+ ChatHintPayload,
4
+ ChatHintResponse,
5
+ GetAlternativesPayload,
3
6
  GetAlternativesResponse,
4
- PostMessagePayload,
5
- PostMessageResponse,
6
- GoogleTranslatePayload,
7
- GoogleTranslateResponse,
8
7
  GoogleText2SpeechPayload,
9
8
  GoogleText2SpeechResponse,
10
- ChatAnswer,
11
- GetAlternativesPayload,
12
- Stroke,
9
+ GoogleTranslatePayload,
10
+ GoogleTranslateResponse,
11
+ PostMessagePayload,
12
+ PostMessageResponse,
13
13
  } from './api.types'
14
14
  import { ExtendWithOptional } from '../../../lib/helpers/types'
15
-
16
- export type ConversationMessage = {
17
- id: string
18
- message: string
19
- threadId: string
20
- options: ChatAnswer[]
21
- isOwnMessage: boolean
22
- translatedMessage?: string
23
- endMessage?: boolean
24
- }
15
+ import { ChatAnswer, ConversationMessage, FullStrokeData } from './units.types'
25
16
 
26
17
  export type ChatbotMessages = {
27
18
  error: ConversationMessage
@@ -30,15 +21,29 @@ export type ChatbotMessages = {
30
21
  anotherHintOption: ChatAnswer
31
22
  }
32
23
 
24
+ export type SpotErrorPayload = {
25
+ strokes: FullStrokeData[]
26
+ }
27
+
28
+ export type SpotErrorResponse = {
29
+ strokesIds: string[]
30
+ }
31
+
32
+ export type ChatbotApiRequests = {
33
+ getAlternatives: (props: GetAlternativesPayload) => Promise<GetAlternativesResponse>
34
+ postMessage: (props: PostMessagePayload) => Promise<PostMessageResponse>
35
+ postTranslateText: (props: GoogleTranslatePayload) => Promise<GoogleTranslateResponse>
36
+ postTextToSpeech: (props: GoogleText2SpeechPayload) => Promise<GoogleText2SpeechResponse>
37
+ spotError: (props: SpotErrorPayload) => Promise<SpotErrorResponse>
38
+ }
39
+
33
40
  export type ChatbotModelProps = {
34
41
  $key?: Store<string>
35
- api: {
36
- getAlternatives: (props: GetAlternativesPayload) => Promise<GetAlternativesResponse>
37
- postMessage: (props: PostMessagePayload) => Promise<PostMessageResponse>
38
- postTranslateText: (props: GoogleTranslatePayload) => Promise<GoogleTranslateResponse>
39
- postTextToSpeech: (props: GoogleText2SpeechPayload) => Promise<GoogleText2SpeechResponse>
42
+ api: Omit<ChatbotApiRequests, 'postMessage'> & {
43
+ requestHint: (props: ChatHintPayload) => Promise<ChatHintResponse>
40
44
  }
41
45
  messages: ChatbotMessages
46
+ threadMessagesLimit?: number
42
47
  }
43
48
 
44
49
  export type SendHelpParams = {
@@ -48,8 +53,6 @@ export type SendHelpParams = {
48
53
 
49
54
  export type SendHelpProps = SendHelpParams & {
50
55
  key: string
51
- isTranslated: boolean
52
- threadId: string
53
56
  context: ChatbotContext | null
54
57
  }
55
58
 
@@ -77,10 +80,19 @@ export type ChatbotRenderer = {
77
80
  withTextToSpeech: boolean
78
81
  }
79
82
 
80
- export type CreateMessageResponse = ExtendWithOptional<PostMessageResponse, ConversationMessage>
83
+ export type CreateMessageResponse = ExtendWithOptional<
84
+ Omit<PostMessageResponse, 'thread'>,
85
+ ConversationMessage
86
+ >
87
+
88
+ type GetVisibleStrokesResponse = {
89
+ strokes: FullStrokeData[]
90
+ validationKey: string
91
+ }
81
92
 
82
93
  export type IChatDrawBoardAdapter = {
83
- getVisibleStrokes(): Promise<Stroke[] | null>
94
+ $strokesValidationKey: Store<string | null>
95
+ getVisibleStrokes(): Promise<GetVisibleStrokesResponse | null>
84
96
  }
85
97
 
86
98
  export type ChatbotContext = {
@@ -1,5 +1,5 @@
1
- import { ConversationMessage } from './model.types'
2
1
  import { GetAlternativesResponse } from './api.types'
2
+ import { ConversationMessage } from './units.types'
3
3
 
4
4
  export type TranslateBatchFxProps = {
5
5
  messages: ConversationMessage[]
@@ -8,6 +8,7 @@ export type TranslateBatchFxProps = {
8
8
  }
9
9
 
10
10
  export type TranslateMessageFxProps = {
11
+ preventTranslate?: boolean
11
12
  messages: ConversationMessage[]
12
13
  targetLanguage: string
13
14
  }
@@ -0,0 +1,34 @@
1
+ export type Stroke = {
2
+ x: number[]
3
+ y: number[]
4
+ }
5
+ export type FullStrokeData = Stroke & {
6
+ id?: string
7
+ }
8
+
9
+ export type IThreadItem = {
10
+ key: string | null
11
+ strokes: FullStrokeData[] | null
12
+ history: string[]
13
+ }
14
+
15
+ export type ChatAnswer = {
16
+ text: string
17
+ promptKey: string
18
+ translatedText?: string
19
+ }
20
+
21
+ export type ConversationMessage = {
22
+ id: string
23
+ message: string
24
+ options: ChatAnswer[]
25
+ isOwnMessage: boolean
26
+ translatedMessage?: string
27
+ endMessage?: boolean
28
+ }
29
+
30
+ export type ChatItem = {
31
+ messages: ConversationMessage[]
32
+ isAvailable: boolean
33
+ currentThread: IThreadItem | null
34
+ }
@@ -1,4 +1,4 @@
1
- import { createEvent, createStore } from 'effector'
1
+ import { createEvent, createStore, Event } from 'effector'
2
2
 
3
3
  type UpdateField<T> = {
4
4
  key: string
@@ -19,6 +19,14 @@ export class EntityFieldStore<T> {
19
19
  return { ...state, [key]: data }
20
20
  })
21
21
  .reset(this.reset)
22
+
23
+ public on<EV>(
24
+ event: Event<EV>,
25
+ fn: (state: Record<string, T>, payload: EV) => Record<string, T> | void,
26
+ ) {
27
+ this.$state.on(event, fn)
28
+ return this
29
+ }
22
30
  }
23
31
 
24
32
  export function createEntityFieldStore<T>() {
@@ -0,0 +1,22 @@
1
+ export function getRandomElements<T>(array: T[], limit = array.length): T[] {
2
+ if (array.length === 0) {
3
+ return []
4
+ }
5
+
6
+ const randomCount = Math.min(Math.floor(Math.random() * array.length) + 1, limit)
7
+
8
+ const arrayCopy = [...array]
9
+ const result: T[] = []
10
+
11
+ for (let i = 0; i < randomCount; i++) {
12
+ if (arrayCopy.length === 0) {
13
+ break
14
+ }
15
+
16
+ const randomIndex = Math.floor(Math.random() * arrayCopy.length)
17
+ result.push(arrayCopy[randomIndex])
18
+ arrayCopy.splice(randomIndex, 1)
19
+ }
20
+
21
+ return result
22
+ }
@@ -0,0 +1,21 @@
1
+ import React from 'react'
2
+ import Svg, { Path } from 'react-native-svg'
3
+ import { IconProps } from './icon.types'
4
+ import { COLORS } from '@magmamath/react-native-ui'
5
+
6
+ export function HighlighterIcon({ size = 17, color = COLORS.NEUTRAL_9, style }: IconProps) {
7
+ return (
8
+ <Svg style={style} width={size} height={size} viewBox="0 0 17 17" fill="none">
9
+ <Path
10
+ d="M6.02 1.557a.596.596 0 011.108 0l.42 1.067c.06.153.182.275.336.335l1.066.42a.596.596 0 010 1.109l-1.066.42a.596.596 0 00-.336.336l-.42 1.066a.596.596 0 01-1.109 0L5.6 5.244a.596.596 0 00-.336-.336l-1.066-.42a.596.596 0 010-1.108l1.066-.42a.596.596 0 00.336-.336l.42-1.067z"
11
+ fill={color}
12
+ />
13
+ <Path
14
+ fillRule="evenodd"
15
+ clipRule="evenodd"
16
+ d="M8.843 3.338l-.974.73-2.11 1.583.26.66a.596.596 0 001.109 0l.42-1.067a.596.596 0 01.336-.336l1.066-.42a.596.596 0 000-1.108l-.107-.042zm.67-.502c.497.346.665.964.506 1.495l.476-.357 2.868 2.868-3.636 4.849-4.08-4.08.38-.286a1.316 1.316 0 01-.705-.74l-.185-.468-.898.674a.95.95 0 00-.33 1.065 1.75 1.75 0 00-.2.53l-.602 3.016-1.752 1.752a.95.95 0 00.297 1.545l1.83.784a1.35 1.35 0 001.487-.286l.966-.966 3.016-.604c.187-.037.366-.105.53-.199a.95.95 0 001.065-.33l5.445-7.26a2.25 2.25 0 00-.209-2.94L14.44 1.554a2.25 2.25 0 00-2.941-.209l-1.986 1.49zm3.866-.22a.75.75 0 00-.98-.07l-.692.519 2.565 2.565.52-.692a.75.75 0 00-.07-.98l-1.343-1.342zM3.797 12.832l-.807.808.99.425.525-.525-.708-.707zm2.015-.107l2.357-.47-3.086-3.087-.471 2.357 1.2 1.2z"
17
+ fill={color}
18
+ />
19
+ </Svg>
20
+ )
21
+ }
@@ -0,0 +1,17 @@
1
+ import React from 'react'
2
+ import Svg, { Path } from 'react-native-svg'
3
+ import { IconProps } from './icon.types'
4
+ import { COLORS } from '@magmamath/react-native-ui'
5
+
6
+ export function StopIcon({ size = 17, color = COLORS.NEUTRAL_9, style }: IconProps) {
7
+ return (
8
+ <Svg width={size} height={size} viewBox="0 0 17 17" fill="none" style={style}>
9
+ <Path
10
+ fillRule="evenodd"
11
+ clipRule="evenodd"
12
+ d="M1.759 2.996c0-.967.784-1.752 1.752-1.752h10.496c.967 0 1.752.785 1.752 1.752v10.496c0 .968-.785 1.752-1.752 1.752H3.51a1.752 1.752 0 01-1.752-1.752V2.996z"
13
+ fill={color}
14
+ />
15
+ </Svg>
16
+ )
17
+ }
@@ -1,8 +1,11 @@
1
+ import { StyleProp, ViewStyle } from 'react-native'
2
+
1
3
  export type IconProps = {
2
- color?: string
3
- className?: string
4
- size?: number
5
- strokeWidth?: string
6
- width?: number
7
- height?: number
4
+ color?: string
5
+ className?: string
6
+ size?: number
7
+ strokeWidth?: string
8
+ width?: number
9
+ height?: number
10
+ style?: StyleProp<ViewStyle>
8
11
  }
@@ -1 +0,0 @@
1
- {"version":3,"names":["_ThreadItem","require","_effector","_constants","ChatMessageHandler","threads","Map","currentKey","currentBinding","constructor","drawBoardAdapter","api","messagesLimit","CHAT_BOT_MODEL_DEFAULTS","THREAD_MESSAGES_LIMIT","messages","defaultMessages","bindKeyStore","$store","watch","value","getThreadItem","key","threadItem","get","strokes","getVisibleStrokes","ThreadItem","set","postMessageFx","problemAnswer","problem","answer","language","imageAltText","result","getHint","getNextHintProps","correctAnswer","problemDescription","userAnswer","hints","push","message","nextOptions","length","anotherHintOption","options","threadId","endMessage","resetThread","createEffect","delete","resetAll","clear","exports"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/ChatBotMessageHandler.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAQA,IAAAE,UAAA,GAAAF,OAAA;AAeO,MAAMG,kBAAkB,CAAC;EAGbC,OAAO,GAAG,IAAIC,GAAG,CAAqB,CAAC;EAGhDC,UAAU,GAAG,EAAE;EACfC,cAAc,GAAwB,IAAI;EAI3CC,WAAWA,CAAC;IACjBC,gBAAgB;IAChBC,GAAG;IACHC,aAAa,GAAGC,kCAAuB,CAACC,qBAAqB;IAC7DC;EACuB,CAAC,EAAE;IAC1B,IAAI,CAACJ,GAAG,GAAGA,GAAG;IACd,IAAI,CAACD,gBAAgB,GAAGA,gBAAgB;IACxC,IAAI,CAACE,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACI,eAAe,GAAGD,QAAQ;EACjC;EAEOE,YAAYA,CAACC,MAAqB,EAAE;IACzC,IAAI,CAACV,cAAc,GAAG,CAAC;IACvB,IAAI,CAACA,cAAc,GAAGU,MAAM,CAACC,KAAK,CAAEC,KAAK,IAAK;MAC5C,IAAI,CAACb,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MAAM,CAACQ,OAAO;MACvBI,OAAO,EAAEH,WAAW;MACpBI,QAAQ,EAAE,EAAE;MACZC,UAAU,EAAE,CAACL,WAAW,CAACC;IAC3B,CAAC;EACH,CAAC;EAEMK,WAAW,GAAG,IAAAC,sBAAY,EAAC,CAAC;IAAE7B;EAAqB,CAAC,KAAK;IAC9D,IAAI,CAACjB,OAAO,CAAC+C,MAAM,CAAC9B,GAAG,CAAC;EAC1B,CAAC,CAAC;EAEK+B,QAAQA,CAAA,EAAG;IAChB,IAAI,CAAChD,OAAO,CAACiD,KAAK,CAAC,CAAC;EACtB;AACF;AAACC,OAAA,CAAAnD,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_effector","require","_index","_helpers","ChatbotAPI","constructor","api","postMessageFx","createControllerEffect","postMessage","getAlternativesFx","createEffect","getAlternatives","translateTextFx","payload","response","postTranslateText","text","replaceKatexSyntax","data","translations","map","translation","translatedText","textToSpeechTextFx","postTextToSpeech","exports"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/api.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,QAAA,GAAAF,OAAA;AAEO,MAAMG,UAAU,CAAC;EAMtBC,WAAWA,CAACC,GAA6B,EAAE;IACzC,IAAI,CAACC,aAAa,GAAG,IAAAC,6BAAsB,EAACF,GAAG,CAACG,WAAW,CAAC;IAC5D,IAAI,CAACC,iBAAiB,GAAG,IAAAC,sBAAY,EAACL,GAAG,CAACM,eAAe,CAAC;IAC1D,IAAI,CAACC,eAAe,GAAG,IAAAF,sBAAY,EACjC,MAAOG,OAA+B,IAAuC;MAC3E,MAAMC,QAAQ,GAAG,MAAMT,GAAG,CAACU,iBAAiB,CAAC;QAC3C,GAAGF,OAAO;QACVG,IAAI,EAAE,IAAAC,2BAAkB,EAACJ,OAAO,CAACG,IAAI;MACvC,CAAC,CAAC;MAEF,OAAO;QACL,GAAGF,QAAQ;QACXI,IAAI,EAAE;UACJ,GAAGJ,QAAQ,CAACI,IAAI;UAChBC,YAAY,EAAEL,QAAQ,CAACI,IAAI,CAACC,YAAY,CAACC,GAAG,CAAEC,WAAW,KAAM;YAC7D,GAAGA,WAAW;YACdC,cAAc,EAAE,IAAAL,2BAAkB,EAAC,CAACI,WAAW,CAACC,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;UAC1E,CAAC,CAAC;QACJ;MACF,CAAC;IACH,CACF,CAAC;IACD,IAAI,CAACC,kBAAkB,GAAG,IAAAb,sBAAY,EAACL,GAAG,CAACmB,gBAAgB,CAAC;EAC9D;AACF;AAACC,OAAA,CAAAtB,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["ThreadItem","createEffect","CHAT_BOT_MODEL_DEFAULTS","ChatMessageHandler","threads","Map","currentKey","currentBinding","constructor","drawBoardAdapter","api","messagesLimit","THREAD_MESSAGES_LIMIT","messages","defaultMessages","bindKeyStore","$store","watch","value","getThreadItem","key","threadItem","get","strokes","getVisibleStrokes","set","postMessageFx","problemAnswer","problem","answer","language","imageAltText","result","getHint","getNextHintProps","correctAnswer","problemDescription","userAnswer","hints","push","message","nextOptions","length","anotherHintOption","options","threadId","endMessage","resetThread","delete","resetAll","clear"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/ChatBotMessageHandler.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,iBAAc;AAEzC,SAASC,YAAY,QAAQ,uBAAuB;AAQpD,SAASC,uBAAuB,QAAQ,gBAAa;AAerD,OAAO,MAAMC,kBAAkB,CAAC;EAGbC,OAAO,GAAG,IAAIC,GAAG,CAAqB,CAAC;EAGhDC,UAAU,GAAG,EAAE;EACfC,cAAc,GAAwB,IAAI;EAI3CC,WAAWA,CAAC;IACjBC,gBAAgB;IAChBC,GAAG;IACHC,aAAa,GAAGT,uBAAuB,CAACU,qBAAqB;IAC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a;MAC5BS,kBAAkB,EAAER,OAAO;MAC3BS,UAAU,EAAER,MAAM;MAClBC,QAAQ;MACRC;IACF,CAAC,CAAC;IAEFV,UAAU,CAACiB,KAAK,CAACC,IAAI,CAACP,MAAM,CAACQ,OAAO,CAAC;IACrC,MAAMC,WAAW,GACfpB,UAAU,CAACiB,KAAK,CAACI,MAAM,GAAG,IAAI,CAAC/B,aAAa,GAAG,CAAC,IAAI,CAACG,eAAe,CAAC6B,iBAAiB,CAAC,GAAG,EAAE;IAE9F,OAAO;MACLH,OAAO,EAAER,MAAM,CAACQ,OAAO;MACvBI,OAAO,EAAEH,WAAW;MACpBI,QAAQ,EAAE,EAAE;MACZC,UAAU,EAAE,CAACL,WAAW,CAACC;IAC3B,CAAC;EACH,CAAC;EAEMK,WAAW,GAAG9C,YAAY,CAAC,CAAC;IAAEmB;EAAqB,CAAC,KAAK;IAC9D,IAAI,CAAChB,OAAO,CAAC4C,MAAM,CAAC5B,GAAG,CAAC;EAC1B,CAAC,CAAC;EAEK6B,QAAQA,CAAA,EAAG;IAChB,IAAI,CAAC7C,OAAO,CAAC8C,KAAK,CAAC,CAAC;EACtB;AACF","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["createEffect","createControllerEffect","replaceKatexSyntax","ChatbotAPI","constructor","api","postMessageFx","postMessage","getAlternativesFx","getAlternatives","translateTextFx","payload","response","postTranslateText","text","data","translations","map","translation","translatedText","textToSpeechTextFx","postTextToSpeech"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/api.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,UAAU;AACvC,SAASC,sBAAsB,QAAQ,gCAAuB;AAG9D,SAASC,kBAAkB,QAAQ,eAAY;AAE/C,OAAO,MAAMC,UAAU,CAAC;EAMtBC,WAAWA,CAACC,GAA6B,EAAE;IACzC,IAAI,CAACC,aAAa,GAAGL,sBAAsB,CAACI,GAAG,CAACE,WAAW,CAAC;IAC5D,IAAI,CAACC,iBAAiB,GAAGR,YAAY,CAACK,GAAG,CAACI,eAAe,CAAC;IAC1D,IAAI,CAACC,eAAe,GAAGV,YAAY,CACjC,MAAOW,OAA+B,IAAuC;MAC3E,MAAMC,QAAQ,GAAG,MAAMP,GAAG,CAACQ,iBAAiB,CAAC;QAC3C,GAAGF,OAAO;QACVG,IAAI,EAAEZ,kBAAkB,CAACS,OAAO,CAACG,IAAI;MACvC,CAAC,CAAC;MAEF,OAAO;QACL,GAAGF,QAAQ;QACXG,IAAI,EAAE;UACJ,GAAGH,QAAQ,CAACG,IAAI;UAChBC,YAAY,EAAEJ,QAAQ,CAACG,IAAI,CAACC,YAAY,CAACC,GAAG,CAAEC,WAAW,KAAM;YAC7D,GAAGA,WAAW;YACdC,cAAc,EAAEjB,kBAAkB,CAAC,CAACgB,WAAW,CAACC,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;UAC1E,CAAC,CAAC;QACJ;MACF,CAAC;IACH,CACF,CAAC;IACD,IAAI,CAACC,kBAAkB,GAAGpB,YAAY,CAACK,GAAG,CAACgB,gBAAgB,CAAC;EAC9D;AACF","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatBotMessageHandler.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/ChatBotMessageHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAG7E,KAAK,uBAAuB,GAAG;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,eAAe,CAAA;IACzB,gBAAgB,EAAE,qBAAqB,CAAA;IACvC,GAAG,EAAE;QACH,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAA;KAC/D,CAAA;CACF,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAA;IACpB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuB;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgC;IAExD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAA;IAC9B,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,cAAc,CAA4B;IAElD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAA;gBAEb,EACjB,gBAAgB,EAChB,GAAG,EACH,aAA6D,EAC7D,QAAQ,GACT,EAAE,uBAAuB;IAOnB,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;YAQ3B,aAAa;IAc3B,SAAgB,aAAa,gEAM1B,kBAAkB,KAAG,OAAO,CAAC,mBAAmB,CAAC,CAsBnD;IAEM,WAAW,uEAEhB;IAEK,QAAQ;CAGhB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAGpF,qBAAa,UAAU;IACrB,SAAgB,aAAa,6KAAA;IAC7B,SAAgB,iBAAiB,8IAAA;IACjC,SAAgB,eAAe,oFAAA;IAC/B,SAAgB,kBAAkB,kJAAA;gBAEtB,GAAG,EAAE,iBAAiB,CAAC,KAAK,CAAC;CAwB1C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatBotMessageHandler.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/ChatBotMessageHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAA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