@magmamath/students-features 0.3.2 → 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 (248) hide show
  1. package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +12 -4
  2. package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
  3. package/dist/commonjs/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
  4. package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +6 -4
  5. package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
  6. package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +12 -1
  7. package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
  8. package/dist/commonjs/features/chatbot/components/Chatbot.js +5 -1
  9. package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
  10. package/dist/commonjs/features/chatbot/context/ChatBotContext.js +17 -0
  11. package/dist/commonjs/features/chatbot/context/ChatBotContext.js.map +1 -0
  12. package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.js +58 -0
  13. package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.js.map +1 -0
  14. package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js +99 -0
  15. package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +1 -0
  16. package/dist/commonjs/features/chatbot/index.js +0 -7
  17. package/dist/commonjs/features/chatbot/index.js.map +1 -1
  18. package/dist/commonjs/features/chatbot/model/ChatBotModel.js +136 -117
  19. package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
  20. package/dist/commonjs/features/chatbot/model/{ChatBotMessageHandler.js → ChatBotThreadManager.js} +28 -17
  21. package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -0
  22. package/dist/commonjs/features/chatbot/model/{api.js → ChatbotApi.js} +16 -1
  23. package/dist/commonjs/features/chatbot/model/ChatbotApi.js.map +1 -0
  24. package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js +110 -0
  25. package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js.map +1 -0
  26. package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js +0 -1
  27. package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
  28. package/dist/commonjs/features/chatbot/model/ThreadItem.js +21 -8
  29. package/dist/commonjs/features/chatbot/model/ThreadItem.js.map +1 -1
  30. package/dist/commonjs/features/chatbot/model/messagesHelper.js +1 -5
  31. package/dist/commonjs/features/chatbot/model/messagesHelper.js.map +1 -1
  32. package/dist/commonjs/features/chatbot/model/t2s.js +0 -6
  33. package/dist/commonjs/features/chatbot/model/t2s.js.map +1 -1
  34. package/dist/commonjs/features/chatbot/model/translation.helpers.js.map +1 -1
  35. package/dist/commonjs/features/chatbot/model/translation.js +54 -45
  36. package/dist/commonjs/features/chatbot/model/translation.js.map +1 -1
  37. package/dist/commonjs/features/chatbot/types/api.types.js +4 -0
  38. package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
  39. package/dist/commonjs/features/chatbot/types/units.types.js +2 -0
  40. package/dist/commonjs/features/chatbot/types/units.types.js.map +1 -0
  41. package/dist/commonjs/features/feedback/components/TeacherFeedbackButton/colorSchemes.js +18 -9
  42. package/dist/commonjs/features/feedback/components/TeacherFeedbackButton/colorSchemes.js.map +1 -1
  43. package/dist/commonjs/lib/effector/createEntityFieldStore.js +4 -0
  44. package/dist/commonjs/lib/effector/createEntityFieldStore.js.map +1 -1
  45. package/dist/commonjs/lib/helpers/randomElements.js +24 -0
  46. package/dist/commonjs/lib/helpers/randomElements.js.map +1 -0
  47. package/dist/commonjs/shared/icons/HighlighterIcon.js +36 -0
  48. package/dist/commonjs/shared/icons/HighlighterIcon.js.map +1 -0
  49. package/dist/commonjs/shared/icons/StopIcon.js +33 -0
  50. package/dist/commonjs/shared/icons/StopIcon.js.map +1 -0
  51. package/dist/commonjs/shared/icons/icon.types.js +4 -0
  52. package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +12 -4
  53. package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
  54. package/dist/module/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
  55. package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +6 -4
  56. package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
  57. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +12 -1
  58. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
  59. package/dist/module/features/chatbot/components/Chatbot.js +6 -2
  60. package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
  61. package/dist/module/features/chatbot/context/ChatBotContext.js +12 -0
  62. package/dist/module/features/chatbot/context/ChatBotContext.js.map +1 -0
  63. package/dist/module/features/chatbot/errorSpotting/ErrorSpottingButton.js +52 -0
  64. package/dist/module/features/chatbot/errorSpotting/ErrorSpottingButton.js.map +1 -0
  65. package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js +94 -0
  66. package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +1 -0
  67. package/dist/module/features/chatbot/index.js +0 -1
  68. package/dist/module/features/chatbot/index.js.map +1 -1
  69. package/dist/module/features/chatbot/model/ChatBotModel.js +138 -119
  70. package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
  71. package/dist/module/features/chatbot/model/{ChatBotMessageHandler.js → ChatBotThreadManager.js} +26 -15
  72. package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -0
  73. package/dist/module/features/chatbot/model/{api.js → ChatbotApi.js} +16 -1
  74. package/dist/module/features/chatbot/model/ChatbotApi.js.map +1 -0
  75. package/dist/module/features/chatbot/model/ChatsCacheModel.js +104 -0
  76. package/dist/module/features/chatbot/model/ChatsCacheModel.js.map +1 -0
  77. package/dist/module/features/chatbot/model/DefaultMessageCreator.js +0 -1
  78. package/dist/module/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
  79. package/dist/module/features/chatbot/model/ThreadItem.js +21 -8
  80. package/dist/module/features/chatbot/model/ThreadItem.js.map +1 -1
  81. package/dist/module/features/chatbot/model/messagesHelper.js +1 -5
  82. package/dist/module/features/chatbot/model/messagesHelper.js.map +1 -1
  83. package/dist/module/features/chatbot/model/t2s.js +1 -7
  84. package/dist/module/features/chatbot/model/t2s.js.map +1 -1
  85. package/dist/module/features/chatbot/model/translation.helpers.js.map +1 -1
  86. package/dist/module/features/chatbot/model/translation.js +54 -45
  87. package/dist/module/features/chatbot/model/translation.js.map +1 -1
  88. package/dist/module/features/chatbot/types/api.types.js +2 -0
  89. package/dist/module/features/chatbot/types/model.types.js.map +1 -1
  90. package/dist/module/features/chatbot/types/units.types.js +2 -0
  91. package/dist/module/features/chatbot/types/units.types.js.map +1 -0
  92. package/dist/module/features/feedback/components/TeacherFeedbackButton/colorSchemes.js +18 -9
  93. package/dist/module/features/feedback/components/TeacherFeedbackButton/colorSchemes.js.map +1 -1
  94. package/dist/module/lib/effector/createEntityFieldStore.js +4 -0
  95. package/dist/module/lib/effector/createEntityFieldStore.js.map +1 -1
  96. package/dist/module/lib/helpers/randomElements.js +20 -0
  97. package/dist/module/lib/helpers/randomElements.js.map +1 -0
  98. package/dist/module/shared/icons/HighlighterIcon.js +29 -0
  99. package/dist/module/shared/icons/HighlighterIcon.js.map +1 -0
  100. package/dist/module/shared/icons/StopIcon.js +26 -0
  101. package/dist/module/shared/icons/StopIcon.js.map +1 -0
  102. package/dist/module/shared/icons/icon.types.js +2 -0
  103. package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
  104. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts +1 -0
  105. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
  106. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts +1 -1
  107. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
  108. package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
  109. package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
  110. package/dist/typescript/commonjs/features/chatbot/context/ChatBotContext.d.ts +8 -0
  111. package/dist/typescript/commonjs/features/chatbot/context/ChatBotContext.d.ts.map +1 -0
  112. package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts +3 -0
  113. package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts.map +1 -0
  114. package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +28 -0
  115. package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +1 -0
  116. package/dist/typescript/commonjs/features/chatbot/index.d.ts +4 -3
  117. package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
  118. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +19 -14
  119. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  120. package/dist/typescript/{module/features/chatbot/model/ChatBotMessageHandler.d.ts → commonjs/features/chatbot/model/ChatBotThreadManager.d.ts} +11 -8
  121. package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -0
  122. package/dist/typescript/commonjs/features/chatbot/model/{api.d.ts → ChatbotApi.d.ts} +4 -3
  123. package/dist/typescript/commonjs/features/chatbot/model/ChatbotApi.d.ts.map +1 -0
  124. package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts +26 -0
  125. package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -0
  126. package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts +3 -2
  127. package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
  128. package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts +12 -6
  129. package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts.map +1 -1
  130. package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts +3 -4
  131. package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts.map +1 -1
  132. package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts +2 -4
  133. package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts.map +1 -1
  134. package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts +7 -8
  135. package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
  136. package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts +2 -1
  137. package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts.map +1 -1
  138. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +2 -11
  139. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
  140. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +26 -19
  141. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
  142. package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts +2 -1
  143. package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts.map +1 -1
  144. package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +31 -0
  145. package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -0
  146. package/dist/typescript/commonjs/features/feedback/components/TeacherFeedbackButton/colorSchemes.d.ts.map +1 -1
  147. package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts +2 -0
  148. package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts.map +1 -1
  149. package/dist/typescript/commonjs/lib/helpers/randomElements.d.ts +2 -0
  150. package/dist/typescript/commonjs/lib/helpers/randomElements.d.ts.map +1 -0
  151. package/dist/typescript/commonjs/shared/icons/HighlighterIcon.d.ts +4 -0
  152. package/dist/typescript/commonjs/shared/icons/HighlighterIcon.d.ts.map +1 -0
  153. package/dist/typescript/commonjs/shared/icons/StopIcon.d.ts +4 -0
  154. package/dist/typescript/commonjs/shared/icons/StopIcon.d.ts.map +1 -0
  155. package/dist/typescript/commonjs/shared/icons/icon.types.d.ts +2 -0
  156. package/dist/typescript/commonjs/shared/icons/icon.types.d.ts.map +1 -1
  157. package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
  158. package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts +1 -0
  159. package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
  160. package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts +1 -1
  161. package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
  162. package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
  163. package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
  164. package/dist/typescript/module/features/chatbot/context/ChatBotContext.d.ts +8 -0
  165. package/dist/typescript/module/features/chatbot/context/ChatBotContext.d.ts.map +1 -0
  166. package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts +3 -0
  167. package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts.map +1 -0
  168. package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +28 -0
  169. package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +1 -0
  170. package/dist/typescript/module/features/chatbot/index.d.ts +4 -3
  171. package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
  172. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +19 -14
  173. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  174. package/dist/typescript/{commonjs/features/chatbot/model/ChatBotMessageHandler.d.ts → module/features/chatbot/model/ChatBotThreadManager.d.ts} +11 -8
  175. package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -0
  176. package/dist/typescript/module/features/chatbot/model/{api.d.ts → ChatbotApi.d.ts} +4 -3
  177. package/dist/typescript/module/features/chatbot/model/ChatbotApi.d.ts.map +1 -0
  178. package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts +26 -0
  179. package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -0
  180. package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts +3 -2
  181. package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
  182. package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts +12 -6
  183. package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts.map +1 -1
  184. package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts +3 -4
  185. package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts.map +1 -1
  186. package/dist/typescript/module/features/chatbot/model/t2s.d.ts +2 -4
  187. package/dist/typescript/module/features/chatbot/model/t2s.d.ts.map +1 -1
  188. package/dist/typescript/module/features/chatbot/model/translation.d.ts +7 -8
  189. package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
  190. package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts +2 -1
  191. package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts.map +1 -1
  192. package/dist/typescript/module/features/chatbot/types/api.types.d.ts +2 -11
  193. package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
  194. package/dist/typescript/module/features/chatbot/types/model.types.d.ts +26 -19
  195. package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
  196. package/dist/typescript/module/features/chatbot/types/translation.types.d.ts +2 -1
  197. package/dist/typescript/module/features/chatbot/types/translation.types.d.ts.map +1 -1
  198. package/dist/typescript/module/features/chatbot/types/units.types.d.ts +31 -0
  199. package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -0
  200. package/dist/typescript/module/features/feedback/components/TeacherFeedbackButton/colorSchemes.d.ts.map +1 -1
  201. package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts +2 -0
  202. package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts.map +1 -1
  203. package/dist/typescript/module/lib/helpers/randomElements.d.ts +2 -0
  204. package/dist/typescript/module/lib/helpers/randomElements.d.ts.map +1 -0
  205. package/dist/typescript/module/shared/icons/HighlighterIcon.d.ts +4 -0
  206. package/dist/typescript/module/shared/icons/HighlighterIcon.d.ts.map +1 -0
  207. package/dist/typescript/module/shared/icons/StopIcon.d.ts +4 -0
  208. package/dist/typescript/module/shared/icons/StopIcon.d.ts.map +1 -0
  209. package/dist/typescript/module/shared/icons/icon.types.d.ts +2 -0
  210. package/dist/typescript/module/shared/icons/icon.types.d.ts.map +1 -1
  211. package/package.json +4 -4
  212. package/src/features/chatbot/components/ChatControls/ChatControls.tsx +10 -3
  213. package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +1 -0
  214. package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +3 -0
  215. package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +14 -0
  216. package/src/features/chatbot/components/Chatbot.tsx +3 -2
  217. package/src/features/chatbot/context/ChatBotContext.ts +18 -0
  218. package/src/features/chatbot/errorSpotting/ErrorSpottingButton.tsx +53 -0
  219. package/src/features/chatbot/errorSpotting/ErrorSpottingModel.ts +116 -0
  220. package/src/features/chatbot/index.ts +3 -3
  221. package/src/features/chatbot/model/ChatBotModel.ts +123 -124
  222. package/src/features/chatbot/model/{ChatBotMessageHandler.ts → ChatBotThreadManager.ts} +28 -16
  223. package/src/features/chatbot/model/{api.ts → ChatbotApi.ts} +19 -2
  224. package/src/features/chatbot/model/ChatsCacheModel.ts +94 -0
  225. package/src/features/chatbot/model/DefaultMessageCreator.ts +3 -3
  226. package/src/features/chatbot/model/ThreadItem.ts +20 -9
  227. package/src/features/chatbot/model/messagesHelper.ts +2 -6
  228. package/src/features/chatbot/model/t2s.ts +3 -10
  229. package/src/features/chatbot/model/translation.helpers.ts +2 -1
  230. package/src/features/chatbot/model/translation.ts +52 -46
  231. package/src/features/chatbot/types/api.types.ts +2 -12
  232. package/src/features/chatbot/types/model.types.ts +38 -26
  233. package/src/features/chatbot/types/translation.types.ts +2 -1
  234. package/src/features/chatbot/types/units.types.ts +34 -0
  235. package/src/features/feedback/components/TeacherFeedbackButton/colorSchemes.ts +9 -0
  236. package/src/lib/effector/createEntityFieldStore.ts +9 -1
  237. package/src/lib/helpers/randomElements.ts +22 -0
  238. package/src/shared/icons/HighlighterIcon.tsx +21 -0
  239. package/src/shared/icons/StopIcon.tsx +17 -0
  240. package/src/shared/icons/icon.types.ts +9 -6
  241. package/dist/commonjs/features/chatbot/model/ChatBotMessageHandler.js.map +0 -1
  242. package/dist/commonjs/features/chatbot/model/api.js.map +0 -1
  243. package/dist/module/features/chatbot/model/ChatBotMessageHandler.js.map +0 -1
  244. package/dist/module/features/chatbot/model/api.js.map +0 -1
  245. package/dist/typescript/commonjs/features/chatbot/model/ChatBotMessageHandler.d.ts.map +0 -1
  246. package/dist/typescript/commonjs/features/chatbot/model/api.d.ts.map +0 -1
  247. package/dist/typescript/module/features/chatbot/model/ChatBotMessageHandler.d.ts.map +0 -1
  248. package/dist/typescript/module/features/chatbot/model/api.d.ts.map +0 -1
