@magmamath/students-features 0.5.0 → 0.5.1-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.
- package/dist/commonjs/features/celebrations/config.js +4 -4
- package/dist/commonjs/features/celebrations/config.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js +1 -2
- 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/MessageTextToSpeech.js +47 -30
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +42 -22
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/SentMessage.js +14 -11
- package/dist/commonjs/features/chatbot/components/ChatMessage/SentMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +32 -17
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +7 -5
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/index.js +7 -0
- package/dist/commonjs/features/chatbot/index.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/{ChatBotThreadManager.js → ChatBotMessageHandler.js} +22 -44
- package/dist/commonjs/features/chatbot/model/ChatBotMessageHandler.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +125 -146
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- 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 +8 -16
- package/dist/commonjs/features/chatbot/model/ThreadItem.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/{ChatbotApi.js → api.js} +1 -2
- package/dist/commonjs/features/chatbot/model/api.js.map +1 -0
- 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 +13 -18
- 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 +19 -28
- package/dist/commonjs/features/chatbot/model/translation.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/api.types.js +0 -4
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.js +2 -4
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.js.map +1 -1
- package/dist/commonjs/features/endOfAssignment/ui/PracticeButtonGroup.js.map +1 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/lib/effector/createEntityFieldStore.js +0 -4
- package/dist/commonjs/lib/effector/createEntityFieldStore.js.map +1 -1
- package/{src/shared/translation → dist/commonjs/lib}/localization/en.json +1 -8
- package/dist/{module/shared/translation → commonjs/lib}/localization/gb.json +1 -8
- package/dist/commonjs/{shared/translation → lib}/localization/sw.json +1 -8
- package/dist/commonjs/shared/icons/icon.types.js +0 -4
- 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 +6 -22
- package/dist/commonjs/shared/translation/helpers.js.map +1 -1
- package/dist/commonjs/shared/translation/hooks.js +5 -3
- package/dist/commonjs/shared/translation/hooks.js.map +1 -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/module/features/celebrations/config.js +4 -4
- package/dist/module/features/celebrations/config.js.map +1 -1
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +1 -2
- 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/MessageTextToSpeech.js +48 -31
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +43 -23
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/SentMessage.js +13 -11
- package/dist/module/features/chatbot/components/ChatMessage/SentMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +32 -17
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +8 -6
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/index.js +1 -0
- package/dist/module/features/chatbot/index.js.map +1 -1
- package/dist/module/features/chatbot/model/{ChatBotThreadManager.js → ChatBotMessageHandler.js} +20 -42
- package/dist/module/features/chatbot/model/ChatBotMessageHandler.js.map +1 -0
- package/dist/module/features/chatbot/model/ChatBotModel.js +126 -147
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- 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 +8 -16
- package/dist/module/features/chatbot/model/ThreadItem.js.map +1 -1
- package/dist/module/features/chatbot/model/{ChatbotApi.js → api.js} +1 -2
- package/dist/module/features/chatbot/model/api.js.map +1 -0
- 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 +14 -19
- 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 +19 -28
- package/dist/module/features/chatbot/model/translation.js.map +1 -1
- package/dist/module/features/chatbot/types/api.types.js +0 -2
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.js +2 -4
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.js.map +1 -1
- package/dist/module/features/endOfAssignment/ui/PracticeButtonGroup.js.map +1 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/effector/createEntityFieldStore.js +0 -4
- package/dist/module/lib/effector/createEntityFieldStore.js.map +1 -1
- package/dist/module/{shared/translation → lib}/localization/en.json +1 -8
- package/dist/{commonjs/shared/translation → module/lib}/localization/gb.json +1 -8
- package/dist/module/{shared/translation → lib}/localization/sw.json +1 -8
- package/dist/module/shared/icons/icon.types.js +0 -2
- 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 +5 -19
- package/dist/module/shared/translation/helpers.js.map +1 -1
- package/dist/module/shared/translation/hooks.js +6 -4
- package/dist/module/shared/translation/hooks.js.map +1 -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 +0 -2
- package/dist/module/shared/translation/types.js.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts +3 -1
- 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 +10 -7
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts +7 -5
- 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 +10 -2
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +5 -2
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +3 -4
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotMessageHandler.d.ts +31 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotMessageHandler.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +18 -24
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts +3 -5
- package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts +7 -13
- package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/{ChatbotApi.d.ts → api.d.ts} +3 -4
- package/dist/typescript/commonjs/features/chatbot/model/api.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts +5 -7
- package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts +6 -16
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts +9 -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 +1 -2
- 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 +11 -12
- 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 +24 -19
- 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 +7 -9
- 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 -3
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/endOfAssignment/ui/PracticeButtonGroup.d.ts.map +1 -1
- package/dist/typescript/commonjs/index.d.ts +1 -0
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts +0 -2
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/icons/icon.types.d.ts +0 -2
- package/dist/typescript/commonjs/shared/icons/icon.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +0 -21
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/helpers.d.ts +2 -3
- 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 +1 -0
- package/dist/typescript/commonjs/shared/translation/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +3 -43
- 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/module/features/chatbot/components/Alternatives/Alternatives.d.ts +3 -1
- 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 +10 -7
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts +7 -5
- 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 +10 -2
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +5 -2
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/index.d.ts +3 -4
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotMessageHandler.d.ts +31 -0
- package/dist/typescript/module/features/chatbot/model/ChatBotMessageHandler.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +18 -24
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts +3 -5
- package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts +7 -13
- package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/{ChatbotApi.d.ts → api.d.ts} +3 -4
- package/dist/typescript/module/features/chatbot/model/api.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts +5 -7
- package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts +6 -16
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/translation.d.ts +9 -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 +1 -2
- 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 +11 -12
- 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 +24 -19
- 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 +7 -9
- 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 -3
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.d.ts.map +1 -1
- package/dist/typescript/module/features/endOfAssignment/ui/PracticeButtonGroup.d.ts.map +1 -1
- package/dist/typescript/module/index.d.ts +1 -0
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts +0 -2
- package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts.map +1 -1
- package/dist/typescript/module/shared/icons/icon.types.d.ts +0 -2
- package/dist/typescript/module/shared/icons/icon.types.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/constants.d.ts +0 -21
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/helpers.d.ts +2 -3
- 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 +1 -0
- package/dist/typescript/module/shared/translation/index.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +3 -43
- 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/package.json +2 -2
- package/src/features/celebrations/config.ts +4 -4
- package/src/features/chatbot/components/Alternatives/Alternatives.tsx +4 -2
- package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +10 -7
- package/src/features/chatbot/components/ChatMessage/MessageTextToSpeech.tsx +51 -34
- package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +40 -15
- package/src/features/chatbot/components/ChatMessage/SentMessage.tsx +10 -9
- package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +34 -17
- package/src/features/chatbot/components/Chatbot.tsx +11 -5
- package/src/features/chatbot/index.ts +4 -3
- package/src/features/chatbot/model/{ChatBotThreadManager.ts → ChatBotMessageHandler.ts} +27 -53
- package/src/features/chatbot/model/ChatBotModel.ts +149 -151
- package/src/features/chatbot/model/DefaultMessageCreator.ts +16 -17
- package/src/features/chatbot/model/ThreadItem.ts +10 -15
- package/src/features/chatbot/model/{ChatbotApi.ts → api.ts} +2 -5
- package/src/features/chatbot/model/constants.ts +0 -2
- package/src/features/chatbot/model/messagesHelper.ts +7 -12
- package/src/features/chatbot/model/t2s.ts +13 -28
- package/src/features/chatbot/model/translation.helpers.ts +1 -2
- package/src/features/chatbot/model/translation.ts +24 -34
- package/src/features/chatbot/types/api.types.ts +12 -12
- package/src/features/chatbot/types/model.types.ts +32 -31
- package/src/features/chatbot/types/t2s.types.ts +15 -18
- package/src/features/chatbot/types/translation.types.ts +2 -3
- package/src/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.tsx +2 -3
- package/src/features/endOfAssignment/ui/PracticeButtonGroup.tsx +1 -0
- package/src/index.ts +1 -0
- package/src/lib/effector/createEntityFieldStore.ts +1 -9
- package/{dist/commonjs/shared/translation → src/lib}/localization/en.json +1 -8
- package/src/{shared/translation → lib}/localization/gb.json +1 -8
- package/src/{shared/translation → lib}/localization/sw.json +1 -8
- package/src/shared/icons/icon.types.ts +6 -9
- package/src/shared/translation/constants.ts +3 -3
- package/src/shared/translation/helpers.ts +9 -22
- package/src/shared/translation/hooks.ts +16 -12
- package/src/shared/translation/index.ts +1 -0
- package/src/shared/translation/model.ts +8 -8
- package/src/shared/translation/types.ts +8 -11
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.js +0 -44
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageContent.js +0 -62
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageContent.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/helpers.js +0 -13
- package/dist/commonjs/features/chatbot/components/ChatMessage/helpers.js.map +0 -1
- package/dist/commonjs/features/chatbot/context/ChatBotModelContext.js +0 -17
- package/dist/commonjs/features/chatbot/context/ChatBotModelContext.js.map +0 -1
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.js +0 -57
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.js.map +0 -1
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js +0 -130
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +0 -1
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +0 -1
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js +0 -22
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js.map +0 -1
- package/dist/commonjs/features/chatbot/model/ChatbotApi.js.map +0 -1
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js +0 -110
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js.map +0 -1
- package/dist/commonjs/features/chatbot/types/units.types.js +0 -2
- package/dist/commonjs/features/chatbot/types/units.types.js.map +0 -1
- package/dist/commonjs/lib/effector/withEvent.js +0 -13
- package/dist/commonjs/lib/effector/withEvent.js.map +0 -1
- package/dist/commonjs/lib/types/keys.js +0 -2
- package/dist/commonjs/lib/types/keys.js.map +0 -1
- package/dist/commonjs/shared/icons/HighlighterIcon.js +0 -36
- package/dist/commonjs/shared/icons/HighlighterIcon.js.map +0 -1
- package/dist/commonjs/shared/icons/StopIcon.js +0 -33
- package/dist/commonjs/shared/icons/StopIcon.js.map +0 -1
- package/dist/commonjs/shared/translation/validation.types.js +0 -6
- package/dist/commonjs/shared/translation/validation.types.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.js +0 -38
- package/dist/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageContent.js +0 -57
- package/dist/module/features/chatbot/components/ChatMessage/MessageContent.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatMessage/helpers.js +0 -9
- package/dist/module/features/chatbot/components/ChatMessage/helpers.js.map +0 -1
- package/dist/module/features/chatbot/context/ChatBotModelContext.js +0 -12
- package/dist/module/features/chatbot/context/ChatBotModelContext.js.map +0 -1
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingButton.js +0 -51
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingButton.js.map +0 -1
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js +0 -125
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +0 -1
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +0 -1
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js +0 -17
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js.map +0 -1
- package/dist/module/features/chatbot/model/ChatbotApi.js.map +0 -1
- package/dist/module/features/chatbot/model/ChatsCacheModel.js +0 -104
- package/dist/module/features/chatbot/model/ChatsCacheModel.js.map +0 -1
- package/dist/module/features/chatbot/types/units.types.js +0 -2
- package/dist/module/features/chatbot/types/units.types.js.map +0 -1
- package/dist/module/lib/effector/withEvent.js +0 -9
- package/dist/module/lib/effector/withEvent.js.map +0 -1
- package/dist/module/lib/types/keys.js +0 -2
- package/dist/module/lib/types/keys.js.map +0 -1
- package/dist/module/shared/icons/HighlighterIcon.js +0 -29
- package/dist/module/shared/icons/HighlighterIcon.js.map +0 -1
- package/dist/module/shared/icons/StopIcon.js +0 -26
- package/dist/module/shared/icons/StopIcon.js.map +0 -1
- package/dist/module/shared/translation/validation.types.js +0 -4
- package/dist/module/shared/translation/validation.types.js.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts +0 -10
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageContent.d.ts +0 -11
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageContent.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/helpers.d.ts +0 -4
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/helpers.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/context/ChatBotModelContext.d.ts +0 -4
- package/dist/typescript/commonjs/features/chatbot/context/ChatBotModelContext.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts +0 -8
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +0 -35
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts +0 -33
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBoxTextManager.d.ts +0 -6
- package/dist/typescript/commonjs/features/chatbot/model/ChatBoxTextManager.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatbotApi.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts +0 -27
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +0 -34
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +0 -1
- package/dist/typescript/commonjs/lib/effector/withEvent.d.ts +0 -2
- package/dist/typescript/commonjs/lib/effector/withEvent.d.ts.map +0 -1
- package/dist/typescript/commonjs/lib/types/keys.d.ts +0 -8
- package/dist/typescript/commonjs/lib/types/keys.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/icons/HighlighterIcon.d.ts +0 -4
- package/dist/typescript/commonjs/shared/icons/HighlighterIcon.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/icons/StopIcon.d.ts +0 -4
- package/dist/typescript/commonjs/shared/icons/StopIcon.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/translation/validation.types.d.ts +0 -17
- package/dist/typescript/commonjs/shared/translation/validation.types.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts +0 -10
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageContent.d.ts +0 -11
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageContent.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/helpers.d.ts +0 -4
- package/dist/typescript/module/features/chatbot/components/ChatMessage/helpers.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/context/ChatBotModelContext.d.ts +0 -4
- package/dist/typescript/module/features/chatbot/context/ChatBotModelContext.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts +0 -8
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +0 -35
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts +0 -33
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/ChatBoxTextManager.d.ts +0 -6
- package/dist/typescript/module/features/chatbot/model/ChatBoxTextManager.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/ChatbotApi.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts +0 -27
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts +0 -34
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +0 -1
- package/dist/typescript/module/lib/effector/withEvent.d.ts +0 -2
- package/dist/typescript/module/lib/effector/withEvent.d.ts.map +0 -1
- package/dist/typescript/module/lib/types/keys.d.ts +0 -8
- package/dist/typescript/module/lib/types/keys.d.ts.map +0 -1
- package/dist/typescript/module/shared/icons/HighlighterIcon.d.ts +0 -4
- package/dist/typescript/module/shared/icons/HighlighterIcon.d.ts.map +0 -1
- package/dist/typescript/module/shared/icons/StopIcon.d.ts +0 -4
- package/dist/typescript/module/shared/icons/StopIcon.d.ts.map +0 -1
- package/dist/typescript/module/shared/translation/validation.types.d.ts +0 -17
- package/dist/typescript/module/shared/translation/validation.types.d.ts.map +0 -1
- package/src/features/chatbot/components/ChatMessage/MessageButtonsBlock.tsx +0 -38
- package/src/features/chatbot/components/ChatMessage/MessageContent.tsx +0 -52
- package/src/features/chatbot/components/ChatMessage/helpers.ts +0 -9
- package/src/features/chatbot/context/ChatBotModelContext.ts +0 -14
- package/src/features/chatbot/errorSpotting/ErrorSpottingButton.tsx +0 -53
- package/src/features/chatbot/errorSpotting/ErrorSpottingModel.ts +0 -150
- package/src/features/chatbot/model/ChatBoxTextManager.ts +0 -18
- package/src/features/chatbot/model/ChatsCacheModel.ts +0 -95
- package/src/features/chatbot/types/units.types.ts +0 -37
- package/src/lib/effector/withEvent.ts +0 -7
- package/src/lib/types/keys.ts +0 -18
- package/src/shared/icons/HighlighterIcon.tsx +0 -21
- package/src/shared/icons/StopIcon.tsx +0 -17
- package/src/shared/translation/validation.types.ts +0 -26
package/dist/commonjs/features/chatbot/model/{ChatBotThreadManager.js → ChatBotMessageHandler.js}
RENAMED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.ChatMessageHandler = void 0;
|
|
7
7
|
var _ThreadItem = require("./ThreadItem.js");
|
|
8
|
+
var _effector = require("effector/effector.umd");
|
|
8
9
|
var _constants = require("./constants.js");
|
|
9
|
-
class
|
|
10
|
-
api = null;
|
|
11
|
-
drawBoardAdapter = null;
|
|
10
|
+
class ChatMessageHandler {
|
|
12
11
|
threads = new Map();
|
|
13
12
|
currentKey = '';
|
|
14
13
|
currentBinding = null;
|
|
@@ -18,8 +17,8 @@ class ChatBotThreadManager {
|
|
|
18
17
|
messagesLimit = _constants.CHAT_BOT_MODEL_DEFAULTS.THREAD_MESSAGES_LIMIT,
|
|
19
18
|
messages
|
|
20
19
|
}) {
|
|
21
|
-
|
|
22
|
-
this.drawBoardAdapter = drawBoardAdapter
|
|
20
|
+
this.api = api;
|
|
21
|
+
this.drawBoardAdapter = drawBoardAdapter;
|
|
23
22
|
this.messagesLimit = messagesLimit;
|
|
24
23
|
this.defaultMessages = messages;
|
|
25
24
|
}
|
|
@@ -34,36 +33,24 @@ class ChatBotThreadManager {
|
|
|
34
33
|
const key = this.currentKey;
|
|
35
34
|
let threadItem = this.threads.get(key);
|
|
36
35
|
if (threadItem) return threadItem;
|
|
37
|
-
if (!this.drawBoardAdapter) {
|
|
38
|
-
threadItem = new _ThreadItem.ThreadItem();
|
|
39
|
-
this.threads.set(key, threadItem);
|
|
40
|
-
return threadItem;
|
|
41
|
-
}
|
|
42
36
|
try {
|
|
43
|
-
const
|
|
44
|
-
threadItem = new _ThreadItem.ThreadItem(
|
|
45
|
-
strokes
|
|
46
|
-
|
|
47
|
-
} : null);
|
|
37
|
+
const strokes = await this.drawBoardAdapter.getVisibleStrokes();
|
|
38
|
+
threadItem = new _ThreadItem.ThreadItem({
|
|
39
|
+
strokes
|
|
40
|
+
});
|
|
48
41
|
} catch {
|
|
49
42
|
threadItem = new _ThreadItem.ThreadItem();
|
|
50
43
|
}
|
|
51
44
|
this.threads.set(key, threadItem);
|
|
52
45
|
return threadItem;
|
|
53
46
|
}
|
|
54
|
-
|
|
55
|
-
this.drawBoardAdapter = adapter;
|
|
56
|
-
}
|
|
57
|
-
postMessage = async ({
|
|
47
|
+
postMessageFx = async ({
|
|
58
48
|
problemAnswer,
|
|
59
49
|
problem,
|
|
60
50
|
answer,
|
|
61
51
|
language,
|
|
62
52
|
imageAltText
|
|
63
53
|
}) => {
|
|
64
|
-
if (!this.api) {
|
|
65
|
-
throw new Error('API is not set in ThreadManagersApi, pls provide API before sending requests');
|
|
66
|
-
}
|
|
67
54
|
const threadItem = await this.getThreadItem();
|
|
68
55
|
const result = await this.api.getHint({
|
|
69
56
|
...threadItem.getNextHintProps(),
|
|
@@ -73,32 +60,23 @@ class ChatBotThreadManager {
|
|
|
73
60
|
language,
|
|
74
61
|
imageAltText
|
|
75
62
|
});
|
|
76
|
-
threadItem.
|
|
77
|
-
const nextOptions = threadItem.
|
|
63
|
+
threadItem.hints.push(result.message);
|
|
64
|
+
const nextOptions = threadItem.hints.length < this.messagesLimit ? [this.defaultMessages.anotherHintOption] : [];
|
|
78
65
|
return {
|
|
79
66
|
message: result.message,
|
|
80
67
|
options: nextOptions,
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
threadId: '',
|
|
69
|
+
endMessage: !nextOptions.length
|
|
83
70
|
};
|
|
84
71
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
72
|
+
resetThread = (0, _effector.createEffect)(({
|
|
73
|
+
key
|
|
74
|
+
}) => {
|
|
75
|
+
this.threads.delete(key);
|
|
76
|
+
});
|
|
77
|
+
resetAll() {
|
|
93
78
|
this.threads.clear();
|
|
94
79
|
}
|
|
95
|
-
setMessagesLimit(limit) {
|
|
96
|
-
this.messagesLimit = limit;
|
|
97
|
-
}
|
|
98
|
-
setApi(api) {
|
|
99
|
-
this.api = api;
|
|
100
|
-
return this;
|
|
101
|
-
}
|
|
102
80
|
}
|
|
103
|
-
exports.
|
|
104
|
-
//# sourceMappingURL=
|
|
81
|
+
exports.ChatMessageHandler = ChatMessageHandler;
|
|
82
|
+
//# sourceMappingURL=ChatBotMessageHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ThreadItem","require","_effector","_constants","ChatMessageHandler","threads","Map","currentKey","currentBinding","constructor","drawBoardAdapter","api","messagesLimit","CHAT_BOT_MODEL_DEFAULTS","THREAD_MESSAGES_LIMIT","messages","defaultMessages","bindKeyStore","$store","watch","value","getThreadItem","key","threadItem","get","strokes","getVisibleStrokes","ThreadItem","set","postMessageFx","problemAnswer","problem","answer","language","imageAltText","result","getHint","getNextHintProps","correctAnswer","problemDescription","userAnswer","hints","push","message","nextOptions","length","anotherHintOption","options","threadId","endMessage","resetThread","createEffect","delete","resetAll","clear","exports"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/ChatBotMessageHandler.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAQA,IAAAE,UAAA,GAAAF,OAAA;AAeO,MAAMG,kBAAkB,CAAC;EAGbC,OAAO,GAAG,IAAIC,GAAG,CAAqB,CAAC;EAGhDC,UAAU,GAAG,EAAE;EACfC,cAAc,GAAwB,IAAI;EAI3CC,WAAWA,CAAC;IACjBC,gBAAgB;IAChBC,GAAG;IACHC,aAAa,GAAGC,kCAAuB,CAACC,qBAAqB;IAC7DC;EACuB,CAAC,EAAE;IAC1B,IAAI,CAACJ,GAAG,GAAGA,GAAG;IACd,IAAI,CAACD,gBAAgB,GAAGA,gBAAgB;IACxC,IAAI,CAACE,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACI,eAAe,GAAGD,QAAQ;EACjC;EAEOE,YAAYA,CAACC,MAAqB,EAAE;IACzC,IA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IAAI,CAACjC,aAAa,GAAG,CAAC,IAAI,CAACI,eAAe,CAAC8B,iBAAiB,CAAC,GAAG,EAAE;IAE9F,OAAO;MACLH,OAAO,EAAER,MAAM,CAACQ,OAAO;MACvBI,OAAO,EAAEH,WAAW;MACpBI,QAAQ,EAAE,EAAE;MACZC,UAAU,EAAE,CAACL,WAAW,CAACC;IAC3B,CAAC;EACH,CAAC;EAEMK,WAAW,GAAG,IAAAC,sBAAY,EAAC,CAAC;IAAE7B;EAAqB,CAAC,KAAK;IAC9D,IAAI,CAACjB,OAAO,CAAC+C,MAAM,CAAC9B,GAAG,CAAC;EAC1B,CAAC,CAAC;EAEK+B,QAAQA,CAAA,EAAG;IAChB,IAAI,CAAChD,OAAO,CAACiD,KAAK,CAAC,CAAC;EACtB;AACF;AAACC,OAAA,CAAAnD,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -5,21 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ChatbotModel = void 0;
|
|
7
7
|
var _effector = require("effector");
|
|
8
|
-
var
|
|
8
|
+
var _index = require("../../../lib/effector/index.js");
|
|
9
|
+
var _api = require("./api.js");
|
|
9
10
|
var _translation = require("./translation.js");
|
|
10
11
|
var _t2s = require("./t2s.js");
|
|
11
12
|
var _messagesHelper = require("./messagesHelper.js");
|
|
12
|
-
var _ChatBotThreadManager = require("./ChatBotThreadManager.js");
|
|
13
|
-
var _ChatsCacheModel = require("./ChatsCacheModel.js");
|
|
14
|
-
var _ErrorSpottingModel = require("../errorSpotting/ErrorSpottingModel.js");
|
|
15
|
-
var _withEvent = require("../../../lib/effector/withEvent.js");
|
|
16
|
-
var _ChatBoxTextManager = require("./ChatBoxTextManager.js");
|
|
17
13
|
class ChatbotModel {
|
|
18
|
-
textManager = new _ChatBoxTextManager.ChatBotTextManager();
|
|
19
|
-
defaultMessages = this.textManager.messages;
|
|
20
|
-
threadManager = new _ChatBotThreadManager.ChatBotThreadManager({
|
|
21
|
-
messages: this.defaultMessages
|
|
22
|
-
});
|
|
23
14
|
$currentKey = (0, _effector.createStore)('');
|
|
24
15
|
resetAlternatives = (0, _effector.createEvent)();
|
|
25
16
|
setAlternatives = (0, _effector.createEvent)();
|
|
@@ -33,104 +24,84 @@ class ChatbotModel {
|
|
|
33
24
|
$context = (0, _effector.restore)(this.setContext, null);
|
|
34
25
|
setScrollActive = (0, _effector.createEvent)();
|
|
35
26
|
$isScrollActive = (0, _effector.restore)(this.setScrollActive, false);
|
|
36
|
-
|
|
27
|
+
messages = (0, _index.createEntityFieldStore)();
|
|
28
|
+
threadIds = (0, _index.createEntityFieldStore)();
|
|
29
|
+
availableChats = (0, _index.createEntityFieldStore)();
|
|
37
30
|
$currentChatData = (0, _effector.combine)({
|
|
38
|
-
|
|
31
|
+
messages: this.messages.$state,
|
|
32
|
+
threadIds: this.threadIds.$state,
|
|
33
|
+
availableChats: this.availableChats.$state,
|
|
39
34
|
key: this.$currentKey
|
|
40
35
|
}, ({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
...data[key],
|
|
45
|
-
key
|
|
46
|
-
} : {
|
|
47
|
-
...(0, _ChatsCacheModel.defaultChatData)(),
|
|
36
|
+
messages,
|
|
37
|
+
threadIds,
|
|
38
|
+
availableChats,
|
|
48
39
|
key
|
|
40
|
+
}) => {
|
|
41
|
+
return {
|
|
42
|
+
messages: messages[key] ?? [],
|
|
43
|
+
threadId: threadIds[key] ?? null,
|
|
44
|
+
isAvailable: availableChats[key] ?? false,
|
|
45
|
+
key
|
|
46
|
+
};
|
|
49
47
|
});
|
|
50
48
|
constructor({
|
|
51
49
|
api,
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
messages,
|
|
51
|
+
$key
|
|
54
52
|
}) {
|
|
55
|
-
this.api = new
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
getHint: api.requestHint
|
|
53
|
+
this.api = new _api.ChatbotAPI(api);
|
|
54
|
+
this.defaultMessages = messages;
|
|
55
|
+
if ($key) (0, _effector.sample)({
|
|
56
|
+
source: $key,
|
|
57
|
+
target: this.$currentKey
|
|
61
58
|
});
|
|
62
|
-
if (threadMessagesLimit) {
|
|
63
|
-
this.threadManager.setMessagesLimit(threadMessagesLimit);
|
|
64
|
-
}
|
|
65
59
|
this.$alternatives = (0, _effector.restore)(this.api.getAlternativesFx.doneData, null).on(this.setAlternatives, (_, payload) => payload).reset(this.resetAlternatives);
|
|
66
|
-
this.t2s = new _t2s.ChatTextToSpeechModel({
|
|
67
|
-
api: this.api
|
|
68
|
-
});
|
|
69
60
|
this.translation = new _translation.ChatbotTranslation({
|
|
70
61
|
$context: this.$context,
|
|
71
|
-
defaultMessages:
|
|
62
|
+
defaultMessages: messages,
|
|
72
63
|
$key: this.$currentKey,
|
|
73
64
|
api: this.api,
|
|
65
|
+
messagesModel: this.messages,
|
|
74
66
|
alternativesModel: {
|
|
75
67
|
$store: this.$alternatives,
|
|
76
68
|
set: this.setAlternatives
|
|
77
|
-
}
|
|
78
|
-
chats: this.cache
|
|
79
|
-
});
|
|
80
|
-
this.errorSpotting = new _ErrorSpottingModel.ErrorSpottingModel({
|
|
81
|
-
api: this.api,
|
|
82
|
-
$currentChatData: this.$currentChatData,
|
|
83
|
-
$currentChatContext: this.$context
|
|
84
|
-
});
|
|
85
|
-
if ($key) this.bindKey($key);
|
|
86
|
-
(0, _effector.sample)({
|
|
87
|
-
source: this.$isOpen.updates,
|
|
88
|
-
filter: isOpen => !isOpen,
|
|
89
|
-
target: [this.t2s.reset, this.errorSpotting.spottingHidden]
|
|
69
|
+
}
|
|
90
70
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
fn: ([lastMessageKey, chatsData]) => {
|
|
95
|
-
const chat = chatsData[lastMessageKey ?? ''];
|
|
96
|
-
if (!chat) return {
|
|
97
|
-
key: '',
|
|
98
|
-
data: {}
|
|
99
|
-
};
|
|
100
|
-
const updatedMessages = [...chat.messages];
|
|
101
|
-
updatedMessages.pop();
|
|
102
|
-
return {
|
|
103
|
-
key: lastMessageKey ?? '',
|
|
104
|
-
data: {
|
|
105
|
-
messages: updatedMessages
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
},
|
|
109
|
-
filter: ([lastMessageKey]) => !!lastMessageKey,
|
|
110
|
-
target: this.cache.update
|
|
71
|
+
this.t2s = new _t2s.ChatTextToSpeechModel({
|
|
72
|
+
$isOpen: this.$isOpen,
|
|
73
|
+
api: this.api
|
|
111
74
|
});
|
|
75
|
+
this.sendHelpRequestFx = this.createSendHelpRequestFx();
|
|
76
|
+
this.initChatReplyWatcher();
|
|
112
77
|
}
|
|
113
78
|
createSendHelpRequestFx() {
|
|
114
79
|
const effect = (0, _effector.attach)({
|
|
115
|
-
source: [this.$currentKey, this.$context],
|
|
116
|
-
mapParams: (params, [key, context]) => ({
|
|
80
|
+
source: [this.$currentKey, this.translation.$isTranslated, this.$currentChatData, this.$context],
|
|
81
|
+
mapParams: (params, [key, isTranslated, currentData, context]) => ({
|
|
117
82
|
message: params.message,
|
|
118
83
|
translatedMessage: params.translatedMessage,
|
|
119
84
|
context,
|
|
120
|
-
key
|
|
85
|
+
key,
|
|
86
|
+
isTranslated,
|
|
87
|
+
threadId: currentData.threadId
|
|
121
88
|
}),
|
|
122
|
-
effect: (0,
|
|
89
|
+
effect: (0, _index.createControllerEffect)(async ({
|
|
123
90
|
message,
|
|
124
91
|
translatedMessage,
|
|
125
92
|
key,
|
|
93
|
+
isTranslated,
|
|
94
|
+
threadId,
|
|
126
95
|
context
|
|
127
96
|
}) => {
|
|
128
|
-
if (!context) throw new Error('
|
|
97
|
+
if (!context) throw new Error('Context is required');
|
|
129
98
|
this.setLastMessageKey(key);
|
|
130
|
-
this.
|
|
131
|
-
|
|
99
|
+
this.messages.setField({
|
|
100
|
+
key,
|
|
101
|
+
fn: currentMessages => [...(currentMessages || []), _messagesHelper.messagesHelper.createOwn({
|
|
132
102
|
message,
|
|
133
|
-
translatedMessage
|
|
103
|
+
translatedMessage,
|
|
104
|
+
threadId
|
|
134
105
|
})]
|
|
135
106
|
});
|
|
136
107
|
const response = await this.api.postMessageFx({
|
|
@@ -138,19 +109,26 @@ class ChatbotModel {
|
|
|
138
109
|
language: context.language,
|
|
139
110
|
problemAnswer: context.problemAnswer,
|
|
140
111
|
answer: context.answer,
|
|
112
|
+
threadId,
|
|
141
113
|
imageAltText: context.imageDescription
|
|
142
114
|
});
|
|
143
|
-
|
|
144
|
-
const messages = [_messagesHelper.messagesHelper.createAnswer(response, {
|
|
145
|
-
isInitial: thread?.history.length === 1
|
|
146
|
-
})];
|
|
115
|
+
let messages = [_messagesHelper.messagesHelper.createAnswer(response)];
|
|
147
116
|
if (response.endMessage) {
|
|
148
117
|
messages.push(_messagesHelper.messagesHelper.createLast(this.defaultMessages.endMessage));
|
|
149
118
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
119
|
+
if (isTranslated) {
|
|
120
|
+
messages = await this.translation.translateMessagesFx({
|
|
121
|
+
targetLanguage: context.translationTargetLanguage,
|
|
122
|
+
messages
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
this.messages.setField({
|
|
126
|
+
key,
|
|
127
|
+
fn: currentMessages => [...(currentMessages || []), ...messages]
|
|
128
|
+
});
|
|
129
|
+
this.threadIds.setField({
|
|
130
|
+
key,
|
|
131
|
+
data: response.threadId
|
|
154
132
|
});
|
|
155
133
|
})
|
|
156
134
|
});
|
|
@@ -162,35 +140,35 @@ class ChatbotModel {
|
|
|
162
140
|
messages
|
|
163
141
|
}) => ({
|
|
164
142
|
key,
|
|
165
|
-
data:
|
|
166
|
-
messages: [...messages, this.defaultMessages.error]
|
|
167
|
-
}
|
|
143
|
+
data: [...messages, this.defaultMessages.error]
|
|
168
144
|
}),
|
|
169
145
|
filter: (_, {
|
|
170
146
|
error
|
|
171
147
|
}) => error.message !== 'Request aborted manually',
|
|
172
|
-
target: this.
|
|
148
|
+
target: this.messages.setField
|
|
173
149
|
});
|
|
174
150
|
return effect;
|
|
175
151
|
}
|
|
176
|
-
|
|
152
|
+
initChatReplyWatcher() {
|
|
177
153
|
(0, _effector.sample)({
|
|
178
|
-
|
|
179
|
-
|
|
154
|
+
clock: this.removeLastMessage,
|
|
155
|
+
source: [this.$lastMessageKey, this.messages.$state],
|
|
156
|
+
fn: ([lastMessageKey, messages]) => {
|
|
157
|
+
if (!lastMessageKey) return {
|
|
158
|
+
key: '',
|
|
159
|
+
data: []
|
|
160
|
+
};
|
|
161
|
+
const updatedMessages = [...messages[lastMessageKey]];
|
|
162
|
+
updatedMessages.pop();
|
|
163
|
+
return {
|
|
164
|
+
key: lastMessageKey,
|
|
165
|
+
data: updatedMessages
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
filter: ([lastMessageKey]) => !!lastMessageKey,
|
|
169
|
+
target: this.messages.setField
|
|
180
170
|
});
|
|
181
|
-
this.threadManager.bindKeyStore($store);
|
|
182
|
-
return this;
|
|
183
171
|
}
|
|
184
|
-
setUpT2S(config) {
|
|
185
|
-
this.t2s.setConfig(config);
|
|
186
|
-
return this;
|
|
187
|
-
}
|
|
188
|
-
setDrawBoardAdapter(adapter) {
|
|
189
|
-
this.threadManager.setDrawBoardAdapter(adapter);
|
|
190
|
-
this.errorSpotting.bindStrokesValidation(adapter.$strokesValidationKey);
|
|
191
|
-
return this;
|
|
192
|
-
}
|
|
193
|
-
sendHelpRequestFx = this.createSendHelpRequestFx();
|
|
194
172
|
startConversation = (0, _effector.attach)({
|
|
195
173
|
source: this.$currentChatData,
|
|
196
174
|
mapParams: (props, source) => ({
|
|
@@ -208,10 +186,13 @@ class ChatbotModel {
|
|
|
208
186
|
key
|
|
209
187
|
});
|
|
210
188
|
}
|
|
211
|
-
this.
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
189
|
+
this.messages.setField({
|
|
190
|
+
key,
|
|
191
|
+
data: [this.defaultMessages.start]
|
|
192
|
+
});
|
|
193
|
+
this.availableChats.setField({
|
|
194
|
+
key,
|
|
195
|
+
data: true
|
|
215
196
|
});
|
|
216
197
|
})
|
|
217
198
|
});
|
|
@@ -220,51 +201,49 @@ class ChatbotModel {
|
|
|
220
201
|
...message
|
|
221
202
|
}) {
|
|
222
203
|
const options = this.$alternatives.getState()?.options.hints ?? message.options;
|
|
223
|
-
this.
|
|
224
|
-
|
|
225
|
-
|
|
204
|
+
this.messages.setField({
|
|
205
|
+
key,
|
|
206
|
+
fn: messages => {
|
|
207
|
+
if (!messages || messages.length > 1) return;
|
|
208
|
+
return [{
|
|
209
|
+
...message,
|
|
210
|
+
options
|
|
211
|
+
}];
|
|
212
|
+
}
|
|
226
213
|
});
|
|
227
214
|
}
|
|
228
|
-
reinitConversation = ({
|
|
215
|
+
reinitConversation = (0, _effector.createEffect)(({
|
|
229
216
|
key
|
|
230
217
|
}) => {
|
|
231
|
-
this.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
mapParams: (_, {
|
|
247
|
-
isLoading,
|
|
248
|
-
lastMessageKey
|
|
249
|
-
}) => !!(isLoading && lastMessageKey),
|
|
250
|
-
effect: (0, _effector.createEffect)(hasPendingMessage => {
|
|
251
|
-
if (hasPendingMessage) {
|
|
252
|
-
this.api.postMessageFx.controller.abort();
|
|
253
|
-
this.removeLastMessage();
|
|
218
|
+
this.messages.setField({
|
|
219
|
+
key,
|
|
220
|
+
fn: messages => {
|
|
221
|
+
if (!messages?.length || messages.length === 1) return;
|
|
222
|
+
const copy = [...messages];
|
|
223
|
+
while (copy.at(-1)?.endMessage) {
|
|
224
|
+
copy.pop();
|
|
225
|
+
}
|
|
226
|
+
const lastMessage = copy.at(-1);
|
|
227
|
+
if (!lastMessage) return;
|
|
228
|
+
copy.splice(copy.length - 1, 1, {
|
|
229
|
+
...lastMessage,
|
|
230
|
+
options: [this.defaultMessages.anotherHintOption]
|
|
231
|
+
});
|
|
232
|
+
return copy;
|
|
254
233
|
}
|
|
255
|
-
|
|
256
|
-
this.t2s.stop();
|
|
257
|
-
void this.t2s.reset();
|
|
258
|
-
this.translation.reset();
|
|
259
|
-
this.setScrollActive(false);
|
|
260
|
-
})
|
|
261
|
-
});
|
|
262
|
-
reset = (0, _withEvent.withEvent)(() => {
|
|
263
|
-
this.cache.reset();
|
|
264
|
-
this.resetAlternatives();
|
|
265
|
-
this.threadManager.reset();
|
|
266
|
-
this.errorSpotting.reset();
|
|
234
|
+
});
|
|
267
235
|
});
|
|
236
|
+
bindKey($store) {
|
|
237
|
+
(0, _effector.sample)({
|
|
238
|
+
source: $store,
|
|
239
|
+
target: this.$currentKey
|
|
240
|
+
});
|
|
241
|
+
return this;
|
|
242
|
+
}
|
|
243
|
+
setT2SAudioProvider(audioProvider) {
|
|
244
|
+
this.t2s.setAudioProvider(audioProvider);
|
|
245
|
+
return this;
|
|
246
|
+
}
|
|
268
247
|
}
|
|
269
248
|
exports.ChatbotModel = ChatbotModel;
|
|
270
249
|
//# sourceMappingURL=ChatBotModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_effector","require","_ChatbotApi","_translation","_t2s","_messagesHelper","_ChatBotThreadManager","_ChatsCacheModel","_ErrorSpottingModel","_withEvent","_ChatBoxTextManager","ChatbotModel","textManager","ChatBotTextManager","defaultMessages","messages","threadManager","ChatBotThreadManager","$currentKey","createStore","resetAlternatives","createEvent","setAlternatives","setIsOpen","toggleOpen","$isOpen","restore","on","isOpen","removeLastMessage","setLastMessageKey","$lastMessageKey","setContext","$context","setScrollActive","$isScrollActive","cache","ChatsCacheModel","$currentChatData","combine","data","$data","key","defaultChatData","constructor","api","$key","threadMessagesLimit","ChatbotAPI","postMessage","setApi","getHint","requestHint","setMessagesLimit","$alternatives","getAlternativesFx","doneData","_","payload","reset","t2s","ChatTextToSpeechModel","translation","ChatbotTranslation","alternativesModel","$store","set","chats","errorSpotting","ErrorSpottingModel","$currentChatContext","bindKey","sample","source","updates","filter","target","spottingHidden","clock","fn","lastMessageKey","chatsData","chat","updatedMessages","pop","update","createSendHelpRequestFx","effect","attach","mapParams","params","context","message","translatedMessage","createEffect","Error","addMessages","messagesHelper","createOwn","response","postMessageFx","problem","language","problemAnswer","answer","imageAltText","imageDescription","thread","get","createAnswer","isInitial","history","length","endMessage","push","createLast","translatedMessages","applyTranslationFx","fail","error","bindKeyStore","setUpT2S","config","setConfig","setDrawBoardAdapter","adapter","bindStrokesValidation","$strokesValidationKey","sendHelpRequestFx","startConversation","props","initOnly","reinitConversation","add","start","isAvailable","currentThread","setHintMessage","options","getState","hints","setSingleMessage","reinitChatThread","initialOption","anotherHintOption","disableChat","stop","softReset","isLoading","pending","hasPendingMessage","controller","abort","abortPendingRequest","withEvent","exports"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/ChatBotModel.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAqBA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,mBAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,mBAAA,GAAAT,OAAA;AAMO,MAAMU,YAAY,CAAC;EACRC,WAAW,GAAG,IAAIC,sCAAkB,CAAC,CAAC;EACrCC,eAAe,GAAG,IAAI,CAACF,WAAW,CAACG,QAAQ;EAE5CC,aAAa,GAAG,IAAIC,0CAAoB,CAAC;IACvDF,QAAQ,EAAE,IAAI,CAACD;EACjB,CAAC,CAAC;EAOcI,WAAW,GAAG,IAAA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iBAAiB,CAAC,CAAC;IACxB,IAAI,CAACJ,aAAa,CAAC2C,KAAK,CAAC,CAAC;IAC1B,IAAI,CAACS,aAAa,CAACT,KAAK,CAAC,CAAC;EAC5B,CAAC,CAAC;AACJ;AAACgG,OAAA,CAAAhJ,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_effector","require","_index","_api","_translation","_t2s","_messagesHelper","ChatbotModel","$currentKey","createStore","resetAlternatives","createEvent","setAlternatives","setIsOpen","toggleOpen","$isOpen","restore","on","isOpen","removeLastMessage","setLastMessageKey","$lastMessageKey","setContext","$context","setScrollActive","$isScrollActive","messages","createEntityFieldStore","threadIds","availableChats","$currentChatData","combine","$state","key","threadId","isAvailable","constructor","api","$key","ChatbotAPI","defaultMessages","sample","source","target","$alternatives","getAlternativesFx","doneData","_","payload","reset","translation","ChatbotTranslation","messagesModel","alternativesModel","$store","set","t2s","ChatTextToSpeechModel","sendHelpRequestFx","createSendHelpRequestFx","initChatReplyWatcher","effect","attach","$isTranslated","mapParams","params","isTranslated","currentData","context","message","translatedMessage","createControllerEffect","Error","setField","fn","currentMessages","messagesHelper","createOwn","response","postMessageFx","problem","language","problemAnswer","answer","imageAltText","imageDescription","createAnswer","endMessage","push","createLast","translateMessagesFx","targetLanguage","translationTargetLanguage","data","clock","fail","error","filter","lastMessageKey","updatedMessages","pop","startConversation","props","createEffect","initOnly","length","reinitConversation","start","setHintMessage","options","getState","hints","copy","at","lastMessage","splice","anotherHintOption","bindKey","setT2SAudioProvider","audioProvider","setAudioProvider","exports"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/ChatBotModel.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAUA,IAAAC,MAAA,GAAAD,OAAA;AAYA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AAEA,IAAAK,eAAA,GAAAL,OAAA;AAMO,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,CAAC,CAAC,CAAC,CAAC,EAAE1B,UAAU,EAAE;UAC9ByB,IAAI,CAACZ,GAAG,CAAC,CAAC;QACZ;QAEA,MAAMc,WAAW,GAAGF,IAAI,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,CAACC,WAAW,EAAE;QAElBF,IAAI,CAACG,MAAM,CAACH,IAAI,CAACP,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE;UAC9B,GAAGS,WAAW;UACdL,OAAO,EAAE,CAAC,IAAI,CAACrE,eAAe,CAAC4E,iBAAiB;QAClD,CAAC,CAAC;QACF,OAAOJ,IAAI;MACb;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEKK,OAAOA,CAAC/D,MAAqB,EAAE;IACpC,IAAAb,gBAAM,EAAC;MACLC,MAAM,EAAEY,MAAM;MACdX,MAAM,EAAE,IAAI,CAACnC;IACf,CAAC,CAAC;IACF,OAAO,IAAI;EACb;EAEO8G,mBAAmBA,CAACC,aAA4B,EAAE;IACvD,IAAI,CAAC/D,GAAG,CAACgE,gBAAgB,CAACD,aAAa,CAAC;IACxC,OAAO,IAAI;EACb;AACF;AAACE,OAAA,CAAAlH,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -4,12 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DefaultMessagesCreator = void 0;
|
|
7
|
+
var _effector = require("effector");
|
|
7
8
|
class DefaultMessagesCreator {
|
|
9
|
+
languageChanged = (0, _effector.createEvent)();
|
|
8
10
|
list = new Map();
|
|
9
11
|
constructor({
|
|
10
12
|
textGetter
|
|
11
13
|
}) {
|
|
12
14
|
this.getter = textGetter;
|
|
15
|
+
this.languageChanged.watch(() => {
|
|
16
|
+
this.list.forEach((key, chatMessage) => {
|
|
17
|
+
if ('message' in chatMessage) {
|
|
18
|
+
chatMessage.message = this.getter(key);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
chatMessage.text = this.getter(key);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
13
24
|
}
|
|
14
25
|
createMessage(key, {
|
|
15
26
|
isOwn = false
|
|
@@ -17,6 +28,7 @@ class DefaultMessagesCreator {
|
|
|
17
28
|
const message = {
|
|
18
29
|
id: this.list.size.toString(),
|
|
19
30
|
message: this.getter(key),
|
|
31
|
+
threadId: '',
|
|
20
32
|
options: [],
|
|
21
33
|
isOwnMessage: isOwn
|
|
22
34
|
};
|
|
@@ -31,18 +43,6 @@ class DefaultMessagesCreator {
|
|
|
31
43
|
this.list.set(option, key);
|
|
32
44
|
return option;
|
|
33
45
|
}
|
|
34
|
-
bindToLanguageChanged(event) {
|
|
35
|
-
event.watch(() => {
|
|
36
|
-
this.list.forEach((key, chatMessage) => {
|
|
37
|
-
if ('message' in chatMessage) {
|
|
38
|
-
chatMessage.message = this.getter(key);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
chatMessage.text = this.getter(key);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
return this;
|
|
45
|
-
}
|
|
46
46
|
}
|
|
47
47
|
exports.DefaultMessagesCreator = DefaultMessagesCreator;
|
|
48
48
|
//# sourceMappingURL=DefaultMessageCreator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DefaultMessagesCreator","list","Map","constructor","textGetter","getter","
|
|
1
|
+
{"version":3,"names":["_effector","require","DefaultMessagesCreator","languageChanged","createEvent","list","Map","constructor","textGetter","getter","watch","forEach","key","chatMessage","message","text","createMessage","isOwn","id","size","toString","threadId","options","isOwnMessage","set","createOption","option","promptKey","exports"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/DefaultMessageCreator.ts"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAeO,MAAMC,sBAAsB,CAAmB;EACpCC,eAAe,GAAG,IAAAC,qBAAW,EAAC,CAAC;EAE9BC,IAAI,GAAG,IAAIC,GAAG,CAA8B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
|
|
5
5
|
});
|
|
6
6
|
exports.ThreadItem = void 0;
|
|
7
|
-
var _helpers = require("../../../lib/helpers/helpers.js");
|
|
8
7
|
class ThreadItem {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.strokes =
|
|
14
|
-
this.strokesValidationKey = props?.key ?? null;
|
|
8
|
+
hints = [];
|
|
9
|
+
constructor({
|
|
10
|
+
strokes
|
|
11
|
+
} = {}) {
|
|
12
|
+
this.strokes = strokes ?? null;
|
|
15
13
|
}
|
|
16
14
|
getNextHintProps() {
|
|
17
|
-
if (this.
|
|
15
|
+
if (this.hints.length) {
|
|
18
16
|
return {
|
|
19
|
-
previousHint: this.
|
|
17
|
+
previousHint: this.hints[this.hints.length - 1]
|
|
20
18
|
};
|
|
21
19
|
}
|
|
22
20
|
if (this.strokes) {
|
|
23
21
|
return {
|
|
24
|
-
stroke: this.strokes
|
|
25
|
-
x,
|
|
26
|
-
y
|
|
27
|
-
}) => ({
|
|
28
|
-
x,
|
|
29
|
-
y
|
|
30
|
-
}))
|
|
22
|
+
stroke: this.strokes
|
|
31
23
|
};
|
|
32
24
|
}
|
|
33
25
|
return {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ThreadItem","hints","constructor","strokes","getNextHintProps","length","previousHint","stroke","exports"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/ThreadItem.ts"],"mappings":";;;;;;AAMO,MAAMA,UAAU,CAAC;EAENC,KAAK,GAAa,EAAE;EAE7BC,WAAWA,CAAC;IAAEC;EAAyB,CAAC,GAAG,CAAC,CAAC,EAAE;IACpD,IAAI,CAACA,OAAO,GAAGA,OAAO,IAAI,IAAI;EAChC;EAEOC,gBAAgBA,CAAA,EAAG;IACxB,IAAI,IAAI,CAACH,KAAK,CAACI,MAAM,EAAE;MACrB,OAAO;QACLC,YAAY,EAAE,IAAI,CAACL,KAAK,CAAC,IAAI,CAACA,KAAK,CAACI,MAAM,GAAG,CAAC;MAChD,CAAC;IACH;IAEA,IAAI,IAAI,CAACF,OAAO,EAAE;MAChB,OAAO;QAAEI,MAAM,EAAE,IAAI,CAACJ;MAAQ,CAAC;IACjC;IAEA,OAAO,CAAC,CAAC;EACX;AACF;AAACK,OAAA,CAAAR,UAAA,GAAAA,UAAA","ignoreList":[]}
|