@magmamath/students-features 0.4.5 → 0.5.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js +2 -1
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.js +41 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +30 -47
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +32 -32
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/SentMessage.js +11 -13
- package/dist/commonjs/features/chatbot/components/ChatMessage/SentMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +8 -28
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +5 -7
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/context/ChatBotModelContext.js +17 -0
- package/dist/commonjs/features/chatbot/context/ChatBotModelContext.js.map +1 -0
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.js +57 -0
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.js.map +1 -0
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js +130 -0
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +1 -0
- package/dist/commonjs/features/chatbot/index.js +0 -7
- package/dist/commonjs/features/chatbot/index.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +147 -122
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/{ChatBotMessageHandler.js → ChatBotThreadManager.js} +44 -22
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js +22 -0
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/{api.js → ChatbotApi.js} +15 -1
- package/dist/commonjs/features/chatbot/model/ChatbotApi.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js +110 -0
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js +12 -12
- package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ThreadItem.js +16 -8
- package/dist/commonjs/features/chatbot/model/ThreadItem.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/constants.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/messagesHelper.js +7 -7
- package/dist/commonjs/features/chatbot/model/messagesHelper.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/t2s.js +18 -13
- package/dist/commonjs/features/chatbot/model/t2s.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/translation.helpers.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/translation.js +54 -45
- package/dist/commonjs/features/chatbot/model/translation.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/api.types.js +4 -0
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/units.types.js +2 -0
- package/dist/commonjs/features/chatbot/types/units.types.js.map +1 -0
- package/dist/commonjs/index.js +0 -24
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/lib/effector/createEntityFieldStore.js +4 -0
- package/dist/commonjs/lib/effector/createEntityFieldStore.js.map +1 -1
- package/dist/commonjs/lib/effector/withEvent.js +13 -0
- package/dist/commonjs/lib/effector/withEvent.js.map +1 -0
- package/dist/commonjs/lib/helpers/helpers.js +1 -3
- package/dist/commonjs/lib/helpers/helpers.js.map +1 -1
- package/dist/commonjs/lib/helpers/randomElements.js +24 -0
- package/dist/commonjs/lib/helpers/randomElements.js.map +1 -0
- package/dist/commonjs/lib/types/keys.js +2 -0
- package/dist/commonjs/lib/types/keys.js.map +1 -0
- package/dist/commonjs/shared/icons/HighlighterIcon.js +36 -0
- package/dist/commonjs/shared/icons/HighlighterIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/{Valentine.js → StopIcon.js} +12 -9
- package/dist/commonjs/shared/icons/StopIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/icon.types.js +4 -0
- package/dist/commonjs/shared/translation/constants.js +3 -3
- package/dist/commonjs/shared/translation/constants.js.map +1 -1
- package/dist/commonjs/shared/translation/helpers.js +22 -6
- package/dist/commonjs/shared/translation/helpers.js.map +1 -1
- package/dist/commonjs/shared/translation/hooks.js +3 -5
- package/dist/commonjs/shared/translation/hooks.js.map +1 -1
- package/{src/lib → dist/commonjs/shared/translation}/localization/en.json +8 -1
- package/dist/{module/lib → commonjs/shared/translation}/localization/gb.json +8 -1
- package/dist/commonjs/{lib → shared/translation}/localization/sw.json +8 -1
- package/dist/commonjs/shared/translation/model.js +1 -1
- package/dist/commonjs/shared/translation/model.js.map +1 -1
- package/dist/commonjs/shared/translation/types.js +1 -1
- package/dist/commonjs/shared/translation/types.js.map +1 -1
- package/dist/commonjs/shared/translation/validation.types.js +6 -0
- package/dist/commonjs/shared/translation/validation.types.js.map +1 -0
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +2 -1
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.js +35 -0
- package/dist/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +31 -48
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +32 -32
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/SentMessage.js +11 -13
- package/dist/module/features/chatbot/components/ChatMessage/SentMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +8 -28
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +6 -8
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/context/ChatBotModelContext.js +12 -0
- package/dist/module/features/chatbot/context/ChatBotModelContext.js.map +1 -0
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingButton.js +51 -0
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingButton.js.map +1 -0
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js +125 -0
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +1 -0
- package/dist/module/features/chatbot/index.js +0 -1
- package/dist/module/features/chatbot/index.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotModel.js +149 -124
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/{ChatBotMessageHandler.js → ChatBotThreadManager.js} +42 -20
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -0
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js +17 -0
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js.map +1 -0
- package/dist/module/features/chatbot/model/{api.js → ChatbotApi.js} +15 -1
- package/dist/module/features/chatbot/model/ChatbotApi.js.map +1 -0
- package/dist/module/features/chatbot/model/ChatsCacheModel.js +104 -0
- package/dist/module/features/chatbot/model/ChatsCacheModel.js.map +1 -0
- package/dist/module/features/chatbot/model/DefaultMessageCreator.js +12 -12
- package/dist/module/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
- package/dist/module/features/chatbot/model/ThreadItem.js +16 -8
- package/dist/module/features/chatbot/model/ThreadItem.js.map +1 -1
- package/dist/module/features/chatbot/model/constants.js.map +1 -1
- package/dist/module/features/chatbot/model/messagesHelper.js +7 -7
- package/dist/module/features/chatbot/model/messagesHelper.js.map +1 -1
- package/dist/module/features/chatbot/model/t2s.js +19 -14
- package/dist/module/features/chatbot/model/t2s.js.map +1 -1
- package/dist/module/features/chatbot/model/translation.helpers.js.map +1 -1
- package/dist/module/features/chatbot/model/translation.js +54 -45
- package/dist/module/features/chatbot/model/translation.js.map +1 -1
- package/dist/module/features/chatbot/types/api.types.js +2 -0
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/features/chatbot/types/units.types.js +2 -0
- package/dist/module/features/chatbot/types/units.types.js.map +1 -0
- package/dist/module/index.js +0 -2
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/effector/createEntityFieldStore.js +4 -0
- package/dist/module/lib/effector/createEntityFieldStore.js.map +1 -1
- package/dist/module/lib/effector/withEvent.js +9 -0
- package/dist/module/lib/effector/withEvent.js.map +1 -0
- package/dist/module/lib/helpers/helpers.js +0 -1
- package/dist/module/lib/helpers/helpers.js.map +1 -1
- package/dist/module/lib/helpers/randomElements.js +20 -0
- package/dist/module/lib/helpers/randomElements.js.map +1 -0
- package/dist/module/lib/types/keys.js +2 -0
- package/dist/module/lib/types/keys.js.map +1 -0
- package/dist/module/shared/icons/HighlighterIcon.js +29 -0
- package/dist/module/shared/icons/HighlighterIcon.js.map +1 -0
- package/dist/module/shared/icons/StopIcon.js +26 -0
- package/dist/module/shared/icons/StopIcon.js.map +1 -0
- package/dist/module/shared/icons/icon.types.js +2 -0
- package/dist/module/shared/translation/constants.js +3 -3
- package/dist/module/shared/translation/constants.js.map +1 -1
- package/dist/module/shared/translation/helpers.js +19 -5
- package/dist/module/shared/translation/helpers.js.map +1 -1
- package/dist/module/shared/translation/hooks.js +4 -6
- package/dist/module/shared/translation/hooks.js.map +1 -1
- package/dist/{commonjs/lib → module/shared/translation}/localization/en.json +8 -1
- package/{src/lib → dist/module/shared/translation}/localization/gb.json +8 -1
- package/dist/module/{lib → shared/translation}/localization/sw.json +8 -1
- package/dist/module/shared/translation/model.js +1 -1
- package/dist/module/shared/translation/model.js.map +1 -1
- package/dist/module/shared/translation/types.js +2 -0
- package/dist/module/shared/translation/types.js.map +1 -1
- package/dist/module/shared/translation/validation.types.js +4 -0
- package/dist/module/shared/translation/validation.types.js.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts +1 -3
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts +5 -5
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts +11 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts +7 -3
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/SentMessage.d.ts +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/SentMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts +2 -10
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +2 -5
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/context/ChatBotModelContext.d.ts +4 -0
- package/dist/typescript/commonjs/features/chatbot/context/ChatBotModelContext.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts +8 -0
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +35 -0
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +4 -3
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +24 -18
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts +33 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatBoxTextManager.d.ts +6 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatBoxTextManager.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/{api.d.ts → ChatbotApi.d.ts} +4 -3
- package/dist/typescript/commonjs/features/chatbot/model/ChatbotApi.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts +27 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts +5 -3
- package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts +13 -7
- package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts +7 -5
- package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts +16 -6
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts +7 -8
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts +2 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +12 -11
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +19 -24
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/t2s.types.d.ts +2 -7
- package/dist/typescript/commonjs/features/chatbot/types/t2s.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts +2 -1
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +34 -0
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/index.d.ts +0 -3
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts +2 -0
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/effector/withEvent.d.ts +2 -0
- package/dist/typescript/commonjs/lib/effector/withEvent.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/helpers/helpers.d.ts +0 -1
- package/dist/typescript/commonjs/lib/helpers/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/helpers/randomElements.d.ts +2 -0
- package/dist/typescript/commonjs/lib/helpers/randomElements.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/types/keys.d.ts +8 -0
- package/dist/typescript/commonjs/lib/types/keys.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/HighlighterIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/HighlighterIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/StopIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/StopIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/icon.types.d.ts +2 -0
- package/dist/typescript/commonjs/shared/icons/icon.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +21 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/helpers.d.ts +3 -2
- package/dist/typescript/commonjs/shared/translation/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/hooks.d.ts +2 -2
- package/dist/typescript/commonjs/shared/translation/hooks.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/index.d.ts +0 -1
- package/dist/typescript/commonjs/shared/translation/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +43 -3
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/types.d.ts +4 -4
- package/dist/typescript/commonjs/shared/translation/types.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/validation.types.d.ts +17 -0
- package/dist/typescript/commonjs/shared/translation/validation.types.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts +1 -3
- package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts +5 -5
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts +11 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts +7 -3
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/SentMessage.d.ts +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/SentMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts +2 -10
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +2 -5
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/context/ChatBotModelContext.d.ts +4 -0
- package/dist/typescript/module/features/chatbot/context/ChatBotModelContext.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts +8 -0
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +35 -0
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/index.d.ts +4 -3
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +24 -18
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts +33 -0
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatBoxTextManager.d.ts +6 -0
- package/dist/typescript/module/features/chatbot/model/ChatBoxTextManager.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/{api.d.ts → ChatbotApi.d.ts} +4 -3
- package/dist/typescript/module/features/chatbot/model/ChatbotApi.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts +27 -0
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts +5 -3
- package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts +13 -7
- package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts +7 -5
- package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts +16 -6
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/translation.d.ts +7 -8
- package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts +2 -1
- package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +12 -11
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts +19 -24
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/t2s.types.d.ts +2 -7
- package/dist/typescript/module/features/chatbot/types/t2s.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts +2 -1
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts +34 -0
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -0
- package/dist/typescript/module/index.d.ts +0 -3
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts +2 -0
- package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts.map +1 -1
- package/dist/typescript/module/lib/effector/withEvent.d.ts +2 -0
- package/dist/typescript/module/lib/effector/withEvent.d.ts.map +1 -0
- package/dist/typescript/module/lib/helpers/helpers.d.ts +0 -1
- package/dist/typescript/module/lib/helpers/helpers.d.ts.map +1 -1
- package/dist/typescript/module/lib/helpers/randomElements.d.ts +2 -0
- package/dist/typescript/module/lib/helpers/randomElements.d.ts.map +1 -0
- package/dist/typescript/module/lib/types/keys.d.ts +8 -0
- package/dist/typescript/module/lib/types/keys.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/HighlighterIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/HighlighterIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/StopIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/StopIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/icon.types.d.ts +2 -0
- package/dist/typescript/module/shared/icons/icon.types.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/constants.d.ts +21 -0
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/helpers.d.ts +3 -2
- package/dist/typescript/module/shared/translation/helpers.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/hooks.d.ts +2 -2
- package/dist/typescript/module/shared/translation/hooks.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/index.d.ts +0 -1
- package/dist/typescript/module/shared/translation/index.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +43 -3
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/types.d.ts +4 -4
- package/dist/typescript/module/shared/translation/types.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/validation.types.d.ts +17 -0
- package/dist/typescript/module/shared/translation/validation.types.d.ts.map +1 -0
- package/package.json +3 -6
- package/src/features/chatbot/components/Alternatives/Alternatives.tsx +2 -4
- package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +5 -5
- package/src/features/chatbot/components/ChatMessage/MessageButtonsBlock.tsx +36 -0
- package/src/features/chatbot/components/ChatMessage/MessageTextToSpeech.tsx +37 -47
- package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +27 -26
- package/src/features/chatbot/components/ChatMessage/SentMessage.tsx +9 -9
- package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +9 -31
- package/src/features/chatbot/components/Chatbot.tsx +5 -11
- package/src/features/chatbot/context/ChatBotModelContext.ts +14 -0
- package/src/features/chatbot/errorSpotting/ErrorSpottingButton.tsx +53 -0
- package/src/features/chatbot/errorSpotting/ErrorSpottingModel.ts +150 -0
- package/src/features/chatbot/index.ts +3 -4
- package/src/features/chatbot/model/ChatBotModel.ts +141 -133
- package/src/features/chatbot/model/{ChatBotMessageHandler.ts → ChatBotThreadManager.ts} +53 -27
- package/src/features/chatbot/model/ChatBoxTextManager.ts +18 -0
- package/src/features/chatbot/model/{api.ts → ChatbotApi.ts} +18 -2
- package/src/features/chatbot/model/ChatsCacheModel.ts +95 -0
- package/src/features/chatbot/model/DefaultMessageCreator.ts +17 -16
- package/src/features/chatbot/model/ThreadItem.ts +15 -10
- package/src/features/chatbot/model/constants.ts +2 -0
- package/src/features/chatbot/model/messagesHelper.ts +12 -7
- package/src/features/chatbot/model/t2s.ts +28 -13
- package/src/features/chatbot/model/translation.helpers.ts +2 -1
- package/src/features/chatbot/model/translation.ts +52 -46
- package/src/features/chatbot/types/api.types.ts +12 -12
- package/src/features/chatbot/types/model.types.ts +31 -32
- package/src/features/chatbot/types/t2s.types.ts +10 -15
- package/src/features/chatbot/types/translation.types.ts +2 -1
- package/src/features/chatbot/types/units.types.ts +37 -0
- package/src/index.ts +0 -3
- package/src/lib/effector/createEntityFieldStore.ts +9 -1
- package/src/lib/effector/withEvent.ts +7 -0
- package/src/lib/helpers/helpers.ts +0 -2
- package/src/lib/helpers/randomElements.ts +22 -0
- package/src/lib/types/keys.ts +18 -0
- package/src/shared/icons/HighlighterIcon.tsx +21 -0
- package/src/shared/icons/StopIcon.tsx +17 -0
- package/src/shared/icons/icon.types.ts +9 -6
- package/src/shared/translation/constants.ts +3 -3
- package/src/shared/translation/helpers.ts +22 -9
- package/src/shared/translation/hooks.ts +12 -16
- package/src/shared/translation/index.ts +0 -1
- package/{dist/module/lib → src/shared/translation}/localization/en.json +8 -1
- package/{dist/commonjs/lib → src/shared/translation}/localization/gb.json +8 -1
- package/src/{lib → shared/translation}/localization/sw.json +8 -1
- package/src/shared/translation/model.ts +8 -8
- package/src/shared/translation/types.ts +11 -8
- package/src/shared/translation/validation.types.ts +26 -0
- package/dist/commonjs/features/celebrations/components/Celebrations.js +0 -51
- package/dist/commonjs/features/celebrations/components/Celebrations.js.map +0 -1
- package/dist/commonjs/features/celebrations/components/Particle.js +0 -85
- package/dist/commonjs/features/celebrations/components/Particle.js.map +0 -1
- package/dist/commonjs/features/celebrations/components/ParticleBatch.js +0 -47
- package/dist/commonjs/features/celebrations/components/ParticleBatch.js.map +0 -1
- package/dist/commonjs/features/celebrations/components/Spark.js +0 -23
- package/dist/commonjs/features/celebrations/components/Spark.js.map +0 -1
- package/dist/commonjs/features/celebrations/config.js +0 -224
- package/dist/commonjs/features/celebrations/config.js.map +0 -1
- package/dist/commonjs/features/celebrations/helpers.js +0 -99
- package/dist/commonjs/features/celebrations/helpers.js.map +0 -1
- package/dist/commonjs/features/celebrations/index.js +0 -28
- package/dist/commonjs/features/celebrations/index.js.map +0 -1
- package/dist/commonjs/features/celebrations/types.js +0 -15
- package/dist/commonjs/features/celebrations/types.js.map +0 -1
- package/dist/commonjs/features/chatbot/model/ChatBotMessageHandler.js.map +0 -1
- package/dist/commonjs/features/chatbot/model/api.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/CheatDetected/CheatDetected.js +0 -65
- package/dist/commonjs/features/endOfAssignment/components/CheatDetected/CheatDetected.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.js +0 -255
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js +0 -133
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswerSparks.js +0 -56
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswerSparks.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/GoodDrawingSparks.js +0 -68
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/GoodDrawingSparks.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/Spark.js +0 -53
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/Spark.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/EOAModal.js +0 -47
- package/dist/commonjs/features/endOfAssignment/components/EOAModal.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/ExamLeave/ExamLeave.js +0 -76
- package/dist/commonjs/features/endOfAssignment/components/ExamLeave/ExamLeave.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/ExamPaused/ExamPaused.js +0 -62
- package/dist/commonjs/features/endOfAssignment/components/ExamPaused/ExamPaused.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/ExamSubmit/ExamSubmit.js +0 -109
- package/dist/commonjs/features/endOfAssignment/components/ExamSubmit/ExamSubmit.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/ExamSubmit/ExamSubmitContent.js +0 -83
- package/dist/commonjs/features/endOfAssignment/components/ExamSubmit/ExamSubmitContent.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/ExamSubmit/blurred-card.png +0 -0
- package/dist/commonjs/features/endOfAssignment/components/Modal/Modal.js +0 -96
- package/dist/commonjs/features/endOfAssignment/components/Modal/Modal.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/Modal/ModalBackground.js +0 -44
- package/dist/commonjs/features/endOfAssignment/components/Modal/ModalBackground.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/Modal/assets/SunrisingIcon.js +0 -233
- package/dist/commonjs/features/endOfAssignment/components/Modal/assets/SunrisingIcon.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/Modal/assets/TrophyIcon.js +0 -63
- package/dist/commonjs/features/endOfAssignment/components/Modal/assets/TrophyIcon.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/Modal/model.js +0 -34
- package/dist/commonjs/features/endOfAssignment/components/Modal/model.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswer.js +0 -108
- package/dist/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswer.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswerContent.js +0 -107
- package/dist/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswerContent.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/constants.js +0 -55
- package/dist/commonjs/features/endOfAssignment/constants.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/helpers.js +0 -64
- package/dist/commonjs/features/endOfAssignment/helpers.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/hooks/useSparkAnimation.js +0 -51
- package/dist/commonjs/features/endOfAssignment/hooks/useSparkAnimation.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/index.js +0 -40
- package/dist/commonjs/features/endOfAssignment/index.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/model/model.js +0 -53
- package/dist/commonjs/features/endOfAssignment/model/model.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/types.js +0 -33
- package/dist/commonjs/features/endOfAssignment/types.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/ui/EOABadge.js +0 -43
- package/dist/commonjs/features/endOfAssignment/ui/EOABadge.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/ui/PracticeButton.js +0 -30
- package/dist/commonjs/features/endOfAssignment/ui/PracticeButton.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/ui/PracticeButtonGroup.js +0 -64
- package/dist/commonjs/features/endOfAssignment/ui/PracticeButtonGroup.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/ui/SparkIcon.js +0 -29
- package/dist/commonjs/features/endOfAssignment/ui/SparkIcon.js.map +0 -1
- package/dist/commonjs/features/endOfAssignment/ui/ThumbUpIcon.js +0 -32
- package/dist/commonjs/features/endOfAssignment/ui/ThumbUpIcon.js.map +0 -1
- package/dist/commonjs/lib/constants.js +0 -11
- package/dist/commonjs/lib/constants.js.map +0 -1
- package/dist/commonjs/shared/hooks/useKeyDownListener.js +0 -27
- package/dist/commonjs/shared/hooks/useKeyDownListener.js.map +0 -1
- package/dist/commonjs/shared/hooks/useKeyboard.js +0 -23
- package/dist/commonjs/shared/hooks/useKeyboard.js.map +0 -1
- package/dist/commonjs/shared/icons/Halloween.js +0 -54
- package/dist/commonjs/shared/icons/Halloween.js.map +0 -1
- package/dist/commonjs/shared/icons/Pi.js +0 -30
- package/dist/commonjs/shared/icons/Pi.js.map +0 -1
- package/dist/commonjs/shared/icons/Star.js +0 -30
- package/dist/commonjs/shared/icons/Star.js.map +0 -1
- package/dist/commonjs/shared/icons/Valentine.js.map +0 -1
- package/dist/commonjs/shared/icons/Winter.js +0 -32
- package/dist/commonjs/shared/icons/Winter.js.map +0 -1
- package/dist/module/features/celebrations/components/Celebrations.js +0 -45
- package/dist/module/features/celebrations/components/Celebrations.js.map +0 -1
- package/dist/module/features/celebrations/components/Particle.js +0 -77
- package/dist/module/features/celebrations/components/Particle.js.map +0 -1
- package/dist/module/features/celebrations/components/ParticleBatch.js +0 -40
- package/dist/module/features/celebrations/components/ParticleBatch.js.map +0 -1
- package/dist/module/features/celebrations/components/Spark.js +0 -17
- package/dist/module/features/celebrations/components/Spark.js.map +0 -1
- package/dist/module/features/celebrations/config.js +0 -219
- package/dist/module/features/celebrations/config.js.map +0 -1
- package/dist/module/features/celebrations/helpers.js +0 -92
- package/dist/module/features/celebrations/helpers.js.map +0 -1
- package/dist/module/features/celebrations/index.js +0 -5
- package/dist/module/features/celebrations/index.js.map +0 -1
- package/dist/module/features/celebrations/types.js +0 -11
- package/dist/module/features/celebrations/types.js.map +0 -1
- package/dist/module/features/chatbot/model/ChatBotMessageHandler.js.map +0 -1
- package/dist/module/features/chatbot/model/api.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/CheatDetected/CheatDetected.js +0 -59
- package/dist/module/features/endOfAssignment/components/CheatDetected/CheatDetected.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.js +0 -249
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js +0 -126
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswerSparks.js +0 -50
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswerSparks.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/GoodDrawingSparks.js +0 -62
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/GoodDrawingSparks.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/Spark.js +0 -47
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/Spark.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/EOAModal.js +0 -41
- package/dist/module/features/endOfAssignment/components/EOAModal.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/ExamLeave/ExamLeave.js +0 -70
- package/dist/module/features/endOfAssignment/components/ExamLeave/ExamLeave.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/ExamPaused/ExamPaused.js +0 -56
- package/dist/module/features/endOfAssignment/components/ExamPaused/ExamPaused.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/ExamSubmit/ExamSubmit.js +0 -103
- package/dist/module/features/endOfAssignment/components/ExamSubmit/ExamSubmit.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/ExamSubmit/ExamSubmitContent.js +0 -77
- package/dist/module/features/endOfAssignment/components/ExamSubmit/ExamSubmitContent.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/ExamSubmit/blurred-card.png +0 -0
- package/dist/module/features/endOfAssignment/components/Modal/Modal.js +0 -89
- package/dist/module/features/endOfAssignment/components/Modal/Modal.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/Modal/ModalBackground.js +0 -38
- package/dist/module/features/endOfAssignment/components/Modal/ModalBackground.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/Modal/assets/SunrisingIcon.js +0 -226
- package/dist/module/features/endOfAssignment/components/Modal/assets/SunrisingIcon.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/Modal/assets/TrophyIcon.js +0 -56
- package/dist/module/features/endOfAssignment/components/Modal/assets/TrophyIcon.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/Modal/model.js +0 -29
- package/dist/module/features/endOfAssignment/components/Modal/model.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/NoAnswer/NoAnswer.js +0 -102
- package/dist/module/features/endOfAssignment/components/NoAnswer/NoAnswer.js.map +0 -1
- package/dist/module/features/endOfAssignment/components/NoAnswer/NoAnswerContent.js +0 -100
- package/dist/module/features/endOfAssignment/components/NoAnswer/NoAnswerContent.js.map +0 -1
- package/dist/module/features/endOfAssignment/constants.js +0 -51
- package/dist/module/features/endOfAssignment/constants.js.map +0 -1
- package/dist/module/features/endOfAssignment/helpers.js +0 -58
- package/dist/module/features/endOfAssignment/helpers.js.map +0 -1
- package/dist/module/features/endOfAssignment/hooks/useSparkAnimation.js +0 -46
- package/dist/module/features/endOfAssignment/hooks/useSparkAnimation.js.map +0 -1
- package/dist/module/features/endOfAssignment/index.js +0 -6
- package/dist/module/features/endOfAssignment/index.js.map +0 -1
- package/dist/module/features/endOfAssignment/model/model.js +0 -48
- package/dist/module/features/endOfAssignment/model/model.js.map +0 -1
- package/dist/module/features/endOfAssignment/types.js +0 -29
- package/dist/module/features/endOfAssignment/types.js.map +0 -1
- package/dist/module/features/endOfAssignment/ui/EOABadge.js +0 -37
- package/dist/module/features/endOfAssignment/ui/EOABadge.js.map +0 -1
- package/dist/module/features/endOfAssignment/ui/PracticeButton.js +0 -24
- package/dist/module/features/endOfAssignment/ui/PracticeButton.js.map +0 -1
- package/dist/module/features/endOfAssignment/ui/PracticeButtonGroup.js +0 -57
- package/dist/module/features/endOfAssignment/ui/PracticeButtonGroup.js.map +0 -1
- package/dist/module/features/endOfAssignment/ui/SparkIcon.js +0 -21
- package/dist/module/features/endOfAssignment/ui/SparkIcon.js.map +0 -1
- package/dist/module/features/endOfAssignment/ui/ThumbUpIcon.js +0 -24
- package/dist/module/features/endOfAssignment/ui/ThumbUpIcon.js.map +0 -1
- package/dist/module/lib/constants.js +0 -7
- package/dist/module/lib/constants.js.map +0 -1
- package/dist/module/shared/hooks/useKeyDownListener.js +0 -22
- package/dist/module/shared/hooks/useKeyDownListener.js.map +0 -1
- package/dist/module/shared/hooks/useKeyboard.js +0 -20
- package/dist/module/shared/hooks/useKeyboard.js.map +0 -1
- package/dist/module/shared/icons/Halloween.js +0 -47
- package/dist/module/shared/icons/Halloween.js.map +0 -1
- package/dist/module/shared/icons/Pi.js +0 -23
- package/dist/module/shared/icons/Pi.js.map +0 -1
- package/dist/module/shared/icons/Star.js +0 -23
- package/dist/module/shared/icons/Star.js.map +0 -1
- package/dist/module/shared/icons/Valentine.js +0 -23
- package/dist/module/shared/icons/Valentine.js.map +0 -1
- package/dist/module/shared/icons/Winter.js +0 -25
- package/dist/module/shared/icons/Winter.js.map +0 -1
- package/dist/typescript/commonjs/features/celebrations/components/Celebrations.d.ts +0 -10
- package/dist/typescript/commonjs/features/celebrations/components/Celebrations.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/celebrations/components/Particle.d.ts +0 -20
- package/dist/typescript/commonjs/features/celebrations/components/Particle.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/celebrations/components/ParticleBatch.d.ts +0 -26
- package/dist/typescript/commonjs/features/celebrations/components/ParticleBatch.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/celebrations/components/Spark.d.ts +0 -4
- package/dist/typescript/commonjs/features/celebrations/components/Spark.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/celebrations/config.d.ts +0 -192
- package/dist/typescript/commonjs/features/celebrations/config.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/celebrations/helpers.d.ts +0 -6
- package/dist/typescript/commonjs/features/celebrations/helpers.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/celebrations/index.d.ts +0 -3
- package/dist/typescript/commonjs/features/celebrations/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/celebrations/types.d.ts +0 -11
- package/dist/typescript/commonjs/features/celebrations/types.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotMessageHandler.d.ts +0 -31
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotMessageHandler.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/api.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/CheatDetected/CheatDetected.d.ts +0 -4
- package/dist/typescript/commonjs/features/endOfAssignment/components/CheatDetected/CheatDetected.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.d.ts +0 -15
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.d.ts +0 -4
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswerSparks.d.ts +0 -8
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswerSparks.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/GoodDrawingSparks.d.ts +0 -8
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/GoodDrawingSparks.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/Spark.d.ts +0 -12
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/Spark.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/EOAModal.d.ts +0 -11
- package/dist/typescript/commonjs/features/endOfAssignment/components/EOAModal.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/ExamLeave/ExamLeave.d.ts +0 -4
- package/dist/typescript/commonjs/features/endOfAssignment/components/ExamLeave/ExamLeave.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/ExamPaused/ExamPaused.d.ts +0 -4
- package/dist/typescript/commonjs/features/endOfAssignment/components/ExamPaused/ExamPaused.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/ExamSubmit/ExamSubmit.d.ts +0 -4
- package/dist/typescript/commonjs/features/endOfAssignment/components/ExamSubmit/ExamSubmit.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/ExamSubmit/ExamSubmitContent.d.ts +0 -8
- package/dist/typescript/commonjs/features/endOfAssignment/components/ExamSubmit/ExamSubmitContent.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/Modal.d.ts +0 -20
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/Modal.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/ModalBackground.d.ts +0 -3
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/ModalBackground.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/assets/SunrisingIcon.d.ts +0 -4
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/assets/SunrisingIcon.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/assets/TrophyIcon.d.ts +0 -4
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/assets/TrophyIcon.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/model.d.ts +0 -14
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/model.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswer.d.ts +0 -4
- package/dist/typescript/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswer.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswerContent.d.ts +0 -8
- package/dist/typescript/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswerContent.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/constants.d.ts +0 -41
- package/dist/typescript/commonjs/features/endOfAssignment/constants.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/helpers.d.ts +0 -9
- package/dist/typescript/commonjs/features/endOfAssignment/helpers.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/hooks/useSparkAnimation.d.ts +0 -27
- package/dist/typescript/commonjs/features/endOfAssignment/hooks/useSparkAnimation.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/index.d.ts +0 -4
- package/dist/typescript/commonjs/features/endOfAssignment/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/model/model.d.ts +0 -14
- package/dist/typescript/commonjs/features/endOfAssignment/model/model.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/types.d.ts +0 -60
- package/dist/typescript/commonjs/features/endOfAssignment/types.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/ui/EOABadge.d.ts +0 -11
- package/dist/typescript/commonjs/features/endOfAssignment/ui/EOABadge.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/ui/PracticeButton.d.ts +0 -10
- package/dist/typescript/commonjs/features/endOfAssignment/ui/PracticeButton.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/ui/PracticeButtonGroup.d.ts +0 -14
- package/dist/typescript/commonjs/features/endOfAssignment/ui/PracticeButtonGroup.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/ui/SparkIcon.d.ts +0 -4
- package/dist/typescript/commonjs/features/endOfAssignment/ui/SparkIcon.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/endOfAssignment/ui/ThumbUpIcon.d.ts +0 -4
- package/dist/typescript/commonjs/features/endOfAssignment/ui/ThumbUpIcon.d.ts.map +0 -1
- package/dist/typescript/commonjs/lib/constants.d.ts +0 -4
- package/dist/typescript/commonjs/lib/constants.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/hooks/useKeyDownListener.d.ts +0 -3
- package/dist/typescript/commonjs/shared/hooks/useKeyDownListener.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/hooks/useKeyboard.d.ts +0 -11
- package/dist/typescript/commonjs/shared/hooks/useKeyboard.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/icons/Halloween.d.ts +0 -5
- package/dist/typescript/commonjs/shared/icons/Halloween.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/icons/Pi.d.ts +0 -5
- package/dist/typescript/commonjs/shared/icons/Pi.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/icons/Star.d.ts +0 -5
- package/dist/typescript/commonjs/shared/icons/Star.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/icons/Valentine.d.ts +0 -5
- package/dist/typescript/commonjs/shared/icons/Valentine.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/icons/Winter.d.ts +0 -5
- package/dist/typescript/commonjs/shared/icons/Winter.d.ts.map +0 -1
- package/dist/typescript/module/features/celebrations/components/Celebrations.d.ts +0 -10
- package/dist/typescript/module/features/celebrations/components/Celebrations.d.ts.map +0 -1
- package/dist/typescript/module/features/celebrations/components/Particle.d.ts +0 -20
- package/dist/typescript/module/features/celebrations/components/Particle.d.ts.map +0 -1
- package/dist/typescript/module/features/celebrations/components/ParticleBatch.d.ts +0 -26
- package/dist/typescript/module/features/celebrations/components/ParticleBatch.d.ts.map +0 -1
- package/dist/typescript/module/features/celebrations/components/Spark.d.ts +0 -4
- package/dist/typescript/module/features/celebrations/components/Spark.d.ts.map +0 -1
- package/dist/typescript/module/features/celebrations/config.d.ts +0 -192
- package/dist/typescript/module/features/celebrations/config.d.ts.map +0 -1
- package/dist/typescript/module/features/celebrations/helpers.d.ts +0 -6
- package/dist/typescript/module/features/celebrations/helpers.d.ts.map +0 -1
- package/dist/typescript/module/features/celebrations/index.d.ts +0 -3
- package/dist/typescript/module/features/celebrations/index.d.ts.map +0 -1
- package/dist/typescript/module/features/celebrations/types.d.ts +0 -11
- package/dist/typescript/module/features/celebrations/types.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotMessageHandler.d.ts +0 -31
- package/dist/typescript/module/features/chatbot/model/ChatBotMessageHandler.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/api.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/CheatDetected/CheatDetected.d.ts +0 -4
- package/dist/typescript/module/features/endOfAssignment/components/CheatDetected/CheatDetected.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.d.ts +0 -15
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.d.ts +0 -4
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswerSparks.d.ts +0 -8
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswerSparks.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/GoodDrawingSparks.d.ts +0 -8
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/GoodDrawingSparks.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/Spark.d.ts +0 -12
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/Spark.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/EOAModal.d.ts +0 -11
- package/dist/typescript/module/features/endOfAssignment/components/EOAModal.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/ExamLeave/ExamLeave.d.ts +0 -4
- package/dist/typescript/module/features/endOfAssignment/components/ExamLeave/ExamLeave.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/ExamPaused/ExamPaused.d.ts +0 -4
- package/dist/typescript/module/features/endOfAssignment/components/ExamPaused/ExamPaused.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/ExamSubmit/ExamSubmit.d.ts +0 -4
- package/dist/typescript/module/features/endOfAssignment/components/ExamSubmit/ExamSubmit.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/ExamSubmit/ExamSubmitContent.d.ts +0 -8
- package/dist/typescript/module/features/endOfAssignment/components/ExamSubmit/ExamSubmitContent.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/Modal/Modal.d.ts +0 -20
- package/dist/typescript/module/features/endOfAssignment/components/Modal/Modal.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/Modal/ModalBackground.d.ts +0 -3
- package/dist/typescript/module/features/endOfAssignment/components/Modal/ModalBackground.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/Modal/assets/SunrisingIcon.d.ts +0 -4
- package/dist/typescript/module/features/endOfAssignment/components/Modal/assets/SunrisingIcon.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/Modal/assets/TrophyIcon.d.ts +0 -4
- package/dist/typescript/module/features/endOfAssignment/components/Modal/assets/TrophyIcon.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/Modal/model.d.ts +0 -14
- package/dist/typescript/module/features/endOfAssignment/components/Modal/model.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/NoAnswer/NoAnswer.d.ts +0 -4
- package/dist/typescript/module/features/endOfAssignment/components/NoAnswer/NoAnswer.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/components/NoAnswer/NoAnswerContent.d.ts +0 -8
- package/dist/typescript/module/features/endOfAssignment/components/NoAnswer/NoAnswerContent.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/constants.d.ts +0 -41
- package/dist/typescript/module/features/endOfAssignment/constants.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/helpers.d.ts +0 -9
- package/dist/typescript/module/features/endOfAssignment/helpers.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/hooks/useSparkAnimation.d.ts +0 -27
- package/dist/typescript/module/features/endOfAssignment/hooks/useSparkAnimation.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/index.d.ts +0 -4
- package/dist/typescript/module/features/endOfAssignment/index.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/model/model.d.ts +0 -14
- package/dist/typescript/module/features/endOfAssignment/model/model.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/types.d.ts +0 -60
- package/dist/typescript/module/features/endOfAssignment/types.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/ui/EOABadge.d.ts +0 -11
- package/dist/typescript/module/features/endOfAssignment/ui/EOABadge.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/ui/PracticeButton.d.ts +0 -10
- package/dist/typescript/module/features/endOfAssignment/ui/PracticeButton.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/ui/PracticeButtonGroup.d.ts +0 -14
- package/dist/typescript/module/features/endOfAssignment/ui/PracticeButtonGroup.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/ui/SparkIcon.d.ts +0 -4
- package/dist/typescript/module/features/endOfAssignment/ui/SparkIcon.d.ts.map +0 -1
- package/dist/typescript/module/features/endOfAssignment/ui/ThumbUpIcon.d.ts +0 -4
- package/dist/typescript/module/features/endOfAssignment/ui/ThumbUpIcon.d.ts.map +0 -1
- package/dist/typescript/module/lib/constants.d.ts +0 -4
- package/dist/typescript/module/lib/constants.d.ts.map +0 -1
- package/dist/typescript/module/shared/hooks/useKeyDownListener.d.ts +0 -3
- package/dist/typescript/module/shared/hooks/useKeyDownListener.d.ts.map +0 -1
- package/dist/typescript/module/shared/hooks/useKeyboard.d.ts +0 -11
- package/dist/typescript/module/shared/hooks/useKeyboard.d.ts.map +0 -1
- package/dist/typescript/module/shared/icons/Halloween.d.ts +0 -5
- package/dist/typescript/module/shared/icons/Halloween.d.ts.map +0 -1
- package/dist/typescript/module/shared/icons/Pi.d.ts +0 -5
- package/dist/typescript/module/shared/icons/Pi.d.ts.map +0 -1
- package/dist/typescript/module/shared/icons/Star.d.ts +0 -5
- package/dist/typescript/module/shared/icons/Star.d.ts.map +0 -1
- package/dist/typescript/module/shared/icons/Valentine.d.ts +0 -5
- package/dist/typescript/module/shared/icons/Valentine.d.ts.map +0 -1
- package/dist/typescript/module/shared/icons/Winter.d.ts +0 -5
- package/dist/typescript/module/shared/icons/Winter.d.ts.map +0 -1
- package/src/features/celebrations/components/Celebrations.tsx +0 -62
- package/src/features/celebrations/components/Particle.tsx +0 -101
- package/src/features/celebrations/components/ParticleBatch.tsx +0 -57
- package/src/features/celebrations/components/Spark.tsx +0 -14
- package/src/features/celebrations/config.ts +0 -224
- package/src/features/celebrations/helpers.ts +0 -103
- package/src/features/celebrations/index.ts +0 -2
- package/src/features/celebrations/types.ts +0 -11
- package/src/features/endOfAssignment/components/CheatDetected/CheatDetected.tsx +0 -65
- package/src/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.tsx +0 -298
- package/src/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.tsx +0 -141
- package/src/features/endOfAssignment/components/CorrectAnswer/CorrectAnswerSparks.tsx +0 -39
- package/src/features/endOfAssignment/components/CorrectAnswer/GoodDrawingSparks.tsx +0 -40
- package/src/features/endOfAssignment/components/CorrectAnswer/Spark.tsx +0 -45
- package/src/features/endOfAssignment/components/EOAModal.tsx +0 -64
- package/src/features/endOfAssignment/components/ExamLeave/ExamLeave.tsx +0 -77
- package/src/features/endOfAssignment/components/ExamPaused/ExamPaused.tsx +0 -62
- package/src/features/endOfAssignment/components/ExamSubmit/ExamSubmit.tsx +0 -110
- package/src/features/endOfAssignment/components/ExamSubmit/ExamSubmitContent.tsx +0 -69
- package/src/features/endOfAssignment/components/ExamSubmit/blurred-card.png +0 -0
- package/src/features/endOfAssignment/components/Modal/Modal.tsx +0 -121
- package/src/features/endOfAssignment/components/Modal/ModalBackground.tsx +0 -33
- package/src/features/endOfAssignment/components/Modal/assets/SunrisingIcon.tsx +0 -196
- package/src/features/endOfAssignment/components/Modal/assets/TrophyIcon.tsx +0 -62
- package/src/features/endOfAssignment/components/Modal/model.ts +0 -34
- package/src/features/endOfAssignment/components/NoAnswer/NoAnswer.tsx +0 -103
- package/src/features/endOfAssignment/components/NoAnswer/NoAnswerContent.tsx +0 -107
- package/src/features/endOfAssignment/constants.ts +0 -53
- package/src/features/endOfAssignment/helpers.ts +0 -28
- package/src/features/endOfAssignment/hooks/useSparkAnimation.tsx +0 -78
- package/src/features/endOfAssignment/index.ts +0 -3
- package/src/features/endOfAssignment/model/model.ts +0 -57
- package/src/features/endOfAssignment/types.ts +0 -65
- package/src/features/endOfAssignment/ui/EOABadge.tsx +0 -47
- package/src/features/endOfAssignment/ui/PracticeButton.tsx +0 -27
- package/src/features/endOfAssignment/ui/PracticeButtonGroup.tsx +0 -73
- package/src/features/endOfAssignment/ui/SparkIcon.tsx +0 -15
- package/src/features/endOfAssignment/ui/ThumbUpIcon.tsx +0 -17
- package/src/lib/constants.ts +0 -3
- package/src/shared/hooks/useKeyDownListener.ts +0 -27
- package/src/shared/hooks/useKeyboard.ts +0 -18
- package/src/shared/icons/Halloween.tsx +0 -33
- package/src/shared/icons/Pi.tsx +0 -16
- package/src/shared/icons/Star.tsx +0 -16
- package/src/shared/icons/Valentine.tsx +0 -16
- package/src/shared/icons/Winter.tsx +0 -19
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { ChatbotAPI } from '../model/ChatbotApi'
|
|
2
|
+
import { createEvent, createStore, sample, createEffect, Store } from 'effector'
|
|
3
|
+
import { ChatItem, ConversationMessage } from '../types/units.types'
|
|
4
|
+
import { ChatbotContext } from '../types/model.types'
|
|
5
|
+
|
|
6
|
+
type ErrorSpottingProps = {
|
|
7
|
+
api: ChatbotAPI
|
|
8
|
+
$currentChatData: Store<ChatItem>
|
|
9
|
+
$currentChatContext: Store<ChatbotContext | null>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type ActiveErrorSpottingData = {
|
|
13
|
+
isActive: boolean
|
|
14
|
+
isDisabled: boolean
|
|
15
|
+
strokesIds: string[]
|
|
16
|
+
validationKey: null | string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type ErrorSpottingReducerProps = {
|
|
20
|
+
chatData: ChatItem
|
|
21
|
+
activeSpotting: ActiveErrorSpottingData | null
|
|
22
|
+
message: ConversationMessage
|
|
23
|
+
context: ChatbotContext | null
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const AUTO_CLOSE_TIMEOUT = 5000
|
|
27
|
+
|
|
28
|
+
type ErrorSpottingPressedProps = {
|
|
29
|
+
message: ConversationMessage
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class ErrorSpottingModel {
|
|
33
|
+
private readonly api: ChatbotAPI
|
|
34
|
+
|
|
35
|
+
public readonly errorSpottingPressed = createEvent<ErrorSpottingPressedProps>()
|
|
36
|
+
private readonly activeDataChanged = createEvent<ActiveErrorSpottingData | null>()
|
|
37
|
+
private readonly spottingHidden = createEvent()
|
|
38
|
+
|
|
39
|
+
public readonly $validationKey = createStore<string | null>(null)
|
|
40
|
+
public readonly $activeData = createStore<ActiveErrorSpottingData | null>(null)
|
|
41
|
+
.on(this.activeDataChanged, (_, payload) => payload)
|
|
42
|
+
.on(this.spottingHidden, (state) => {
|
|
43
|
+
if (state) return { ...state, isActive: false }
|
|
44
|
+
return null
|
|
45
|
+
})
|
|
46
|
+
.on(this.$validationKey, (state, payload) => {
|
|
47
|
+
if (!state || payload === null) return state
|
|
48
|
+
const isDisabled = payload !== state.validationKey
|
|
49
|
+
return { ...state, isDisabled, isActive: isDisabled ? false : state.isActive }
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
public readonly $isLoading
|
|
53
|
+
|
|
54
|
+
private closeTimeout: NodeJS.Timeout | null = null
|
|
55
|
+
|
|
56
|
+
public constructor({ api, $currentChatData, $currentChatContext }: ErrorSpottingProps) {
|
|
57
|
+
this.api = api
|
|
58
|
+
|
|
59
|
+
this.$isLoading = api.spotErrorFx.pending
|
|
60
|
+
|
|
61
|
+
this.$activeData.on($currentChatData, (state, payload) => {
|
|
62
|
+
if (!state || state.validationKey !== payload.currentThread?.strokesValidationKey) return null
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
sample({
|
|
66
|
+
clock: api.spotErrorFx.doneData,
|
|
67
|
+
source: {
|
|
68
|
+
chatData: $currentChatData,
|
|
69
|
+
activeSpotting: this.$activeData,
|
|
70
|
+
validationKey: this.$validationKey,
|
|
71
|
+
},
|
|
72
|
+
fn: (source, result) => {
|
|
73
|
+
const key = source.chatData.currentThread?.strokesValidationKey || null
|
|
74
|
+
const currentKey = source.validationKey
|
|
75
|
+
const isDisabled = !!currentKey && currentKey !== key
|
|
76
|
+
return {
|
|
77
|
+
validationKey: key,
|
|
78
|
+
strokesIds: result.highlightedStrokeIds,
|
|
79
|
+
isActive: !isDisabled,
|
|
80
|
+
isDisabled,
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
target: this.$activeData,
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
sample({
|
|
87
|
+
clock: this.errorSpottingPressed,
|
|
88
|
+
source: {
|
|
89
|
+
context: $currentChatContext,
|
|
90
|
+
chatData: $currentChatData,
|
|
91
|
+
activeSpotting: this.$activeData,
|
|
92
|
+
},
|
|
93
|
+
fn: (source, { message }) => ({ ...source, message }),
|
|
94
|
+
target: createEffect(
|
|
95
|
+
({ chatData, activeSpotting, message, context }: ErrorSpottingReducerProps) => {
|
|
96
|
+
if (!context) throw new Error('Trying to use error spotting in chat without context')
|
|
97
|
+
if (!chatData.currentThread?.strokes) return
|
|
98
|
+
if (!activeSpotting) {
|
|
99
|
+
return this.api
|
|
100
|
+
.spotErrorFx({
|
|
101
|
+
strokes: chatData.currentThread.strokes,
|
|
102
|
+
problemDescription: context.problem,
|
|
103
|
+
correctAnswer: context.problemAnswer,
|
|
104
|
+
userAnswer: context.answer ?? '',
|
|
105
|
+
hint: message.message,
|
|
106
|
+
})
|
|
107
|
+
.then(() => {
|
|
108
|
+
this.scheduleClose()
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
this.activeDataChanged({ ...activeSpotting, isActive: !activeSpotting.isActive })
|
|
112
|
+
this.scheduleClose()
|
|
113
|
+
},
|
|
114
|
+
),
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
this.activeDataChanged.watch((spotting) => {
|
|
118
|
+
if ((!spotting || !spotting.isActive) && this.closeTimeout) {
|
|
119
|
+
clearTimeout(this.closeTimeout)
|
|
120
|
+
this.closeTimeout = null
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private scheduleClose() {
|
|
126
|
+
if (this.closeTimeout) clearTimeout(this.closeTimeout)
|
|
127
|
+
this.closeTimeout = setTimeout(() => {
|
|
128
|
+
this.spottingHidden()
|
|
129
|
+
this.closeTimeout = null
|
|
130
|
+
}, AUTO_CLOSE_TIMEOUT)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
public bindStrokesValidation($store: Store<string | null>) {
|
|
134
|
+
sample({
|
|
135
|
+
source: $store,
|
|
136
|
+
target: this.$validationKey,
|
|
137
|
+
})
|
|
138
|
+
return this
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
public abortPendingRequest() {
|
|
142
|
+
const isPending = this.api.spotErrorFx.pending.getState()
|
|
143
|
+
if (isPending) this.api.spotErrorFx.controller.abort()
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
public reset() {
|
|
147
|
+
this.activeDataChanged(null)
|
|
148
|
+
this.abortPendingRequest()
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -3,11 +3,10 @@ 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
|
-
type ChatbotRenderer,
|
|
8
6
|
type ChatbotModelProps,
|
|
9
7
|
type IChatDrawBoardAdapter,
|
|
10
8
|
} from './types/model.types'
|
|
11
|
-
export type { PostMessageResponse
|
|
12
|
-
export { ChatMessageHandler } from './model/ChatBotMessageHandler'
|
|
9
|
+
export type { PostMessageResponse } from './types/api.types'
|
|
13
10
|
export { DefaultMessagesCreator } from './model/DefaultMessageCreator'
|
|
11
|
+
export type { ChatAnswer } from './types/units.types'
|
|
12
|
+
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
|
|
11
|
+
import { createControllerEffect } from '../../../lib/effector'
|
|
12
12
|
import {
|
|
13
13
|
ChatbotContext,
|
|
14
14
|
ChatbotModelProps,
|
|
15
|
-
|
|
15
|
+
IChatDrawBoardAdapter,
|
|
16
16
|
SendHelpParams,
|
|
17
17
|
SendHelpProps,
|
|
18
18
|
SetHintMessageProps,
|
|
@@ -20,20 +20,32 @@ import {
|
|
|
20
20
|
StartConversationProps,
|
|
21
21
|
} from '../types/model.types'
|
|
22
22
|
import { GetAlternativesResponse } from '../types/api.types'
|
|
23
|
-
import { ChatbotAPI } from './
|
|
23
|
+
import { ChatbotAPI } from './ChatbotApi'
|
|
24
24
|
import { ChatbotTranslation } from './translation'
|
|
25
|
-
import { ChatTextToSpeechModel } from './t2s'
|
|
26
|
-
import { AudioProvider } from '../types/t2s.types'
|
|
25
|
+
import { ChatTextToSpeechModel, T2SConfig } from './t2s'
|
|
27
26
|
import { messagesHelper } from './messagesHelper'
|
|
27
|
+
import { ChatBotThreadManager } from './ChatBotThreadManager'
|
|
28
|
+
import { ChatsCacheModel, defaultChatData } from './ChatsCacheModel'
|
|
29
|
+
import { ErrorSpottingModel } from '../errorSpotting/ErrorSpottingModel'
|
|
30
|
+
import { withEvent } from '../../../lib/effector/withEvent'
|
|
31
|
+
import { ChatBotTextManager } from './ChatBoxTextManager'
|
|
28
32
|
|
|
29
33
|
type ReinitConversationProps = {
|
|
30
34
|
key: string
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
export class ChatbotModel {
|
|
34
|
-
readonly
|
|
35
|
-
readonly
|
|
36
|
-
|
|
38
|
+
public readonly textManager = new ChatBotTextManager()
|
|
39
|
+
private readonly defaultMessages = this.textManager.messages
|
|
40
|
+
|
|
41
|
+
public readonly threadManager = new ChatBotThreadManager({
|
|
42
|
+
messages: this.defaultMessages,
|
|
43
|
+
})
|
|
44
|
+
public readonly api: ChatbotAPI
|
|
45
|
+
|
|
46
|
+
public readonly translation: ChatbotTranslation
|
|
47
|
+
public readonly t2s: ChatTextToSpeechModel
|
|
48
|
+
public readonly errorSpotting: ErrorSpottingModel
|
|
37
49
|
|
|
38
50
|
public readonly $currentKey = createStore('')
|
|
39
51
|
|
|
@@ -52,95 +64,85 @@ export class ChatbotModel {
|
|
|
52
64
|
public readonly setContext = createEvent<null | ChatbotContext>()
|
|
53
65
|
public readonly $context = restore(this.setContext, null)
|
|
54
66
|
|
|
55
|
-
readonly setScrollActive = createEvent<boolean>()
|
|
56
|
-
readonly $isScrollActive = restore(this.setScrollActive, false)
|
|
67
|
+
public readonly setScrollActive = createEvent<boolean>()
|
|
68
|
+
public readonly $isScrollActive = restore(this.setScrollActive, false)
|
|
57
69
|
|
|
58
|
-
readonly
|
|
59
|
-
|
|
60
|
-
readonly defaultMessages: ChatbotModelProps['messages']
|
|
61
|
-
|
|
62
|
-
readonly messages = createEntityFieldStore<ConversationMessage[]>()
|
|
63
|
-
readonly threadIds = createEntityFieldStore<string>()
|
|
64
|
-
readonly availableChats = createEntityFieldStore<boolean>()
|
|
70
|
+
private readonly cache = new ChatsCacheModel()
|
|
65
71
|
|
|
66
72
|
public readonly $currentChatData = combine(
|
|
67
|
-
{
|
|
68
|
-
|
|
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
|
-
},
|
|
73
|
+
{ data: this.cache.$data, key: this.$currentKey },
|
|
74
|
+
({ data, key }) => (data[key] ? { ...data[key], key } : { ...defaultChatData(), key }),
|
|
81
75
|
)
|
|
82
76
|
|
|
83
|
-
constructor({ api,
|
|
84
|
-
this.api = new ChatbotAPI(api)
|
|
77
|
+
constructor({ api, $key, threadMessagesLimit }: ChatbotModelProps) {
|
|
78
|
+
this.api = new ChatbotAPI({ ...api, postMessage: this.threadManager.postMessage })
|
|
85
79
|
|
|
86
|
-
this.
|
|
87
|
-
if (
|
|
80
|
+
this.threadManager.setApi({ getHint: api.requestHint })
|
|
81
|
+
if (threadMessagesLimit) {
|
|
82
|
+
this.threadManager.setMessagesLimit(threadMessagesLimit)
|
|
83
|
+
}
|
|
88
84
|
|
|
89
85
|
this.$alternatives = restore(this.api.getAlternativesFx.doneData, null)
|
|
90
86
|
.on(this.setAlternatives, (_, payload) => payload)
|
|
91
87
|
.reset(this.resetAlternatives)
|
|
92
88
|
|
|
89
|
+
this.t2s = new ChatTextToSpeechModel({ api: this.api })
|
|
93
90
|
this.translation = new ChatbotTranslation({
|
|
94
91
|
$context: this.$context,
|
|
95
|
-
defaultMessages:
|
|
92
|
+
defaultMessages: this.defaultMessages,
|
|
96
93
|
$key: this.$currentKey,
|
|
97
94
|
api: this.api,
|
|
98
|
-
messagesModel: this.messages,
|
|
99
95
|
alternativesModel: {
|
|
100
96
|
$store: this.$alternatives,
|
|
101
97
|
set: this.setAlternatives,
|
|
102
98
|
},
|
|
99
|
+
chats: this.cache,
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
this.errorSpotting = new ErrorSpottingModel({
|
|
103
|
+
api: this.api,
|
|
104
|
+
$currentChatData: this.$currentChatData,
|
|
105
|
+
$currentChatContext: this.$context,
|
|
103
106
|
})
|
|
104
107
|
|
|
105
|
-
|
|
108
|
+
if ($key) this.bindKey($key)
|
|
106
109
|
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
sample({
|
|
111
|
+
source: this.$isOpen.updates,
|
|
112
|
+
filter: (isOpen) => !isOpen,
|
|
113
|
+
target: this.t2s.reset,
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
sample({
|
|
117
|
+
clock: this.removeLastMessage,
|
|
118
|
+
source: [this.$lastMessageKey, this.cache.$data] as const,
|
|
119
|
+
fn: ([lastMessageKey, chatsData]) => {
|
|
120
|
+
const chat = chatsData[lastMessageKey ?? '']
|
|
121
|
+
if (!chat) return { key: '', data: {} }
|
|
122
|
+
const updatedMessages = [...chat.messages]
|
|
123
|
+
updatedMessages.pop()
|
|
124
|
+
return { key: lastMessageKey ?? '', data: { messages: updatedMessages } }
|
|
125
|
+
},
|
|
126
|
+
filter: ([lastMessageKey]) => !!lastMessageKey,
|
|
127
|
+
target: this.cache.update,
|
|
128
|
+
})
|
|
109
129
|
}
|
|
110
130
|
|
|
111
131
|
private createSendHelpRequestFx() {
|
|
112
132
|
const effect = attach({
|
|
113
|
-
source: [
|
|
114
|
-
|
|
115
|
-
this.translation.$isTranslated,
|
|
116
|
-
this.$currentChatData,
|
|
117
|
-
this.$context,
|
|
118
|
-
],
|
|
119
|
-
mapParams: (params: SendHelpParams, [key, isTranslated, currentData, context]) => ({
|
|
133
|
+
source: [this.$currentKey, this.$context],
|
|
134
|
+
mapParams: (params: SendHelpParams, [key, context]) => ({
|
|
120
135
|
message: params.message,
|
|
121
136
|
translatedMessage: params.translatedMessage,
|
|
122
137
|
context,
|
|
123
138
|
key,
|
|
124
|
-
isTranslated,
|
|
125
|
-
threadId: currentData.threadId,
|
|
126
139
|
}),
|
|
127
140
|
effect: createControllerEffect(
|
|
128
|
-
async ({
|
|
129
|
-
message
|
|
130
|
-
translatedMessage,
|
|
131
|
-
key,
|
|
132
|
-
isTranslated,
|
|
133
|
-
threadId,
|
|
134
|
-
context,
|
|
135
|
-
}: SendHelpProps) => {
|
|
136
|
-
if (!context) throw new Error('Context is required')
|
|
141
|
+
async ({ message, translatedMessage, key, context }: SendHelpProps) => {
|
|
142
|
+
if (!context) throw new Error('Trying to send message in chat without context')
|
|
137
143
|
this.setLastMessageKey(key)
|
|
138
|
-
this.
|
|
139
|
-
|
|
140
|
-
fn: (currentMessages) => [
|
|
141
|
-
...(currentMessages || []),
|
|
142
|
-
messagesHelper.createOwn({ message, translatedMessage, threadId }),
|
|
143
|
-
],
|
|
144
|
+
this.cache.addMessages(key, {
|
|
145
|
+
messages: [messagesHelper.createOwn({ message, translatedMessage })],
|
|
144
146
|
})
|
|
145
147
|
|
|
146
148
|
const response = await this.api.postMessageFx({
|
|
@@ -148,25 +150,21 @@ export class ChatbotModel {
|
|
|
148
150
|
language: context.language,
|
|
149
151
|
problemAnswer: context.problemAnswer,
|
|
150
152
|
answer: context.answer,
|
|
151
|
-
threadId,
|
|
152
153
|
imageAltText: context.imageDescription,
|
|
153
154
|
})
|
|
154
|
-
|
|
155
|
+
const thread = this.threadManager.get(key)
|
|
156
|
+
let messages = [
|
|
157
|
+
messagesHelper.createAnswer(response, { isInitial: thread?.history.length === 1 }),
|
|
158
|
+
]
|
|
155
159
|
if (response.endMessage) {
|
|
156
160
|
messages.push(messagesHelper.createLast(this.defaultMessages.endMessage))
|
|
157
161
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
messages,
|
|
162
|
-
})
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
this.messages.setField({
|
|
166
|
-
key,
|
|
167
|
-
fn: (currentMessages) => [...(currentMessages || []), ...messages],
|
|
162
|
+
messages = await this.translation.applyTranslationFx({
|
|
163
|
+
targetLanguage: context.translationTargetLanguage,
|
|
164
|
+
messages,
|
|
168
165
|
})
|
|
169
|
-
|
|
166
|
+
|
|
167
|
+
this.cache.addMessages(key, { messages, thread })
|
|
170
168
|
},
|
|
171
169
|
),
|
|
172
170
|
})
|
|
@@ -174,29 +172,39 @@ export class ChatbotModel {
|
|
|
174
172
|
sample({
|
|
175
173
|
clock: effect.fail,
|
|
176
174
|
source: this.$currentChatData,
|
|
177
|
-
fn: ({ key, messages }) => ({
|
|
175
|
+
fn: ({ key, messages }) => ({
|
|
176
|
+
key,
|
|
177
|
+
data: { messages: [...messages, this.defaultMessages.error] },
|
|
178
|
+
}),
|
|
178
179
|
filter: (_, { error }) => error.message !== 'Request aborted manually',
|
|
179
|
-
target: this.
|
|
180
|
+
target: this.cache.update,
|
|
180
181
|
})
|
|
181
182
|
|
|
182
183
|
return effect
|
|
183
184
|
}
|
|
184
185
|
|
|
185
|
-
|
|
186
|
+
public bindKey($store: Store<string>) {
|
|
186
187
|
sample({
|
|
187
|
-
|
|
188
|
-
|
|
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,
|
|
188
|
+
source: $store,
|
|
189
|
+
target: this.$currentKey,
|
|
197
190
|
})
|
|
191
|
+
this.threadManager.bindKeyStore($store)
|
|
192
|
+
return this
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
public setUpT2S(config: T2SConfig) {
|
|
196
|
+
this.t2s.setConfig(config)
|
|
197
|
+
return this
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
public setDrawBoardAdapter(adapter: IChatDrawBoardAdapter) {
|
|
201
|
+
this.threadManager.setDrawBoardAdapter(adapter)
|
|
202
|
+
this.errorSpotting.bindStrokesValidation(adapter.$strokesValidationKey)
|
|
203
|
+
return this
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
public readonly sendHelpRequestFx = this.createSendHelpRequestFx()
|
|
207
|
+
|
|
200
208
|
public readonly startConversation = attach({
|
|
201
209
|
source: this.$currentChatData,
|
|
202
210
|
mapParams: (props: StartConversationProps | void, source) => ({
|
|
@@ -208,54 +216,54 @@ export class ChatbotModel {
|
|
|
208
216
|
if (initOnly) return
|
|
209
217
|
return this.reinitConversation({ key })
|
|
210
218
|
}
|
|
211
|
-
this.
|
|
212
|
-
|
|
219
|
+
this.cache.add(key, {
|
|
220
|
+
messages: [this.defaultMessages.start],
|
|
221
|
+
isAvailable: true,
|
|
222
|
+
currentThread: null,
|
|
223
|
+
})
|
|
213
224
|
}),
|
|
214
225
|
})
|
|
215
226
|
|
|
216
227
|
public setHintMessage({ key, ...message }: SetHintMessageProps) {
|
|
217
228
|
const options = this.$alternatives.getState()?.options.hints ?? message.options
|
|
218
|
-
this.
|
|
219
|
-
key,
|
|
220
|
-
fn: (messages) => {
|
|
221
|
-
if (!messages || messages.length > 1) return
|
|
222
|
-
return [{ ...message, options }]
|
|
223
|
-
},
|
|
224
|
-
})
|
|
229
|
+
this.cache.setSingleMessage(key, { ...message, options })
|
|
225
230
|
}
|
|
226
231
|
|
|
227
|
-
public readonly reinitConversation =
|
|
228
|
-
this.
|
|
229
|
-
|
|
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
|
-
})
|
|
248
|
-
|
|
249
|
-
public bindKey($store: Store<string>) {
|
|
250
|
-
sample({
|
|
251
|
-
source: $store,
|
|
252
|
-
target: this.$currentKey,
|
|
253
|
-
})
|
|
254
|
-
return this
|
|
232
|
+
public readonly reinitConversation = ({ key }: ReinitConversationProps) => {
|
|
233
|
+
this.cache.reinitChatThread(key, { initialOption: this.defaultMessages.anotherHintOption })
|
|
234
|
+
this.threadManager.reset(key)
|
|
255
235
|
}
|
|
256
236
|
|
|
257
|
-
public
|
|
258
|
-
this.t2s.
|
|
259
|
-
|
|
237
|
+
public disableChat(key: string) {
|
|
238
|
+
this.t2s.stop()
|
|
239
|
+
void this.t2s.reset()
|
|
240
|
+
this.cache.disableChat(key)
|
|
260
241
|
}
|
|
242
|
+
|
|
243
|
+
public softReset = attach({
|
|
244
|
+
source: {
|
|
245
|
+
isLoading: this.sendHelpRequestFx.pending,
|
|
246
|
+
lastMessageKey: this.$lastMessageKey,
|
|
247
|
+
},
|
|
248
|
+
mapParams: (_: void, { isLoading, lastMessageKey }) => !!(isLoading && lastMessageKey),
|
|
249
|
+
effect: createEffect((hasPendingMessage: boolean) => {
|
|
250
|
+
if (hasPendingMessage) {
|
|
251
|
+
this.api.postMessageFx.controller.abort()
|
|
252
|
+
this.removeLastMessage()
|
|
253
|
+
}
|
|
254
|
+
this.errorSpotting.abortPendingRequest()
|
|
255
|
+
|
|
256
|
+
this.t2s.stop()
|
|
257
|
+
void this.t2s.reset()
|
|
258
|
+
this.translation.reset()
|
|
259
|
+
this.setScrollActive(false)
|
|
260
|
+
}),
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
public readonly reset = withEvent(() => {
|
|
264
|
+
this.cache.reset()
|
|
265
|
+
this.resetAlternatives()
|
|
266
|
+
this.threadManager.reset()
|
|
267
|
+
this.errorSpotting.reset()
|
|
268
|
+
})
|
|
261
269
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ThreadItem } from './ThreadItem'
|
|
2
2
|
import { Store } from 'effector'
|
|
3
|
-
import { createEffect } from 'effector/effector.umd'
|
|
4
3
|
import {
|
|
5
4
|
ChatHintPayload,
|
|
6
5
|
ChatHintResponse,
|
|
@@ -10,25 +9,23 @@ import {
|
|
|
10
9
|
import { ChatbotMessages, IChatDrawBoardAdapter } from '../types/model.types'
|
|
11
10
|
import { CHAT_BOT_MODEL_DEFAULTS } from './constants'
|
|
12
11
|
|
|
13
|
-
type
|
|
14
|
-
|
|
15
|
-
messages: ChatbotMessages
|
|
16
|
-
drawBoardAdapter: IChatDrawBoardAdapter
|
|
17
|
-
api: {
|
|
18
|
-
getHint: (props: ChatHintPayload) => Promise<ChatHintResponse>
|
|
19
|
-
}
|
|
12
|
+
type ThreadManagerApi = {
|
|
13
|
+
getHint: (props: ChatHintPayload) => Promise<ChatHintResponse>
|
|
20
14
|
}
|
|
21
15
|
|
|
22
|
-
type
|
|
23
|
-
|
|
16
|
+
type ChatBotThreadManagerProps = {
|
|
17
|
+
messagesLimit?: number
|
|
18
|
+
drawBoardAdapter?: IChatDrawBoardAdapter
|
|
19
|
+
messages: ChatbotMessages
|
|
20
|
+
api?: ThreadManagerApi
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
export class
|
|
27
|
-
private
|
|
28
|
-
private
|
|
23
|
+
export class ChatBotThreadManager {
|
|
24
|
+
private api: ThreadManagerApi | null = null
|
|
25
|
+
private drawBoardAdapter: IChatDrawBoardAdapter | null = null
|
|
29
26
|
private readonly threads = new Map<string, ThreadItem>()
|
|
30
27
|
|
|
31
|
-
private
|
|
28
|
+
private messagesLimit
|
|
32
29
|
private currentKey = ''
|
|
33
30
|
private currentBinding: null | (() => void) = null
|
|
34
31
|
|
|
@@ -39,9 +36,9 @@ export class ChatMessageHandler {
|
|
|
39
36
|
api,
|
|
40
37
|
messagesLimit = CHAT_BOT_MODEL_DEFAULTS.THREAD_MESSAGES_LIMIT,
|
|
41
38
|
messages,
|
|
42
|
-
}:
|
|
43
|
-
this.api = api
|
|
44
|
-
this.drawBoardAdapter = drawBoardAdapter
|
|
39
|
+
}: ChatBotThreadManagerProps) {
|
|
40
|
+
if (api) this.api = api
|
|
41
|
+
this.drawBoardAdapter = drawBoardAdapter ?? null
|
|
45
42
|
this.messagesLimit = messagesLimit
|
|
46
43
|
this.defaultMessages = messages
|
|
47
44
|
}
|
|
@@ -58,9 +55,16 @@ export class ChatMessageHandler {
|
|
|
58
55
|
const key = this.currentKey
|
|
59
56
|
let threadItem = this.threads.get(key)
|
|
60
57
|
if (threadItem) return threadItem
|
|
58
|
+
if (!this.drawBoardAdapter) {
|
|
59
|
+
threadItem = new ThreadItem()
|
|
60
|
+
this.threads.set(key, threadItem)
|
|
61
|
+
return threadItem
|
|
62
|
+
}
|
|
61
63
|
try {
|
|
62
|
-
const
|
|
63
|
-
threadItem = new ThreadItem(
|
|
64
|
+
const result = await this.drawBoardAdapter.getVisibleStrokes()
|
|
65
|
+
threadItem = new ThreadItem(
|
|
66
|
+
result ? { strokes: result.strokes, key: result.validationKey } : null,
|
|
67
|
+
)
|
|
64
68
|
} catch {
|
|
65
69
|
threadItem = new ThreadItem()
|
|
66
70
|
}
|
|
@@ -68,13 +72,22 @@ export class ChatMessageHandler {
|
|
|
68
72
|
return threadItem
|
|
69
73
|
}
|
|
70
74
|
|
|
71
|
-
public
|
|
75
|
+
public setDrawBoardAdapter(adapter: IChatDrawBoardAdapter) {
|
|
76
|
+
this.drawBoardAdapter = adapter
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public readonly postMessage = async ({
|
|
72
80
|
problemAnswer,
|
|
73
81
|
problem,
|
|
74
82
|
answer,
|
|
75
83
|
language,
|
|
76
84
|
imageAltText,
|
|
77
85
|
}: PostMessagePayload): Promise<PostMessageResponse> => {
|
|
86
|
+
if (!this.api) {
|
|
87
|
+
throw new Error(
|
|
88
|
+
'API is not set in ThreadManagersApi, pls provide API before sending requests',
|
|
89
|
+
)
|
|
90
|
+
}
|
|
78
91
|
const threadItem = await this.getThreadItem()
|
|
79
92
|
|
|
80
93
|
const result = await this.api.getHint({
|
|
@@ -86,23 +99,36 @@ export class ChatMessageHandler {
|
|
|
86
99
|
imageAltText,
|
|
87
100
|
})
|
|
88
101
|
|
|
89
|
-
threadItem.
|
|
102
|
+
threadItem.history.push(result.message)
|
|
90
103
|
const nextOptions =
|
|
91
|
-
threadItem.
|
|
104
|
+
threadItem.history.length < this.messagesLimit ? [this.defaultMessages.anotherHintOption] : []
|
|
92
105
|
|
|
93
106
|
return {
|
|
94
107
|
message: result.message,
|
|
95
108
|
options: nextOptions,
|
|
96
|
-
threadId: '',
|
|
97
109
|
endMessage: !nextOptions.length,
|
|
110
|
+
threadId: threadItem.id,
|
|
98
111
|
}
|
|
99
112
|
}
|
|
100
113
|
|
|
101
|
-
public
|
|
102
|
-
this.threads.
|
|
103
|
-
}
|
|
114
|
+
public get(key: string) {
|
|
115
|
+
return this.threads.get(key)
|
|
116
|
+
}
|
|
104
117
|
|
|
105
|
-
public
|
|
118
|
+
public reset(key?: string) {
|
|
119
|
+
if (typeof key === 'string') {
|
|
120
|
+
this.threads.delete(key)
|
|
121
|
+
return
|
|
122
|
+
}
|
|
106
123
|
this.threads.clear()
|
|
107
124
|
}
|
|
125
|
+
|
|
126
|
+
public setMessagesLimit(limit: number) {
|
|
127
|
+
this.messagesLimit = limit
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
public setApi(api: ThreadManagerApi) {
|
|
131
|
+
this.api = api
|
|
132
|
+
return this
|
|
133
|
+
}
|
|
108
134
|
}
|