@@ -0,0 +1,116 @@
1
+ import { ChatbotAPI } from '../model/ChatbotApi'
2
+ import { createEvent, createStore, sample, createEffect, Store } from 'effector'
3
+ import { ChatItem } from '../types/units.types'
4
+
5
+ type ErrorSpottingProps = {
6
+ api: ChatbotAPI
7
+ $currentChatData: Store<ChatItem>
8
+ }
9
+
10
+ type ActiveErrorSpottingData = {
11
+ isActive: boolean
12
+ isDisabled: boolean
13
+ strokesIds: string[]
14
+ validationKey: null | string
15
+ }
16
+
17
+ type ErrorSpottingReducerProps = {
18
+ chatData: ChatItem
19
+ activeSpotting: ActiveErrorSpottingData | null
20
+ }
21
+
22
+ export class ErrorSpottingModel {
23
+ private readonly api: ChatbotAPI
24
+
25
+ public readonly errorSpottingPressed = createEvent()
26
+ private readonly activeDataChanged = createEvent<
27
+ | ((state: ActiveErrorSpottingData | null) => ActiveErrorSpottingData | null | void)
28
+ | ActiveErrorSpottingData
29
+ | null
30
+ >()
31
+
32
+ public readonly $validationKey = createStore<string | null>(null)
33
+ public readonly $activeData = createStore<ActiveErrorSpottingData | null>(null)
34
+ .on(this.activeDataChanged, (state, payload) => {
35
+ if (typeof payload === 'function') return payload(state)
36
+ return payload
37
+ })
38
+ .on(this.$validationKey, (state, payload) => {
39
+ if (!state || payload === null) return state
40
+ const isDisabled = payload !== state.validationKey
41
+ return { ...state, isDisabled, isActive: isDisabled ? false : state.isActive }
42
+ })
43
+
44
+ public readonly $isLoading
45
+
46
+ public constructor({ api, $currentChatData }: ErrorSpottingProps) {
47
+ this.api = api
48
+
49
+ this.$isLoading = api.spotErrorFx.pending
50
+
51
+ this.$activeData.on($currentChatData, (state, payload) => {
52
+ if (!state || state.validationKey !== payload.currentThread?.key) return null
53
+ })
54
+
55
+ sample({
56
+ clock: api.spotErrorFx.doneData,
57
+ source: {
58
+ chatData: $currentChatData,
59
+ activeSpotting: this.$activeData,
60
+ validationKey: this.$validationKey,
61
+ },
62
+ fn: (source, result) => {
63
+ const key = source.chatData.currentThread?.key || null
64
+ const currentKey = source.validationKey
65
+ const isDisabled = !!currentKey && currentKey !== key
66
+ return {
67
+ validationKey: key,
68
+ strokesIds: result.strokesIds,
69
+ isActive: !isDisabled,
70
+ isDisabled,
71
+ }
72
+ },
73
+ target: this.$activeData,
74
+ })
75
+
76
+ sample({
77
+ clock: this.errorSpottingPressed,
78
+ source: {
79
+ chatData: $currentChatData,
80
+ activeSpotting: this.$activeData,
81
+ },
82
+ fn: (source) => source,
83
+ target: createEffect(({ chatData, activeSpotting }: ErrorSpottingReducerProps) => {
84
+ if (!chatData.currentThread?.strokes) return
85
+ if (!activeSpotting) {
86
+ return this.api.spotErrorFx({ strokes: chatData.currentThread.strokes })
87
+ }
88
+ this.toggleActiveSpotting()
89
+ }),
90
+ })
91
+ }
92
+
93
+ private toggleActiveSpotting() {
94
+ this.activeDataChanged((state) => {
95
+ if (state) return { ...state, isActive: !state.isActive }
96
+ })
97
+ }
98
+
99
+ public bindStrokesValidation($store: Store<string | null>) {
100
+ sample({
101
+ source: $store,
102
+ target: this.$validationKey,
103
+ })
104
+ return this
105
+ }
106
+
107
+ public abortPendingRequest() {
108
+ const isPending = this.api.spotErrorFx.pending.getState()
109
+ if (isPending) this.api.spotErrorFx.controller.abort()
110
+ }
111
+
112
+ public reset() {
113
+ this.activeDataChanged(null)
114
+ this.abortPendingRequest()
115
+ }
116
+ }
@@ -3,11 +3,11 @@ export { ChatbotModel } from './model/ChatBotModel'
3
3
  export { AudioStatus, type AudioProvider } from './types/t2s.types'
