@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
|
@@ -4,5 +4,6 @@ export { Chatbot } from "./components/Chatbot.js";
|
|
|
4
4
|
export { ChatbotModel } from "./model/ChatBotModel.js";
|
|
5
5
|
export { AudioStatus } from "./types/t2s.types.js";
|
|
6
6
|
export { MessageVariant } from "./types/model.types.js";
|
|
7
|
+
export { ChatMessageHandler } from "./model/ChatBotMessageHandler.js";
|
|
7
8
|
export { DefaultMessagesCreator } from "./model/DefaultMessageCreator.js";
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Chatbot","ChatbotModel","AudioStatus","MessageVariant","DefaultMessagesCreator"],"sourceRoot":"../../../../src","sources":["features/chatbot/index.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,yBAAsB;AAC9C,SAASC,YAAY,QAAQ,yBAAsB;AACnD,SAASC,WAAW,QAA4B,sBAAmB;AACnE,SACEC,cAAc,
|
|
1
|
+
{"version":3,"names":["Chatbot","ChatbotModel","AudioStatus","MessageVariant","ChatMessageHandler","DefaultMessagesCreator"],"sourceRoot":"../../../../src","sources":["features/chatbot/index.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,yBAAsB;AAC9C,SAASC,YAAY,QAAQ,yBAAsB;AACnD,SAASC,WAAW,QAA4B,sBAAmB;AACnE,SACEC,cAAc,QAKT,wBAAqB;AAE5B,SAASC,kBAAkB,QAAQ,kCAA+B;AAClE,SAASC,sBAAsB,QAAQ,kCAA+B","ignoreList":[]}
|
package/dist/module/features/chatbot/model/{ChatBotThreadManager.js → ChatBotMessageHandler.js}
RENAMED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { ThreadItem } from "./ThreadItem.js";
|
|
4
|
+
import { createEffect } from 'effector/effector.umd';
|
|
4
5
|
import { CHAT_BOT_MODEL_DEFAULTS } from "./constants.js";
|
|
5
|
-
export class
|
|
6
|
-
api = null;
|
|
7
|
-
drawBoardAdapter = null;
|
|
6
|
+
export class ChatMessageHandler {
|
|
8
7
|
threads = new Map();
|
|
9
8
|
currentKey = '';
|
|
10
9
|
currentBinding = null;
|
|
@@ -14,8 +13,8 @@ export class ChatBotThreadManager {
|
|
|
14
13
|
messagesLimit = CHAT_BOT_MODEL_DEFAULTS.THREAD_MESSAGES_LIMIT,
|
|
15
14
|
messages
|
|
16
15
|
}) {
|
|
17
|
-
|
|
18
|
-
this.drawBoardAdapter = drawBoardAdapter
|
|
16
|
+
this.api = api;
|
|
17
|
+
this.drawBoardAdapter = drawBoardAdapter;
|
|
19
18
|
this.messagesLimit = messagesLimit;
|
|
20
19
|
this.defaultMessages = messages;
|
|
21
20
|
}
|
|
@@ -30,36 +29,24 @@ export class ChatBotThreadManager {
|
|
|
30
29
|
const key = this.currentKey;
|
|
31
30
|
let threadItem = this.threads.get(key);
|
|
32
31
|
if (threadItem) return threadItem;
|
|
33
|
-
if (!this.drawBoardAdapter) {
|
|
34
|
-
threadItem = new ThreadItem();
|
|
35
|
-
this.threads.set(key, threadItem);
|
|
36
|
-
return threadItem;
|
|
37
|
-
}
|
|
38
32
|
try {
|
|
39
|
-
const
|
|
40
|
-
threadItem = new ThreadItem(
|
|
41
|
-
strokes
|
|
42
|
-
|
|
43
|
-
} : null);
|
|
33
|
+
const strokes = await this.drawBoardAdapter.getVisibleStrokes();
|
|
34
|
+
threadItem = new ThreadItem({
|
|
35
|
+
strokes
|
|
36
|
+
});
|
|
44
37
|
} catch {
|
|
45
38
|
threadItem = new ThreadItem();
|
|
46
39
|
}
|
|
47
40
|
this.threads.set(key, threadItem);
|
|
48
41
|
return threadItem;
|
|
49
42
|
}
|
|
50
|
-
|
|
51
|
-
this.drawBoardAdapter = adapter;
|
|
52
|
-
}
|
|
53
|
-
postMessage = async ({
|
|
43
|
+
postMessageFx = async ({
|
|
54
44
|
problemAnswer,
|
|
55
45
|
problem,
|
|
56
46
|
answer,
|
|
57
47
|
language,
|
|
58
48
|
imageAltText
|
|
59
49
|
}) => {
|
|
60
|
-
if (!this.api) {
|
|
61
|
-
throw new Error('API is not set in ThreadManagersApi, pls provide API before sending requests');
|
|
62
|
-
}
|
|
63
50
|
const threadItem = await this.getThreadItem();
|
|
64
51
|
const result = await this.api.getHint({
|
|
65
52
|
...threadItem.getNextHintProps(),
|
|
@@ -69,31 +56,22 @@ export class ChatBotThreadManager {
|
|
|
69
56
|
language,
|
|
70
57
|
imageAltText
|
|
71
58
|
});
|
|
72
|
-
threadItem.
|
|
73
|
-
const nextOptions = threadItem.
|
|
59
|
+
threadItem.hints.push(result.message);
|
|
60
|
+
const nextOptions = threadItem.hints.length < this.messagesLimit ? [this.defaultMessages.anotherHintOption] : [];
|
|
74
61
|
return {
|
|
75
62
|
message: result.message,
|
|
76
63
|
options: nextOptions,
|
|
77
|
-
|
|
78
|
-
|
|
64
|
+
threadId: '',
|
|
65
|
+
endMessage: !nextOptions.length
|
|
79
66
|
};
|
|
80
67
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
68
|
+
resetThread = createEffect(({
|
|
69
|
+
key
|
|
70
|
+
}) => {
|
|
71
|
+
this.threads.delete(key);
|
|
72
|
+
});
|
|
73
|
+
resetAll() {
|
|
89
74
|
this.threads.clear();
|
|
90
75
|
}
|
|
91
|
-
setMessagesLimit(limit) {
|
|
92
|
-
this.messagesLimit = limit;
|
|
93
|
-
}
|
|
94
|
-
setApi(api) {
|
|
95
|
-
this.api = api;
|
|
96
|
-
return this;
|
|
97
|
-
}
|
|
98
76
|
}
|
|
99
|
-
//# sourceMappingURL=
|
|
77
|
+
//# sourceMappingURL=ChatBotMessageHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ThreadItem","createEffect","CHAT_BOT_MODEL_DEFAULTS","ChatMessageHandler","threads","Map","currentKey","currentBinding","constructor","drawBoardAdapter","api","messagesLimit","THREAD_MESSAGES_LIMIT","messages","defaultMessages","bindKeyStore","$store","watch","value","getThreadItem","key","threadItem","get","strokes","getVisibleStrokes","set","postMessageFx","problemAnswer","problem","answer","language","imageAltText","result","getHint","getNextHintProps","correctAnswer","problemDescription","userAnswer","hints","push","message","nextOptions","length","anotherHintOption","options","threadId","endMessage","resetThread","delete","resetAll","clear"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/ChatBotMessageHandler.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,iBAAc;AAEzC,SAASC,YAAY,QAAQ,uBAAuB;AAQpD,SAASC,uBAAuB,QAAQ,gBAAa;AAerD,OAAO,MAAMC,kBAAkB,CAAC;EAGbC,OAAO,GAAG,IAAIC,GAAG,CAAqB,CAAC;EAGhDC,UAAU,GAAG,EAAE;EACfC,cAAc,GAAwB,IAAI;EAI3CC,WAAWA,CAAC;IACjBC,gBAAgB;IAChBC,GAAG;IACHC,aAAa,GAAGT,uBAAuB,CAACU,qBAAqB;IAC7DC;EACuB,CAAC,EAAE;IAC1B,IAAI,CAACH,GAAG,GAAGA,GAAG;IACd,IAAI,CAACD,gBAAgB,GAAGA,gBAAgB;IACxC,IAAI,CAACE,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACG,eAAe,GAAGD,QAAQ;EACjC;EAEOE,YAAYA,CAACC,MAAqB,EAAE;IACzC,IAAI,CAACT,cAAc,GAAG,CAAC;IACvB,IAAI,CAACA,cAAc,GAAGS,MAAM,CAACC,KAAK,CAAEC,KAAK,IAAK;MAC5C,IAAI,CAACZ,UAAU,GAAGY,KAAK;IACzB,CAAC,CAAC;IACF,OAAO,IAAI;EACb;EAEA,MAAcC,aAAaA,CAAA,EAAG;IAC5B,MAAMC,GAAG,GAAG,IAAI,CAACd,UAAU;IAC3B,IAAIe,UAAU,GAAG,IAAI,CAACjB,OAAO,CAACkB,GAAG,CAACF,GAAG,CAAC;IACtC,IAAIC,UAAU,EAAE,OAAOA,UAAU;IACjC,IAAI;MACF,MAAME,OAAO,GAAG,MAAM,IAAI,CAACd,gBAAgB,CAACe,iBAAiB,CAAC,CAAC;MAC/DH,UAAU,GAAG,IAAIrB,UAAU,CAAC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List":[]}
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { attach,
|
|
4
|
-
import {
|
|
3
|
+
import { attach, createEvent, restore, sample, createStore, createEffect, combine } from 'effector';
|
|
4
|
+
import { createControllerEffect, createEntityFieldStore } from "../../../lib/effector/index.js";
|
|
5
|
+
import { ChatbotAPI } from "./api.js";
|
|
5
6
|
import { ChatbotTranslation } from "./translation.js";
|
|
6
7
|
import { ChatTextToSpeechModel } from "./t2s.js";
|
|
7
8
|
import { messagesHelper } from "./messagesHelper.js";
|
|
8
|
-
import { ChatBotThreadManager } from "./ChatBotThreadManager.js";
|
|
9
|
-
import { ChatsCacheModel, defaultChatData } from "./ChatsCacheModel.js";
|
|
10
|
-
import { ErrorSpottingModel } from "../errorSpotting/ErrorSpottingModel.js";
|
|
11
|
-
import { withEvent } from "../../../lib/effector/withEvent.js";
|
|
12
|
-
import { ChatBotTextManager } from "./ChatBoxTextManager.js";
|
|
13
9
|
export class ChatbotModel {
|
|
14
|
-
textManager = new ChatBotTextManager();
|
|
15
|
-
defaultMessages = this.textManager.messages;
|
|
16
|
-
threadManager = new ChatBotThreadManager({
|
|
17
|
-
messages: this.defaultMessages
|
|
18
|
-
});
|
|
19
10
|
$currentKey = createStore('');
|
|
20
11
|
resetAlternatives = createEvent();
|
|
21
12
|
setAlternatives = createEvent();
|
|
@@ -29,104 +20,84 @@ export class ChatbotModel {
|
|
|
29
20
|
$context = restore(this.setContext, null);
|
|
30
21
|
setScrollActive = createEvent();
|
|
31
22
|
$isScrollActive = restore(this.setScrollActive, false);
|
|
32
|
-
|
|
23
|
+
messages = createEntityFieldStore();
|
|
24
|
+
threadIds = createEntityFieldStore();
|
|
25
|
+
availableChats = createEntityFieldStore();
|
|
33
26
|
$currentChatData = combine({
|
|
34
|
-
|
|
27
|
+
messages: this.messages.$state,
|
|
28
|
+
threadIds: this.threadIds.$state,
|
|
29
|
+
availableChats: this.availableChats.$state,
|
|
35
30
|
key: this.$currentKey
|
|
36
31
|
}, ({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
...data[key],
|
|
41
|
-
key
|
|
42
|
-
} : {
|
|
43
|
-
...defaultChatData(),
|
|
32
|
+
messages,
|
|
33
|
+
threadIds,
|
|
34
|
+
availableChats,
|
|
44
35
|
key
|
|
36
|
+
}) => {
|
|
37
|
+
return {
|
|
38
|
+
messages: messages[key] ?? [],
|
|
39
|
+
threadId: threadIds[key] ?? null,
|
|
40
|
+
isAvailable: availableChats[key] ?? false,
|
|
41
|
+
key
|
|
42
|
+
};
|
|
45
43
|
});
|
|
46
44
|
constructor({
|
|
47
45
|
api,
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
messages,
|
|
47
|
+
$key
|
|
50
48
|
}) {
|
|
51
|
-
this.api = new ChatbotAPI(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
getHint: api.requestHint
|
|
49
|
+
this.api = new ChatbotAPI(api);
|
|
50
|
+
this.defaultMessages = messages;
|
|
51
|
+
if ($key) sample({
|
|
52
|
+
source: $key,
|
|
53
|
+
target: this.$currentKey
|
|
57
54
|
});
|
|
58
|
-
if (threadMessagesLimit) {
|
|
59
|
-
this.threadManager.setMessagesLimit(threadMessagesLimit);
|
|
60
|
-
}
|
|
61
55
|
this.$alternatives = restore(this.api.getAlternativesFx.doneData, null).on(this.setAlternatives, (_, payload) => payload).reset(this.resetAlternatives);
|
|
62
|
-
this.t2s = new ChatTextToSpeechModel({
|
|
63
|
-
api: this.api
|
|
64
|
-
});
|
|
65
56
|
this.translation = new ChatbotTranslation({
|
|
66
57
|
$context: this.$context,
|
|
67
|
-
defaultMessages:
|
|
58
|
+
defaultMessages: messages,
|
|
68
59
|
$key: this.$currentKey,
|
|
69
60
|
api: this.api,
|
|
61
|
+
messagesModel: this.messages,
|
|
70
62
|
alternativesModel: {
|
|
71
63
|
$store: this.$alternatives,
|
|
72
64
|
set: this.setAlternatives
|
|
73
|
-
}
|
|
74
|
-
chats: this.cache
|
|
75
|
-
});
|
|
76
|
-
this.errorSpotting = new ErrorSpottingModel({
|
|
77
|
-
api: this.api,
|
|
78
|
-
$currentChatData: this.$currentChatData,
|
|
79
|
-
$currentChatContext: this.$context
|
|
80
|
-
});
|
|
81
|
-
if ($key) this.bindKey($key);
|
|
82
|
-
sample({
|
|
83
|
-
source: this.$isOpen.updates,
|
|
84
|
-
filter: isOpen => !isOpen,
|
|
85
|
-
target: [this.t2s.reset, this.errorSpotting.spottingHidden]
|
|
65
|
+
}
|
|
86
66
|
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
fn: ([lastMessageKey, chatsData]) => {
|
|
91
|
-
const chat = chatsData[lastMessageKey ?? ''];
|
|
92
|
-
if (!chat) return {
|
|
93
|
-
key: '',
|
|
94
|
-
data: {}
|
|
95
|
-
};
|
|
96
|
-
const updatedMessages = [...chat.messages];
|
|
97
|
-
updatedMessages.pop();
|
|
98
|
-
return {
|
|
99
|
-
key: lastMessageKey ?? '',
|
|
100
|
-
data: {
|
|
101
|
-
messages: updatedMessages
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
filter: ([lastMessageKey]) => !!lastMessageKey,
|
|
106
|
-
target: this.cache.update
|
|
67
|
+
this.t2s = new ChatTextToSpeechModel({
|
|
68
|
+
$isOpen: this.$isOpen,
|
|
69
|
+
api: this.api
|
|
107
70
|
});
|
|
71
|
+
this.sendHelpRequestFx = this.createSendHelpRequestFx();
|
|
72
|
+
this.initChatReplyWatcher();
|
|
108
73
|
}
|
|
109
74
|
createSendHelpRequestFx() {
|
|
110
75
|
const effect = attach({
|
|
111
|
-
source: [this.$currentKey, this.$context],
|
|
112
|
-
mapParams: (params, [key, context]) => ({
|
|
76
|
+
source: [this.$currentKey, this.translation.$isTranslated, this.$currentChatData, this.$context],
|
|
77
|
+
mapParams: (params, [key, isTranslated, currentData, context]) => ({
|
|
113
78
|
message: params.message,
|
|
114
79
|
translatedMessage: params.translatedMessage,
|
|
115
80
|
context,
|
|
116
|
-
key
|
|
81
|
+
key,
|
|
82
|
+
isTranslated,
|
|
83
|
+
threadId: currentData.threadId
|
|
117
84
|
}),
|
|
118
|
-
effect:
|
|
85
|
+
effect: createControllerEffect(async ({
|
|
119
86
|
message,
|
|
120
87
|
translatedMessage,
|
|
121
88
|
key,
|
|
89
|
+
isTranslated,
|
|
90
|
+
threadId,
|
|
122
91
|
context
|
|
123
92
|
}) => {
|
|
124
|
-
if (!context) throw new Error('
|
|
93
|
+
if (!context) throw new Error('Context is required');
|
|
125
94
|
this.setLastMessageKey(key);
|
|
126
|
-
this.
|
|
127
|
-
|
|
95
|
+
this.messages.setField({
|
|
96
|
+
key,
|
|
97
|
+
fn: currentMessages => [...(currentMessages || []), messagesHelper.createOwn({
|
|
128
98
|
message,
|
|
129
|
-
translatedMessage
|
|
99
|
+
translatedMessage,
|
|
100
|
+
threadId
|
|
130
101
|
})]
|
|
131
102
|
});
|
|
132
103
|
const response = await this.api.postMessageFx({
|
|
@@ -134,19 +105,26 @@ export class ChatbotModel {
|
|
|
134
105
|
language: context.language,
|
|
135
106
|
problemAnswer: context.problemAnswer,
|
|
136
107
|
answer: context.answer,
|
|
108
|
+
threadId,
|
|
137
109
|
imageAltText: context.imageDescription
|
|
138
110
|
});
|
|
139
|
-
|
|
140
|
-
const messages = [messagesHelper.createAnswer(response, {
|
|
141
|
-
isInitial: thread?.history.length === 1
|
|
142
|
-
})];
|
|
111
|
+
let messages = [messagesHelper.createAnswer(response)];
|
|
143
112
|
if (response.endMessage) {
|
|
144
113
|
messages.push(messagesHelper.createLast(this.defaultMessages.endMessage));
|
|
145
114
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
115
|
+
if (isTranslated) {
|
|
116
|
+
messages = await this.translation.translateMessagesFx({
|
|
117
|
+
targetLanguage: context.translationTargetLanguage,
|
|
118
|
+
messages
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
this.messages.setField({
|
|
122
|
+
key,
|
|
123
|
+
fn: currentMessages => [...(currentMessages || []), ...messages]
|
|
124
|
+
});
|
|
125
|
+
this.threadIds.setField({
|
|
126
|
+
key,
|
|
127
|
+
data: response.threadId
|
|
150
128
|
});
|
|
151
129
|
})
|
|
152
130
|
});
|
|
@@ -158,35 +136,35 @@ export class ChatbotModel {
|
|
|
158
136
|
messages
|
|
159
137
|
}) => ({
|
|
160
138
|
key,
|
|
161
|
-
data:
|
|
162
|
-
messages: [...messages, this.defaultMessages.error]
|
|
163
|
-
}
|
|
139
|
+
data: [...messages, this.defaultMessages.error]
|
|
164
140
|
}),
|
|
165
141
|
filter: (_, {
|
|
166
142
|
error
|
|
167
143
|
}) => error.message !== 'Request aborted manually',
|
|
168
|
-
target: this.
|
|
144
|
+
target: this.messages.setField
|
|
169
145
|
});
|
|
170
146
|
return effect;
|
|
171
147
|
}
|
|
172
|
-
|
|
148
|
+
initChatReplyWatcher() {
|
|
173
149
|
sample({
|
|
174
|
-
|
|
175
|
-
|
|
150
|
+
clock: this.removeLastMessage,
|
|
151
|
+
source: [this.$lastMessageKey, this.messages.$state],
|
|
152
|
+
fn: ([lastMessageKey, messages]) => {
|
|
153
|
+
if (!lastMessageKey) return {
|
|
154
|
+
key: '',
|
|
155
|
+
data: []
|
|
156
|
+
};
|
|
157
|
+
const updatedMessages = [...messages[lastMessageKey]];
|
|
158
|
+
updatedMessages.pop();
|
|
159
|
+
return {
|
|
160
|
+
key: lastMessageKey,
|
|
161
|
+
data: updatedMessages
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
filter: ([lastMessageKey]) => !!lastMessageKey,
|
|
165
|
+
target: this.messages.setField
|
|
176
166
|
});
|
|
177
|
-
this.threadManager.bindKeyStore($store);
|
|
178
|
-
return this;
|
|
179
167
|
}
|
|
180
|
-
setUpT2S(config) {
|
|
181
|
-
this.t2s.setConfig(config);
|
|
182
|
-
return this;
|
|
183
|
-
}
|
|
184
|
-
setDrawBoardAdapter(adapter) {
|
|
185
|
-
this.threadManager.setDrawBoardAdapter(adapter);
|
|
186
|
-
this.errorSpotting.bindStrokesValidation(adapter.$strokesValidationKey);
|
|
187
|
-
return this;
|
|
188
|
-
}
|
|
189
|
-
sendHelpRequestFx = this.createSendHelpRequestFx();
|
|
190
168
|
startConversation = attach({
|
|
191
169
|
source: this.$currentChatData,
|
|
192
170
|
mapParams: (props, source) => ({
|
|
@@ -204,10 +182,13 @@ export class ChatbotModel {
|
|
|
204
182
|
key
|
|
205
183
|
});
|
|
206
184
|
}
|
|
207
|
-
this.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
185
|
+
this.messages.setField({
|
|
186
|
+
key,
|
|
187
|
+
data: [this.defaultMessages.start]
|
|
188
|
+
});
|
|
189
|
+
this.availableChats.setField({
|
|
190
|
+
key,
|
|
191
|
+
data: true
|
|
211
192
|
});
|
|
212
193
|
})
|
|
213
194
|
});
|
|
@@ -216,50 +197,48 @@ export class ChatbotModel {
|
|
|
216
197
|
...message
|
|
217
198
|
}) {
|
|
218
199
|
const options = this.$alternatives.getState()?.options.hints ?? message.options;
|
|
219
|
-
this.
|
|
220
|
-
|
|
221
|
-
|
|
200
|
+
this.messages.setField({
|
|
201
|
+
key,
|
|
202
|
+
fn: messages => {
|
|
203
|
+
if (!messages || messages.length > 1) return;
|
|
204
|
+
return [{
|
|
205
|
+
...message,
|
|
206
|
+
options
|
|
207
|
+
}];
|
|
208
|
+
}
|
|
222
209
|
});
|
|
223
210
|
}
|
|
224
|
-
reinitConversation = ({
|
|
211
|
+
reinitConversation = createEffect(({
|
|
225
212
|
key
|
|
226
213
|
}) => {
|
|
227
|
-
this.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
mapParams: (_, {
|
|
243
|
-
isLoading,
|
|
244
|
-
lastMessageKey
|
|
245
|
-
}) => !!(isLoading && lastMessageKey),
|
|
246
|
-
effect: createEffect(hasPendingMessage => {
|
|
247
|
-
if (hasPendingMessage) {
|
|
248
|
-
this.api.postMessageFx.controller.abort();
|
|
249
|
-
this.removeLastMessage();
|
|
214
|
+
this.messages.setField({
|
|
215
|
+
key,
|
|
216
|
+
fn: messages => {
|
|
217
|
+
if (!messages?.length || messages.length === 1) return;
|
|
218
|
+
const copy = [...messages];
|
|
219
|
+
while (copy.at(-1)?.endMessage) {
|
|
220
|
+
copy.pop();
|
|
221
|
+
}
|
|
222
|
+
const lastMessage = copy.at(-1);
|
|
223
|
+
if (!lastMessage) return;
|
|
224
|
+
copy.splice(copy.length - 1, 1, {
|
|
225
|
+
...lastMessage,
|
|
226
|
+
options: [this.defaultMessages.anotherHintOption]
|
|
227
|
+
});
|
|
228
|
+
return copy;
|
|
250
229
|
}
|
|
251
|
-
|
|
252
|
-
this.t2s.stop();
|
|
253
|
-
void this.t2s.reset();
|
|
254
|
-
this.translation.reset();
|
|
255
|
-
this.setScrollActive(false);
|
|
256
|
-
})
|
|
257
|
-
});
|
|
258
|
-
reset = withEvent(() => {
|
|
259
|
-
this.cache.reset();
|
|
260
|
-
this.resetAlternatives();
|
|
261
|
-
this.threadManager.reset();
|
|
262
|
-
this.errorSpotting.reset();
|
|
230
|
+
});
|
|
263
231
|
});
|
|
232
|
+
bindKey($store) {
|
|
233
|
+
sample({
|
|
234
|
+
source: $store,
|
|
235
|
+
target: this.$currentKey
|
|
236
|
+
});
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
setT2SAudioProvider(audioProvider) {
|
|
240
|
+
this.t2s.setAudioProvider(audioProvider);
|
|
241
|
+
return this;
|
|
242
|
+
}
|
|
264
243
|
}
|
|
265
244
|
//# sourceMappingURL=ChatBotModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["attach","combine","createEffect","createEvent","createStore","restore","sample","ChatbotAPI","ChatbotTranslation","ChatTextToSpeechModel","messagesHelper","ChatBotThreadManager","ChatsCacheModel","defaultChatData","ErrorSpottingModel","withEvent","ChatBotTextManager","ChatbotModel","textManager","defaultMessages","messages","threadManager","$currentKey","resetAlternatives","setAlternatives","setIsOpen","toggleOpen","$isOpen","on","isOpen","removeLastMessage","setLastMessageKey","$lastMessageKey","setContext","$context","setScrollActive","$isScrollActive","cache","$currentChatData","data","$data","key","constructor","api","$key","threadMessagesLimit","postMessage","setApi","getHint","requestHint","setMessagesLimit","$alternatives","getAlternativesFx","doneData","_","payload","reset","t2s","translation","alternativesModel","$store","set","chats","errorSpotting","$currentChatContext","bindKey","source","updates","filter","target","spottingHidden","clock","fn","lastMessageKey","chatsData","chat","updatedMessages","pop","update","createSendHelpRequestFx","effect","mapParams","params","context","message","translatedMessage","Error","addMessages","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"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/ChatBotModel.ts"],"mappings":";;AAAA,SACEA,MAAM,EACNC,OAAO,EACPC,YAAY,EACZC,WAAW,EACXC,WAAW,EACXC,OAAO,EACPC,MAAM,QAED,UAAU;AAYjB,SAASC,UAAU,QAAQ,iBAAc;AACzC,SAASC,kBAAkB,QAAQ,kBAAe;AAClD,SAASC,qBAAqB,QAAmB,UAAO;AACxD,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,oBAAo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,CAAC;MACf,KAAK,IAAI,CAAC/E,GAAG,CAACD,KAAK,CAAC,CAAC;MACrB,IAAI,CAACE,WAAW,CAACF,KAAK,CAAC,CAAC;MACxB,IAAI,CAACrB,eAAe,CAAC,KAAK,CAAC;IAC7B,CAAC;EACH,CAAC,CAAC;EAEcqB,KAAK,GAAGzC,SAAS,CAAC,MAAM;IACtC,IAAI,CAACsB,KAAK,CAACmB,KAAK,CAAC,CAAC;IAClB,IAAI,CAACjC,iBAAiB,CAAC,CAAC;IACxB,IAAI,CAACF,aAAa,CAACmC,KAAK,CAAC,CAAC;IAC1B,IAAI,CAACO,aAAa,CAACP,KAAK,CAAC,CAAC;EAC5B,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["attach","createEvent","restore","sample","createStore","createEffect","combine","createControllerEffect","createEntityFieldStore","ChatbotAPI","ChatbotTranslation","ChatTextToSpeechModel","messagesHelper","ChatbotModel","$currentKey","resetAlternatives","setAlternatives","setIsOpen","toggleOpen","$isOpen","on","isOpen","removeLastMessage","setLastMessageKey","$lastMessageKey","setContext","$context","setScrollActive","$isScrollActive","messages","threadIds","availableChats","$currentChatData","$state","key","threadId","isAvailable","constructor","api","$key","defaultMessages","source","target","$alternatives","getAlternativesFx","doneData","_","payload","reset","translation","messagesModel","alternativesModel","$store","set","t2s","sendHelpRequestFx","createSendHelpRequestFx","initChatReplyWatcher","effect","$isTranslated","mapParams","params","isTranslated","currentData","context","message","translatedMessage","Error","setField","fn","currentMessages","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","initOnly","length","reinitConversation","start","setHintMessage","options","getState","hints","copy","at","lastMessage","splice","anotherHintOption","bindKey","setT2SAudioProvider","audioProvider","setAudioProvider"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/ChatBotModel.ts"],"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QAAQ,EAAEqE,MAAM,IAAIrE,QAAQ,CAACqE,MAAM,KAAK,CAAC,EAAE;QAChD,MAAMO,IAAI,GAAG,CAAC,GAAG5E,QAAQ,CAAC;QAC1B,OAAO4E,IAAI,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAEzB,UAAU,EAAE;UAC9BwB,IAAI,CAACX,GAAG,CAAC,CAAC;QACZ;QAEA,MAAMa,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,CAAC9D,eAAe,CAACqE,iBAAiB;QAClD,CAAC,CAAC;QACF,OAAOJ,IAAI;MACb;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEKK,OAAOA,CAAC1D,MAAqB,EAAE;IACpCjD,MAAM,CAAC;MACLsC,MAAM,EAAEW,MAAM;MACdV,MAAM,EAAE,IAAI,CAAC5B;IACf,CAAC,CAAC;IACF,OAAO,IAAI;EACb;EAEOiG,mBAAmBA,CAACC,aAA4B,EAAE;IACvD,IAAI,CAAC1D,GAAG,CAAC2D,gBAAgB,CAACD,aAAa,CAAC;IACxC,OAAO,IAAI;EACb;AACF","ignoreList":[]}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { createEvent } from 'effector';
|
|
3
4
|
export class DefaultMessagesCreator {
|
|
5
|
+
languageChanged = createEvent();
|
|
4
6
|
list = new Map();
|
|
5
7
|
constructor({
|
|
6
8
|
textGetter
|
|
7
9
|
}) {
|
|
8
10
|
this.getter = textGetter;
|
|
11
|
+
this.languageChanged.watch(() => {
|
|
12
|
+
this.list.forEach((key, chatMessage) => {
|
|
13
|
+
if ('message' in chatMessage) {
|
|
14
|
+
chatMessage.message = this.getter(key);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
chatMessage.text = this.getter(key);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
9
20
|
}
|
|
10
21
|
createMessage(key, {
|
|
11
22
|
isOwn = false
|
|
@@ -13,6 +24,7 @@ export class DefaultMessagesCreator {
|
|
|
13
24
|
const message = {
|
|
14
25
|
id: this.list.size.toString(),
|
|
15
26
|
message: this.getter(key),
|
|
27
|
+
threadId: '',
|
|
16
28
|
options: [],
|
|
17
29
|
isOwnMessage: isOwn
|
|
18
30
|
};
|
|
@@ -27,17 +39,5 @@ export class DefaultMessagesCreator {
|
|
|
27
39
|
this.list.set(option, key);
|
|
28
40
|
return option;
|
|
29
41
|
}
|
|
30
|
-
bindToLanguageChanged(event) {
|
|
31
|
-
event.watch(() => {
|
|
32
|
-
this.list.forEach((key, chatMessage) => {
|
|
33
|
-
if ('message' in chatMessage) {
|
|
34
|
-
chatMessage.message = this.getter(key);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
chatMessage.text = this.getter(key);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
return this;
|
|
41
|
-
}
|
|
42
42
|
}
|
|
43
43
|
//# sourceMappingURL=DefaultMessageCreator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DefaultMessagesCreator","list","Map","constructor","textGetter","getter","
|
|
1
|
+
{"version":3,"names":["createEvent","DefaultMessagesCreator","languageChanged","list","Map","constructor","textGetter","getter","watch","forEach","key","chatMessage","message","text","createMessage","isOwn","id","size","toString","threadId","options","isOwnMessage","set","createOption","option","promptKey"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/DefaultMessageCreator.ts"],"mappings":";;AACA,SAASA,WAAW,QAAQ,UAAU;AAetC,OAAO,MAAMC,sBAAsB,CAAmB;EACpCC,eAAe,GAAGF,WAAW,CAAC,CAAC;EAE9BG,IAAI,GAAG,IAAIC,GAAG,CAA8B,CAAC;EAG9DC,WAAWA,CAAC;IAAEC;EAA0C,CAAC,EAAE;IACzD,IAAI,CAACC,MAAM,GAAGD,UAAU;IAExB,IAAI,CAACJ,eAAe,CAACM,KAAK,CAAC,MAAM;MAC/B,IAAI,CAACL,IAAI,CAACM,OAAO,CAAC,CAACC,GAAG,EAAEC,WAAW,KAAK;QACtC,IAAI,SAAS,IAAIA,WAAW,EAAE;UAC5BA,WAAW,CAACC,OAAO,GAAG,IAAI,CAACL,MAAM,CAACG,GAAG,CAAC;UACtC;QACF;QACAC,WAAW,CAACE,IAAI,GAAG,IAAI,CAACN,MAAM,CAACG,GAAG,CAAC;MACrC,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEOI,aAAaA,CAACJ,GAAM,EAAE;IAAEK,KAAK,GAAG;EAA8B,CAAC,GAAG,CAAC,CAAC,EAAE;IAC3E,MAAMH,OAAoB,GAAG;MAC3BI,EAAE,EAAE,IAAI,CAACb,IAAI,CAACc,IAAI,CAACC,QAAQ,CAAC,CAAC;MAC7BN,OAAO,EAAE,IAAI,CAACL,MAAM,CAACG,GAAG,CAAC;MACzBS,QAAQ,EAAE,EAAE;MACZC,OAAO,EAAE,EAAE;MACXC,YAAY,EAAEN;IAChB,CAAC;IACD,IAAI,CAACZ,IAAI,CAACmB,GAAG,CAACV,OAAO,EAAEF,GAAG,CAAC;IAC3B,OAAOE,OAAO;EAChB;EAEOW,YAAYA,CAACb,GAAM,EAAE;IAC1B,MAAMc,MAAkB,GAAG;MACzBX,IAAI,EAAE,IAAI,CAACN,MAAM,CAACG,GAAG,CAAC;MACtBe,SAAS,EAAE;IACb,CAAC;IACD,IAAI,CAACtB,IAAI,CAACmB,GAAG,CAACE,MAAM,EAAEd,GAAG,CAAC;IAC1B,OAAOc,MAAM;EACf;AACF","ignoreList":[]}
|
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { generateRandomId } from "../../../lib/helpers/helpers.js";
|
|
4
3
|
export class ThreadItem {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.strokes =
|
|
10
|
-
this.strokesValidationKey = props?.key ?? null;
|
|
4
|
+
hints = [];
|
|
5
|
+
constructor({
|
|
6
|
+
strokes
|
|
7
|
+
} = {}) {
|
|
8
|
+
this.strokes = strokes ?? null;
|
|
11
9
|
}
|
|
12
10
|
getNextHintProps() {
|
|
13
|
-
if (this.
|
|
11
|
+
if (this.hints.length) {
|
|
14
12
|
return {
|
|
15
|
-
previousHint: this.
|
|
13
|
+
previousHint: this.hints[this.hints.length - 1]
|
|
16
14
|
};
|
|
17
15
|
}
|
|
18
16
|
if (this.strokes) {
|
|
19
17
|
return {
|
|
20
|
-
stroke: this.strokes
|
|
21
|
-
x,
|
|
22
|
-
y
|
|
23
|
-
}) => ({
|
|
24
|
-
x,
|
|
25
|
-
y
|
|
26
|
-
}))
|
|
18
|
+
stroke: this.strokes
|
|
27
19
|
};
|
|
28
20
|
}
|
|
29
21
|
return {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ThreadItem","hints","constructor","strokes","getNextHintProps","length","previousHint","stroke"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/ThreadItem.ts"],"mappings":";;AAMA,OAAO,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","ignoreList":[]}
|