4
4
  export {
5
5
  MessageVariant,
6
- type ConversationMessage,
7
6
  type ChatbotRenderer,
8
7
  type ChatbotModelProps,
9
8
  type IChatDrawBoardAdapter,
10
9
  } from './types/model.types'
11
- export type { PostMessageResponse, ChatAnswer } from './types/api.types'
12
- export { ChatMessageHandler } from './model/ChatBotMessageHandler'
10
+ export type { PostMessageResponse } from './types/api.types'
13
11
  export { DefaultMessagesCreator } from './model/DefaultMessageCreator'
12
+ export type { ChatAnswer } from './types/units.types'
13
+ export type { ConversationMessage } from './types/units.types'
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  attach,
3
+ combine,
4
+ createEffect,
3
5
  createEvent,
6
+ createStore,
4
7
  restore,
5
8
  sample,
6
9
  type Store,
7
- createStore,
8
- createEffect,
9
- combine,
10
10
  } from 'effector'
11
- import { createControllerEffect, createEntityFieldStore } from '../../../lib/effector'
11
+ import { createControllerEffect } from '../../../lib/effector'
12
12
  import {
13
13
  ChatbotContext,
14
14
  ChatbotModelProps,
15
- ConversationMessage,
15
+ IChatDrawBoardAdapter,
16
16
  SendHelpParams,
17
17
  SendHelpProps,
18
18
  SetHintMessageProps,
@@ -20,20 +20,26 @@ import {
20
20
  StartConversationProps,
21
21
  } from '../types/model.types'
22
22
  import { GetAlternativesResponse } from '../types/api.types'
23
- import { ChatbotAPI } from './api'
23
+ import { ChatbotAPI } from './ChatbotApi'
24
24
  import { ChatbotTranslation } from './translation'
25
25
  import { ChatTextToSpeechModel } from './t2s'
26
26
  import { AudioProvider } from '../types/t2s.types'
27
27
  import { messagesHelper } from './messagesHelper'
28
+ import { ChatBotThreadManager } from './ChatBotThreadManager'
29
+ import { ChatsCacheModel, defaultChatData } from './ChatsCacheModel'
30
+ import { ErrorSpottingModel } from '../errorSpotting/ErrorSpottingModel'
28
31
 
29
32
  type ReinitConversationProps = {
30
33
  key: string
31
34
  }
32
35
 
33
36
  export class ChatbotModel {
34
- readonly api: ChatbotAPI
35
- readonly translation: ChatbotTranslation
36
- readonly t2s: ChatTextToSpeechModel
37
+ public readonly threadManager: ChatBotThreadManager
38
+ public readonly api: ChatbotAPI
39
+
40
+ public readonly translation: ChatbotTranslation
41
+ public readonly t2s: ChatTextToSpeechModel
42
+ public readonly errorSpotting
37
43
 
38
44
  public readonly $currentKey = createStore('')
39
45
 
@@ -55,92 +61,82 @@ export class ChatbotModel {
55
61
  readonly setScrollActive = createEvent<boolean>()
56
62
  readonly $isScrollActive = restore(this.setScrollActive, false)
57
63
 
58
- readonly sendHelpRequestFx
59
-
60
64
  readonly defaultMessages: ChatbotModelProps['messages']
61
-
62
- readonly messages = createEntityFieldStore<ConversationMessage[]>()
63
- readonly threadIds = createEntityFieldStore<string>()
64
- readonly availableChats = createEntityFieldStore<boolean>()
65
+ private readonly cache = new ChatsCacheModel()
65
66
 
66
67
  public readonly $currentChatData = combine(
67
- {
68
- messages: this.messages.$state,
69
- threadIds: this.threadIds.$state,
70
- availableChats: this.availableChats.$state,
71
- key: this.$currentKey,
72
- },
73
- ({ messages, threadIds, availableChats, key }) => {
74
- return {
75
- messages: messages[key] ?? [],
76
- threadId: threadIds[key] ?? null,
77
- isAvailable: availableChats[key] ?? false,
78
- key,
79
- }
80
- },
68
+ { data: this.cache.$data, key: this.$currentKey },
69
+ ({ data, key }) => (data[key] ? { ...data[key], key } : { ...defaultChatData(), key }),
81
70
  )
82
71
 
83
- constructor({ api, messages, $key }: ChatbotModelProps) {
84
- this.api = new ChatbotAPI(api)
72
+ constructor({ api, messages, $key, threadMessagesLimit }: ChatbotModelProps) {
73
+ this.threadManager = new ChatBotThreadManager({
74
+ api: { getHint: api.requestHint },
75
+ messages,
76
+ messagesLimit: threadMessagesLimit,
77
+ })
78
+ this.api = new ChatbotAPI({ ...api, postMessage: this.threadManager.postMessage })
85
79
 
86
80
  this.defaultMessages = messages
87
- if ($key) sample({ source: $key, target: this.$currentKey })
88
-
89
81
  this.$alternatives = restore(this.api.getAlternativesFx.doneData, null)
90
82
  .on(this.setAlternatives, (_, payload) => payload)
91
83
  .reset(this.resetAlternatives)
92
84
 
85
+ this.t2s = new ChatTextToSpeechModel({ api: this.api })
93
86
  this.translation = new ChatbotTranslation({
94
87
  $context: this.$context,
95
88
  defaultMessages: messages,
96
89
  $key: this.$currentKey,
97
90
  api: this.api,
98
- messagesModel: this.messages,
99
91
  alternativesModel: {
100
92
  $store: this.$alternatives,
101
93
  set: this.setAlternatives,
102
94
  },
95
+ chats: this.cache,
96
+ })
97
+ this.errorSpotting = new ErrorSpottingModel({
98
+ api: this.api,
99
+ $currentChatData: this.$currentChatData,
103
100
  })
104
101
 
105
- this.t2s = new ChatTextToSpeechModel({ $isOpen: this.$isOpen, api: this.api })
102
+ if ($key) this.bindKey($key)
106
103
 
107
- this.sendHelpRequestFx = this.createSendHelpRequestFx()
108
- this.initChatReplyWatcher()
104
+ sample({
105
+ source: this.$isOpen.updates,
106
+ filter: (isOpen) => !isOpen,
107
+ target: this.t2s.reset,
108
+ })
109
+
110
+ sample({
111
+ clock: this.removeLastMessage,
112
+ source: [this.$lastMessageKey, this.cache.$data] as const,
113
+ fn: ([lastMessageKey, chatsData]) => {
114
+ const chat = chatsData[lastMessageKey ?? '']
115
+ if (!chat) return { key: '', data: {} }
116
+ const updatedMessages = [...chat.messages]
117
+ updatedMessages.pop()
118
+ return { key: lastMessageKey ?? '', data: { messages: updatedMessages } }
119
+ },
120
+ filter: ([lastMessageKey]) => !!lastMessageKey,
121
+ target: this.cache.update,
122
+ })
109
123
  }
110
124
 
111
125
  private createSendHelpRequestFx() {
112
126
  const effect = attach({
113
- source: [
114
- this.$currentKey,
115
- this.translation.$isTranslated,
116
- this.$currentChatData,
117
- this.$context,
118
- ],
119
- mapParams: (params: SendHelpParams, [key, isTranslated, currentData, context]) => ({
127
+ source: [this.$currentKey, this.$context],
128
+ mapParams: (params: SendHelpParams, [key, context]) => ({
120
129
  message: params.message,
121
130
  translatedMessage: params.translatedMessage,
122
131
  context,
123
132
  key,
124
- isTranslated,
125
- threadId: currentData.threadId,
126
133
  }),
127
134
  effect: createControllerEffect(
128
- async ({
129
- message,
130
- translatedMessage,
131
- key,
132
- isTranslated,
133
- threadId,
134
- context,
135
- }: SendHelpProps) => {
135
+ async ({ message, translatedMessage, key, context }: SendHelpProps) => {
136
136
  if (!context) throw new Error('Context is required')
137
137
  this.setLastMessageKey(key)
138
- this.messages.setField({
139
- key,
140
- fn: (currentMessages) => [
141
- ...(currentMessages || []),
142
- messagesHelper.createOwn({ message, translatedMessage, threadId }),
143
- ],
138
+ this.cache.addMessages(key, {
139
+ messages: [messagesHelper.createOwn({ message, translatedMessage })],
144
140
  })
145
141
 
146
142
  const response = await this.api.postMessageFx({
@@ -148,25 +144,18 @@ export class ChatbotModel {
148
144
  language: context.language,
149
145
  problemAnswer: context.problemAnswer,
150
146
  answer: context.answer,
151
- threadId,
152
147
  imageAltText: context.imageDescription,
153
148
  })
154
149
  let messages = [messagesHelper.createAnswer(response)]
155
150
  if (response.endMessage) {
156
151
  messages.push(messagesHelper.createLast(this.defaultMessages.endMessage))
157
152
  }
158
- if (isTranslated) {
159
- messages = await this.translation.translateMessagesFx({
160
- targetLanguage: context.translationTargetLanguage,
161
- messages,
162
- })
163
- }
164
-
165
- this.messages.setField({
166
- key,
167
- fn: (currentMessages) => [...(currentMessages || []), ...messages],
153
+ messages = await this.translation.applyTranslationFx({
154
+ targetLanguage: context.translationTargetLanguage,
155
+ messages,
168
156
  })
169
- this.threadIds.setField({ key, data: response.threadId })
157
+
158
+ this.cache.addMessages(key, { messages, thread: response.thread })
170
159
  },
171
160
  ),
172
161
  })
@@ -174,29 +163,39 @@ export class ChatbotModel {
174
163
  sample({
175
164
  clock: effect.fail,
176
165
  source: this.$currentChatData,
177
- fn: ({ key, messages }) => ({ key, data: [...messages, this.defaultMessages.error] }),
166
+ fn: ({ key, messages }) => ({
167
+ key,
168
+ data: { messages: [...messages, this.defaultMessages.error] },
169
+ }),
178
170
  filter: (_, { error }) => error.message !== 'Request aborted manually',
179
- target: this.messages.setField,
171
+ target: this.cache.update,
180
172
  })
181
173
 
182
174
  return effect
183
175
  }
184
176
 
185
- private initChatReplyWatcher() {
177
+ public bindKey($store: Store<string>) {
186
178
  sample({
187
- clock: this.removeLastMessage,
188
- source: [this.$lastMessageKey, this.messages.$state] as const,
189
- fn: ([lastMessageKey, messages]) => {
190
- if (!lastMessageKey) return { key: '', data: [] }
191
- const updatedMessages = [...messages[lastMessageKey]]
192
- updatedMessages.pop()
193
- return { key: lastMessageKey, data: updatedMessages }
194
- },
195
- filter: ([lastMessageKey]) => !!lastMessageKey,
196
- target: this.messages.setField,
179
+ source: $store,
180
+ target: this.$currentKey,
197
181
  })
182
+ this.threadManager.bindKeyStore($store)
183
+ return this
184
+ }
185
+
186
+ public setT2SAudioProvider(audioProvider: AudioProvider) {
187
+ this.t2s.setAudioProvider(audioProvider)
188
+ return this
198
189
  }
199
190
 
191
+ public setDrawBoardAdapter(adapter: IChatDrawBoardAdapter) {
192
+ this.threadManager.setDrawBoardAdapter(adapter)
193
+ this.errorSpotting.bindStrokesValidation(adapter.$strokesValidationKey)
194
+ return this
195
+ }
196
+
197
+ public readonly sendHelpRequestFx = this.createSendHelpRequestFx()
198
+
200
199
  public readonly startConversation = attach({
201
200
  source: this.$currentChatData,
202
201
  mapParams: (props: StartConversationProps | void, source) => ({
@@ -208,54 +207,54 @@ export class ChatbotModel {
208
207
  if (initOnly) return
209
208
  return this.reinitConversation({ key })
210
209
  }
211
- this.messages.setField({ key, data: [this.defaultMessages.start] })
212
- this.availableChats.setField({ key, data: true })
210
+ this.cache.add(key, {
211
+ messages: [this.defaultMessages.start],
212
+ isAvailable: true,
213
+ currentThread: null,
214
+ })
213
215
  }),
214
216
  })
215
217
 
216
218
  public setHintMessage({ key, ...message }: SetHintMessageProps) {
217
219
  const options = this.$alternatives.getState()?.options.hints ?? message.options
218
- this.messages.setField({
219
- key,
220
- fn: (messages) => {
221
- if (!messages || messages.length > 1) return
222
- return [{ ...message, options }]
223
- },
224
- })
220
+ this.cache.setSingleMessage(key, { ...message, options })
225
221
  }
226
222
 
227
- public readonly reinitConversation = createEffect(({ key }: ReinitConversationProps) => {
228
- this.messages.setField({
229
- key,
230
- fn: (messages) => {
231
- if (!messages?.length || messages.length === 1) return
232
- const copy = [...messages]
233
- while (copy.at(-1)?.endMessage) {
234
- copy.pop()
235
- }
236
-
237
- const lastMessage = copy.at(-1)
238
- if (!lastMessage) return
239
-
240
- copy.splice(copy.length - 1, 1, {
241
- ...lastMessage,
242
- options: [this.defaultMessages.anotherHintOption],
243
- })
244
- return copy
245
- },
246
- })
247
- })
223
+ public readonly reinitConversation = ({ key }: ReinitConversationProps) => {
224
+ this.cache.reinitChatThread(key, { initialOption: this.defaultMessages.anotherHintOption })
225
+ this.threadManager.resetThread({ key })
226
+ }
248
227
 
249
- public bindKey($store: Store<string>) {
250
- sample({
251
- source: $store,
252
- target: this.$currentKey,
253
- })
254
- return this
228
+ public disableChat(key: string) {
229
+ this.t2s.stop()
230
+ void this.t2s.reset()
231
+ this.cache.disableChat(key)
255
232
  }
256
233
 
257
- public setT2SAudioProvider(audioProvider: AudioProvider) {
258
- this.t2s.setAudioProvider(audioProvider)
259
- return this
234
+ public softReset = attach({
235
+ source: {
236
+ isLoading: this.sendHelpRequestFx.pending,
237
+ lastMessageKey: this.$lastMessageKey,
238
+ },
239
+ mapParams: (_: void, { isLoading, lastMessageKey }) => !!(isLoading && lastMessageKey),
240
+ effect: createEffect((hasPendingMessage: boolean) => {
241
+ if (hasPendingMessage) {
242
+ this.api.postMessageFx.controller.abort()
243
+ this.removeLastMessage()
244
+ }
245
+ this.errorSpotting.abortPendingRequest()
246
+
247
+ this.t2s.stop()
248
+ void this.t2s.reset()
249
+ this.translation.reset()
250
+ this.setScrollActive(false)
251
+ }),
252
+ })
253
+
254
+ public readonly reset = () => {
255
+ this.cache.reset()
256
+ this.resetAlternatives()
257
+ this.threadManager.resetAll()
258
+ this.errorSpotting.reset()
260
259
  }
261
260
  }
@@ -1,6 +1,5 @@
1
1
  import { ThreadItem } from './ThreadItem'
2
- import { Store } from 'effector'
3
- import { createEffect } from 'effector/effector.umd'
2
+ import { createStore, Store } from 'effector'
4
3
  import {
5
4
  ChatHintPayload,
6
5
  ChatHintResponse,
@@ -10,10 +9,10 @@ import {
10
9
  import { ChatbotMessages, IChatDrawBoardAdapter } from '../types/model.types'
11
10
  import { CHAT_BOT_MODEL_DEFAULTS } from './constants'
12
11
 
13
- type ChatMessageHandlerProps = {
12
+ type ChatBotThreadManagerProps = {
14
13
  messagesLimit?: number
14
+ drawBoardAdapter?: IChatDrawBoardAdapter
15
15
  messages: ChatbotMessages
16
- drawBoardAdapter: IChatDrawBoardAdapter
17
16
  api: {
18
17
  getHint: (props: ChatHintPayload) => Promise<ChatHintResponse>
19
18
  }
@@ -23,11 +22,13 @@ type ResetCacheProps = {
23
22
  key: string
24
23
  }
25
24
 
26
- export class ChatMessageHandler {
25
+ export class ChatBotThreadManager {
27
26
  private readonly api
28
- private readonly drawBoardAdapter: IChatDrawBoardAdapter
27
+ private drawBoardAdapter: IChatDrawBoardAdapter | null = null
29
28
  private readonly threads = new Map<string, ThreadItem>()
30
29
 
30
+ public readonly $threads = createStore(new Map<string, ThreadItem>())
31
+
31
32
  private readonly messagesLimit
32
33
  private currentKey = ''
33
34
  private currentBinding: null | (() => void) = null
@@ -39,9 +40,9 @@ export class ChatMessageHandler {
39
40
  api,
40
41
  messagesLimit = CHAT_BOT_MODEL_DEFAULTS.THREAD_MESSAGES_LIMIT,
41
42
  messages,
42
- }: ChatMessageHandlerProps) {
43
+ }: ChatBotThreadManagerProps) {
43
44
  this.api = api
44
- this.drawBoardAdapter = drawBoardAdapter
45
+ this.drawBoardAdapter = drawBoardAdapter ?? null
45
46
  this.messagesLimit = messagesLimit
46
47
  this.defaultMessages = messages
47
48
  }
@@ -58,9 +59,16 @@ export class ChatMessageHandler {
58
59
  const key = this.currentKey
59
60
  let threadItem = this.threads.get(key)
60
61
  if (threadItem) return threadItem
62
+ if (!this.drawBoardAdapter) {
63
+ threadItem = new ThreadItem()
64
+ this.threads.set(key, threadItem)
65
+ return threadItem
66
+ }
61
67
  try {
62
- const strokes = await this.drawBoardAdapter.getVisibleStrokes()
63
- threadItem = new ThreadItem({ strokes })
68
+ const result = await this.drawBoardAdapter.getVisibleStrokes()
69
+ threadItem = new ThreadItem(
70
+ result ? { strokes: result.strokes, key: result.validationKey } : null,
71
+ )
64
72
  } catch {
65
73
  threadItem = new ThreadItem()
66
74
  }
@@ -68,7 +76,11 @@ export class ChatMessageHandler {
68
76
  return threadItem
69
77
  }
70
78
 
71
- public readonly postMessageFx = async ({
79
+ public setDrawBoardAdapter(adapter: IChatDrawBoardAdapter) {
80
+ this.drawBoardAdapter = adapter
81
+ }
82
+
83
+ public readonly postMessage = async ({
72
84
  problemAnswer,
73
85
  problem,
74
86
  answer,
@@ -86,21 +98,21 @@ export class ChatMessageHandler {
86
98
  imageAltText,
87
99
  })
88
100
 
89
- threadItem.hints.push(result.message)
101
+ threadItem.history.push(result.message)
90
102
  const nextOptions =
91
- threadItem.hints.length < this.messagesLimit ? [this.defaultMessages.anotherHintOption] : []
103
+ threadItem.history.length < this.messagesLimit ? [this.defaultMessages.anotherHintOption] : []
92
104
 
93
105
  return {
94
106
  message: result.message,
95
107
  options: nextOptions,
96
- threadId: '',
97
108
  endMessage: !nextOptions.length,
109
+ thread: threadItem.toObject(),
98
110
  }
99
111
  }
100
112
 
101
- public resetThread = createEffect(({ key }: ResetCacheProps) => {
113
+ public resetThread = ({ key }: ResetCacheProps) => {
102
114
  this.threads.delete(key)
103
- })
115
+ }
104
116
 
105
117
  public resetAll() {
106
118
  this.threads.clear()
@@ -1,8 +1,9 @@
1
1
  import { createEffect } from 'effector'
2
2
  import { createControllerEffect } from '../../../lib/effector'
3
- import { ChatbotModelProps } from '../types/model.types'
3
+ import { ChatbotApiRequests, SpotErrorPayload, SpotErrorResponse } from '../types/model.types'
4
4
  import { GoogleTranslatePayload, GoogleTranslateResponse } from '../types/api.types'
5
5
  import { replaceKatexSyntax } from '../helpers'
6
+ import { getRandomElements } from '../../../lib/helpers/randomElements'
6
7
 
7
8
  export class ChatbotAPI {
8
9
  public readonly postMessageFx
@@ -10,7 +11,23 @@ export class ChatbotAPI {
10
11
  public readonly translateTextFx
11
12
  public readonly textToSpeechTextFx
12
13
 
13
- constructor(api: ChatbotModelProps['api']) {
14
+ public readonly spotErrorFx
15
+
16
+ constructor(api: ChatbotApiRequests) {
17
+ this.spotErrorFx = createControllerEffect(
18
+ (props: SpotErrorPayload): Promise<SpotErrorResponse> => {
19
+ return new Promise<SpotErrorResponse>((res) => {
20
+ if (props.strokes.length <= 3) return res({ strokesIds: [] })
21
+ setTimeout(() => {
22
+ const randomStrokes = getRandomElements(props.strokes, 4)
23
+ res({
24
+ strokesIds: randomStrokes.map((stroke) => stroke.id ?? ''),
25
+ })
26
+ }, 1000)
27
+ })
28
+ },
29
+ )
30
+ // this.spotErrorFx = createControllerEffect(api.spotError)
14
31
  this.postMessageFx = createControllerEffect(api.postMessage)
15
32
  this.getAlternativesFx = createEffect(api.getAlternatives)
16
33
  this.translateTextFx = createEffect(