@magmamath/students-features 0.10.0 → 0.11.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/features/celebrations/helpers.js +4 -1
- package/dist/commonjs/features/celebrations/helpers.js.map +1 -1
- package/dist/commonjs/features/chatbot/TTS_HIGHLIGHTING.md +120 -0
- package/dist/commonjs/features/chatbot/components/Chat/Chat.js +66 -30
- package/dist/commonjs/features/chatbot/components/Chat/Chat.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chat/CloseButton.js +61 -0
- package/dist/commonjs/features/chatbot/components/Chat/CloseButton.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +44 -54
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js +3 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/FreeText/ChatTextInput.js +2 -2
- package/dist/commonjs/features/chatbot/components/ChatInput/FreeText/ChatTextInput.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/FreeText/SendMessageButton.js +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageContent.js +16 -4
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageContent.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +12 -20
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +13 -8
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/SentMessage.js +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +29 -7
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/constants.js +2 -1
- package/dist/commonjs/features/chatbot/constants.js.map +1 -1
- package/dist/commonjs/features/chatbot/helpers/ttsHighlight.js +29 -0
- package/dist/commonjs/features/chatbot/helpers/ttsHighlight.js.map +1 -0
- package/dist/commonjs/features/chatbot/helpers.js +19 -2
- package/dist/commonjs/features/chatbot/helpers.js.map +1 -1
- package/dist/commonjs/features/chatbot/index.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +59 -17
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js +2 -2
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatTTSHighlightModel.js +56 -0
- package/dist/commonjs/features/chatbot/model/ChatTTSHighlightModel.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/ChatTTSModel.js +154 -0
- package/dist/commonjs/features/chatbot/model/ChatTTSModel.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/ChatbotApi.js +1 -1
- package/dist/commonjs/features/chatbot/model/ChatbotApi.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js +9 -0
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/t2s.types.js.map +1 -1
- package/dist/commonjs/features/feedback/model/model.js.map +1 -1
- package/dist/commonjs/features/feedback/model/sockets.js +8 -5
- package/dist/commonjs/features/feedback/model/sockets.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.js +2 -2
- package/dist/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/BasicLayout.js +2 -2
- package/dist/commonjs/features/keyboard/components/BasicLayout/BasicLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicPlusLayout/keyboardGroups.js +4 -4
- package/dist/commonjs/features/keyboard/components/BasicPlusLayout/keyboardGroups.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.js +2 -2
- package/dist/commonjs/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.js +4 -4
- package/dist/commonjs/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/Keyboard.js +4 -2
- package/dist/commonjs/features/keyboard/components/Keyboard.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/MainLayout/MainLayout.js +1 -6
- package/dist/commonjs/features/keyboard/components/MainLayout/MainLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/UnitTabs.js +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/helpers.js +3 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/helpers.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.js +27 -6
- package/dist/commonjs/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/keyboardGroups.js +9 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/keyboardGroups.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/types.js +1 -0
- package/dist/commonjs/features/keyboard/components/UnitsLayout/types.js.map +1 -1
- package/dist/commonjs/features/keyboard/constants/constants.js +1 -1
- package/dist/commonjs/features/keyboard/constants/keyboardGroupsByLocale.js +2 -1
- package/dist/commonjs/features/keyboard/constants/keyboardGroupsByLocale.js.map +1 -1
- package/dist/commonjs/features/keyboard/constants/keyboardLayouts.js +20 -4
- package/dist/commonjs/features/keyboard/constants/keyboardLayouts.js.map +1 -1
- package/dist/commonjs/features/keyboard/helpers.js +7 -0
- package/dist/commonjs/features/keyboard/helpers.js.map +1 -1
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/basicOperators.js +20 -3
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/basicOperators.js.map +1 -1
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/units.js +6 -3
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/units.js.map +1 -1
- package/dist/commonjs/features/openEnded/components/OpenEndedAttemptsLimit.js +34 -0
- package/dist/commonjs/features/openEnded/components/OpenEndedAttemptsLimit.js.map +1 -0
- package/dist/commonjs/features/openEnded/components/OpenEndedScoreLabel.js +77 -0
- package/dist/commonjs/features/openEnded/components/OpenEndedScoreLabel.js.map +1 -0
- package/dist/commonjs/features/openEnded/index.js +48 -0
- package/dist/commonjs/features/openEnded/index.js.map +1 -0
- package/dist/commonjs/features/openEnded/oe.helpers.js +26 -0
- package/dist/commonjs/features/openEnded/oe.helpers.js.map +1 -0
- package/dist/commonjs/features/openEnded/oe.types.js +14 -0
- package/dist/commonjs/features/openEnded/oe.types.js.map +1 -0
- package/dist/commonjs/index.js +13 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/lib/components/ConditionalWrapper.js +23 -0
- package/dist/commonjs/lib/components/ConditionalWrapper.js.map +1 -0
- package/dist/commonjs/shared/common.constants.js +9 -0
- package/dist/commonjs/shared/common.constants.js.map +1 -0
- package/dist/commonjs/shared/icons/TimeIcon.js +37 -0
- package/dist/commonjs/shared/icons/TimeIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/keyboard/CDotIcon/CDotIcon.js +4 -4
- package/dist/commonjs/shared/icons/keyboard/CDotIcon/CDotIcon.js.map +1 -1
- package/dist/commonjs/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.js +32 -0
- package/dist/commonjs/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.js +32 -0
- package/dist/commonjs/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.js.map +1 -0
- package/dist/commonjs/shared/translation/localization/ca.json +2 -1
- package/dist/commonjs/shared/translation/localization/de.json +2 -1
- package/dist/commonjs/shared/translation/localization/en.json +2 -1
- package/dist/commonjs/shared/translation/localization/gb.json +2 -1
- package/dist/commonjs/shared/translation/localization/sct.json +2 -1
- package/dist/commonjs/shared/translation/localization/sw.json +2 -1
- package/dist/commonjs/types/common.types.js +4 -0
- package/dist/module/features/celebrations/helpers.js +4 -1
- package/dist/module/features/celebrations/helpers.js.map +1 -1
- package/dist/module/features/chatbot/TTS_HIGHLIGHTING.md +120 -0
- package/dist/module/features/chatbot/components/Chat/Chat.js +66 -30
- package/dist/module/features/chatbot/components/Chat/Chat.js.map +1 -1
- package/dist/module/features/chatbot/components/Chat/CloseButton.js +55 -0
- package/dist/module/features/chatbot/components/Chat/CloseButton.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +44 -55
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js +3 -1
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatInput/FreeText/ChatTextInput.js +2 -2
- package/dist/module/features/chatbot/components/ChatInput/FreeText/ChatTextInput.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatInput/FreeText/SendMessageButton.js +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageContent.js +16 -4
- package/dist/module/features/chatbot/components/ChatMessage/MessageContent.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +12 -20
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +13 -8
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/SentMessage.js +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +27 -6
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/constants.js +1 -0
- package/dist/module/features/chatbot/constants.js.map +1 -1
- package/dist/module/features/chatbot/helpers/ttsHighlight.js +23 -0
- package/dist/module/features/chatbot/helpers/ttsHighlight.js.map +1 -0
- package/dist/module/features/chatbot/helpers.js +19 -2
- package/dist/module/features/chatbot/helpers.js.map +1 -1
- package/dist/module/features/chatbot/index.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotModel.js +59 -17
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js +2 -2
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatTTSHighlightModel.js +52 -0
- package/dist/module/features/chatbot/model/ChatTTSHighlightModel.js.map +1 -0
- package/dist/module/features/chatbot/model/ChatTTSModel.js +149 -0
- package/dist/module/features/chatbot/model/ChatTTSModel.js.map +1 -0
- package/dist/module/features/chatbot/model/ChatbotApi.js +1 -1
- package/dist/module/features/chatbot/model/ChatbotApi.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatsCacheModel.js +9 -0
- package/dist/module/features/chatbot/model/ChatsCacheModel.js.map +1 -1
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/features/chatbot/types/t2s.types.js.map +1 -1
- package/dist/module/features/feedback/model/model.js.map +1 -1
- package/dist/module/features/feedback/model/sockets.js +8 -5
- package/dist/module/features/feedback/model/sockets.js.map +1 -1
- package/dist/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.js +3 -3
- package/dist/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicLayout/BasicLayout.js +2 -2
- package/dist/module/features/keyboard/components/BasicLayout/BasicLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicPlusLayout/keyboardGroups.js +4 -4
- package/dist/module/features/keyboard/components/BasicPlusLayout/keyboardGroups.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.js +2 -2
- package/dist/module/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.js +4 -4
- package/dist/module/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.js.map +1 -1
- package/dist/module/features/keyboard/components/Keyboard.js +4 -2
- package/dist/module/features/keyboard/components/Keyboard.js.map +1 -1
- package/dist/module/features/keyboard/components/KeysList/KeysList.js.map +1 -1
- package/dist/module/features/keyboard/components/MainLayout/MainLayout.js +2 -7
- package/dist/module/features/keyboard/components/MainLayout/MainLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/UnitTabs.js +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/helpers.js +2 -1
- package/dist/module/features/keyboard/components/UnitsLayout/helpers.js.map +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.js +27 -6
- package/dist/module/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.js.map +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/keyboardGroups.js +9 -1
- package/dist/module/features/keyboard/components/UnitsLayout/keyboardGroups.js.map +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/types.js +1 -0
- package/dist/module/features/keyboard/components/UnitsLayout/types.js.map +1 -1
- package/dist/module/features/keyboard/constants/constants.js +1 -1
- package/dist/module/features/keyboard/constants/keyboardGroupsByLocale.js +3 -2
- package/dist/module/features/keyboard/constants/keyboardGroupsByLocale.js.map +1 -1
- package/dist/module/features/keyboard/constants/keyboardLayouts.js +19 -4
- package/dist/module/features/keyboard/constants/keyboardLayouts.js.map +1 -1
- package/dist/module/features/keyboard/helpers.js +5 -0
- package/dist/module/features/keyboard/helpers.js.map +1 -1
- package/dist/module/features/keyboard/types/MathKeysGroups/basicOperators.js +20 -3
- package/dist/module/features/keyboard/types/MathKeysGroups/basicOperators.js.map +1 -1
- package/dist/module/features/keyboard/types/MathKeysGroups/units.js +6 -3
- package/dist/module/features/keyboard/types/MathKeysGroups/units.js.map +1 -1
- package/dist/module/features/openEnded/components/OpenEndedAttemptsLimit.js +28 -0
- package/dist/module/features/openEnded/components/OpenEndedAttemptsLimit.js.map +1 -0
- package/dist/module/features/openEnded/components/OpenEndedScoreLabel.js +71 -0
- package/dist/module/features/openEnded/components/OpenEndedScoreLabel.js.map +1 -0
- package/dist/module/features/openEnded/index.js +7 -0
- package/dist/module/features/openEnded/index.js.map +1 -0
- package/dist/module/features/openEnded/oe.helpers.js +21 -0
- package/dist/module/features/openEnded/oe.helpers.js.map +1 -0
- package/dist/module/features/openEnded/oe.types.js +10 -0
- package/dist/module/features/openEnded/oe.types.js.map +1 -0
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/components/ConditionalWrapper.js +17 -0
- package/dist/module/lib/components/ConditionalWrapper.js.map +1 -0
- package/dist/module/shared/common.constants.js +5 -0
- package/dist/module/shared/common.constants.js.map +1 -0
- package/dist/module/shared/icons/TimeIcon.js +29 -0
- package/dist/module/shared/icons/TimeIcon.js.map +1 -0
- package/dist/module/shared/icons/keyboard/CDotIcon/CDotIcon.js +4 -4
- package/dist/module/shared/icons/keyboard/CDotIcon/CDotIcon.js.map +1 -1
- package/dist/module/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.js +24 -0
- package/dist/module/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.js.map +1 -0
- package/dist/module/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.js +24 -0
- package/dist/module/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.js.map +1 -0
- package/dist/module/shared/translation/localization/ca.json +2 -1
- package/dist/module/shared/translation/localization/de.json +2 -1
- package/dist/module/shared/translation/localization/en.json +2 -1
- package/dist/module/shared/translation/localization/gb.json +2 -1
- package/dist/module/shared/translation/localization/sct.json +2 -1
- package/dist/module/shared/translation/localization/sw.json +2 -1
- package/dist/module/types/common.types.js +2 -0
- package/dist/typescript/commonjs/features/celebrations/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts +7 -2
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chat/CloseButton.d.ts +7 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/CloseButton.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts +3 -2
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts +3 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageContent.d.ts +4 -2
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageContent.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts +1 -6
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.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/Chatbot.d.ts +4 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/helpers/ttsHighlight.d.ts +8 -0
- package/dist/typescript/commonjs/features/chatbot/helpers/ttsHighlight.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +3 -2
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +6 -3
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts +4 -3
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatTTSHighlightModel.d.ts +25 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatTTSHighlightModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatTTSModel.d.ts +38 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatTTSModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +28 -16
- 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 +14 -11
- 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 +25 -0
- package/dist/typescript/commonjs/features/chatbot/types/t2s.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/model/model.d.ts +4 -1
- package/dist/typescript/commonjs/features/feedback/model/model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/model/sockets.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicPlusLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/Keyboard.d.ts +2 -1
- package/dist/typescript/commonjs/features/keyboard/components/Keyboard.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/MainLayout/MainLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/helpers.d.ts +1 -0
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.d.ts +4 -7
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/keyboardGroups.d.ts +1 -0
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/types.d.ts +7 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/constants/constants.d.ts +1 -1
- package/dist/typescript/commonjs/features/keyboard/constants/keyboardGroupsByLocale.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/constants/keyboardLayouts.d.ts +4 -0
- package/dist/typescript/commonjs/features/keyboard/constants/keyboardLayouts.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/helpers.d.ts +1 -0
- package/dist/typescript/commonjs/features/keyboard/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/types/MathKeysGroups/basicOperators.d.ts +10 -0
- package/dist/typescript/commonjs/features/keyboard/types/MathKeysGroups/basicOperators.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/types/MathKeysGroups/units.d.ts +36 -0
- package/dist/typescript/commonjs/features/keyboard/types/MathKeysGroups/units.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/openEnded/components/OpenEndedAttemptsLimit.d.ts +7 -0
- package/dist/typescript/commonjs/features/openEnded/components/OpenEndedAttemptsLimit.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/openEnded/components/OpenEndedScoreLabel.d.ts +12 -0
- package/dist/typescript/commonjs/features/openEnded/components/OpenEndedScoreLabel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/openEnded/index.d.ts +5 -0
- package/dist/typescript/commonjs/features/openEnded/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/openEnded/oe.helpers.d.ts +13 -0
- package/dist/typescript/commonjs/features/openEnded/oe.helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/openEnded/oe.types.d.ts +7 -0
- package/dist/typescript/commonjs/features/openEnded/oe.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/index.d.ts +1 -0
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/components/ConditionalWrapper.d.ts +9 -0
- package/dist/typescript/commonjs/lib/components/ConditionalWrapper.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/effector/createControllerEffect.d.ts +1 -1
- package/dist/typescript/commonjs/lib/effector/createControllerEffect.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/common.constants.d.ts +2 -0
- package/dist/typescript/commonjs/shared/common.constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/TimeIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/TimeIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +6 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +2 -0
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/commonjs/types/common.types.d.ts +2 -0
- package/dist/typescript/commonjs/types/common.types.d.ts.map +1 -1
- package/dist/typescript/module/features/celebrations/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts +7 -2
- package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chat/CloseButton.d.ts +7 -0
- package/dist/typescript/module/features/chatbot/components/Chat/CloseButton.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts +3 -2
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts +3 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageContent.d.ts +4 -2
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageContent.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts +1 -6
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.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/Chatbot.d.ts +4 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/constants.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/helpers/ttsHighlight.d.ts +8 -0
- package/dist/typescript/module/features/chatbot/helpers/ttsHighlight.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/index.d.ts +3 -2
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +6 -3
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts +4 -3
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatTTSHighlightModel.d.ts +25 -0
- package/dist/typescript/module/features/chatbot/model/ChatTTSHighlightModel.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatTTSModel.d.ts +38 -0
- package/dist/typescript/module/features/chatbot/model/ChatTTSModel.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +28 -16
- 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 +14 -11
- 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 +25 -0
- package/dist/typescript/module/features/chatbot/types/t2s.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/model/model.d.ts +4 -1
- package/dist/typescript/module/features/feedback/model/model.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/model/sockets.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicPlusLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/Keyboard.d.ts +2 -1
- package/dist/typescript/module/features/keyboard/components/Keyboard.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/MainLayout/MainLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/helpers.d.ts +1 -0
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.d.ts +4 -7
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/keyboardGroups.d.ts +1 -0
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/types.d.ts +7 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/types.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/constants/constants.d.ts +1 -1
- package/dist/typescript/module/features/keyboard/constants/keyboardGroupsByLocale.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/constants/keyboardLayouts.d.ts +4 -0
- package/dist/typescript/module/features/keyboard/constants/keyboardLayouts.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/helpers.d.ts +1 -0
- package/dist/typescript/module/features/keyboard/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/types/MathKeysGroups/basicOperators.d.ts +10 -0
- package/dist/typescript/module/features/keyboard/types/MathKeysGroups/basicOperators.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/types/MathKeysGroups/units.d.ts +36 -0
- package/dist/typescript/module/features/keyboard/types/MathKeysGroups/units.d.ts.map +1 -1
- package/dist/typescript/module/features/openEnded/components/OpenEndedAttemptsLimit.d.ts +7 -0
- package/dist/typescript/module/features/openEnded/components/OpenEndedAttemptsLimit.d.ts.map +1 -0
- package/dist/typescript/module/features/openEnded/components/OpenEndedScoreLabel.d.ts +12 -0
- package/dist/typescript/module/features/openEnded/components/OpenEndedScoreLabel.d.ts.map +1 -0
- package/dist/typescript/module/features/openEnded/index.d.ts +5 -0
- package/dist/typescript/module/features/openEnded/index.d.ts.map +1 -0
- package/dist/typescript/module/features/openEnded/oe.helpers.d.ts +13 -0
- package/dist/typescript/module/features/openEnded/oe.helpers.d.ts.map +1 -0
- package/dist/typescript/module/features/openEnded/oe.types.d.ts +7 -0
- package/dist/typescript/module/features/openEnded/oe.types.d.ts.map +1 -0
- package/dist/typescript/module/index.d.ts +1 -0
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/dist/typescript/module/lib/components/ConditionalWrapper.d.ts +9 -0
- package/dist/typescript/module/lib/components/ConditionalWrapper.d.ts.map +1 -0
- package/dist/typescript/module/lib/effector/createControllerEffect.d.ts +1 -1
- package/dist/typescript/module/lib/effector/createControllerEffect.d.ts.map +1 -1
- package/dist/typescript/module/shared/common.constants.d.ts +2 -0
- package/dist/typescript/module/shared/common.constants.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/TimeIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/TimeIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/constants.d.ts +6 -0
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +2 -0
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/module/types/common.types.d.ts +2 -0
- package/dist/typescript/module/types/common.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/celebrations/helpers.ts +35 -33
- package/src/features/chatbot/TTS_HIGHLIGHTING.md +120 -0
- package/src/features/chatbot/components/Chat/Chat.tsx +76 -33
- package/src/features/chatbot/components/Chat/CloseButton.tsx +60 -0
- package/src/features/chatbot/components/ChatControls/ChatControls.tsx +45 -60
- package/src/features/chatbot/components/ChatInput/ChatInput.tsx +3 -1
- package/src/features/chatbot/components/ChatInput/FreeText/ChatTextInput.tsx +2 -2
- package/src/features/chatbot/components/ChatInput/FreeText/SendMessageButton.tsx +1 -1
- package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +3 -1
- package/src/features/chatbot/components/ChatMessage/MessageContent.tsx +25 -3
- package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +9 -21
- package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +11 -6
- package/src/features/chatbot/components/ChatMessage/SentMessage.tsx +1 -1
- package/src/features/chatbot/components/Chatbot.tsx +28 -3
- package/src/features/chatbot/constants.ts +2 -0
- package/src/features/chatbot/helpers/ttsHighlight.ts +25 -0
- package/src/features/chatbot/helpers.ts +14 -1
- package/src/features/chatbot/index.ts +17 -2
- package/src/features/chatbot/model/ChatBotModel.ts +67 -16
- package/src/features/chatbot/model/ChatBotThreadManager.ts +12 -4
- package/src/features/chatbot/model/ChatTTSHighlightModel.ts +64 -0
- package/src/features/chatbot/model/ChatTTSModel.ts +168 -0
- package/src/features/chatbot/model/ChatbotApi.ts +1 -1
- package/src/features/chatbot/model/ChatsCacheModel.ts +11 -0
- package/src/features/chatbot/types/api.types.ts +25 -19
- package/src/features/chatbot/types/model.types.ts +23 -12
- package/src/features/chatbot/types/t2s.types.ts +33 -0
- package/src/features/chatbot/types/units.types.ts +1 -0
- package/src/features/feedback/model/model.ts +4 -1
- package/src/features/feedback/model/sockets.ts +8 -6
- package/src/features/keyboard/components/AlgebraLayout/AlgebraLayout.tsx +4 -3
- package/src/features/keyboard/components/BasicLayout/BasicLayout.tsx +2 -2
- package/src/features/keyboard/components/BasicPlusLayout/keyboardGroups.ts +27 -17
- package/src/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.tsx +3 -2
- package/src/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.ts +30 -24
- package/src/features/keyboard/components/Keyboard.tsx +14 -4
- package/src/features/keyboard/components/KeysList/KeysList.tsx +1 -1
- package/src/features/keyboard/components/MainLayout/MainLayout.tsx +2 -6
- package/src/features/keyboard/components/UnitsLayout/UnitTabs.tsx +1 -1
- package/src/features/keyboard/components/UnitsLayout/helpers.tsx +3 -0
- package/src/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.ts +36 -22
- package/src/features/keyboard/components/UnitsLayout/keyboardGroups.ts +11 -0
- package/src/features/keyboard/components/UnitsLayout/types.ts +7 -0
- package/src/features/keyboard/constants/constants.ts +1 -1
- package/src/features/keyboard/constants/keyboardGroupsByLocale.ts +2 -0
- package/src/features/keyboard/constants/keyboardLayouts.ts +18 -1
- package/src/features/keyboard/helpers.ts +6 -0
- package/src/features/keyboard/types/MathKeysGroups/basicOperators.tsx +15 -3
- package/src/features/keyboard/types/MathKeysGroups/units.tsx +3 -0
- package/src/features/openEnded/components/OpenEndedAttemptsLimit.tsx +26 -0
- package/src/features/openEnded/components/OpenEndedScoreLabel.tsx +81 -0
- package/src/features/openEnded/index.ts +4 -0
- package/src/features/openEnded/oe.helpers.ts +31 -0
- package/src/features/openEnded/oe.types.ts +6 -0
- package/src/index.ts +1 -0
- package/src/lib/components/ConditionalWrapper.tsx +15 -0
- package/src/lib/effector/createControllerEffect.ts +1 -1
- package/src/shared/common.constants.ts +3 -0
- package/src/shared/icons/TimeIcon.tsx +23 -0
- package/src/shared/icons/keyboard/CDotIcon/CDotIcon.tsx +2 -2
- package/src/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.tsx +18 -0
- package/src/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.tsx +18 -0
- package/src/shared/translation/localization/ca.json +2 -1
- package/src/shared/translation/localization/de.json +2 -1
- package/src/shared/translation/localization/en.json +2 -1
- package/src/shared/translation/localization/gb.json +2 -1
- package/src/shared/translation/localization/sct.json +2 -1
- package/src/shared/translation/localization/sw.json +2 -1
- package/src/types/common.types.ts +4 -0
- package/dist/commonjs/features/chatbot/model/t2s.js +0 -107
- package/dist/commonjs/features/chatbot/model/t2s.js.map +0 -1
- package/dist/module/features/chatbot/model/t2s.js +0 -102
- package/dist/module/features/chatbot/model/t2s.js.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts +0 -34
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts +0 -34
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts.map +0 -1
- package/src/features/chatbot/model/t2s.ts +0 -123
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
restore,
|
|
8
8
|
sample,
|
|
9
9
|
type Store,
|
|
10
|
-
StoreWritable
|
|
10
|
+
StoreWritable,
|
|
11
11
|
} from 'effector'
|
|
12
12
|
import {
|
|
13
13
|
ChatbotContext,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import { GetAlternativesResponse } from '../types/api.types'
|
|
24
24
|
import { ChatbotAPI } from './ChatbotApi'
|
|
25
25
|
import { ChatbotTranslation } from './ChatbotTranslation'
|
|
26
|
-
import {
|
|
26
|
+
import { ChatTTSModel } from './ChatTTSModel'
|
|
27
27
|
import { messagesHelper } from './messagesHelper'
|
|
28
28
|
import { ChatBotThreadManager } from './ChatBotThreadManager'
|
|
29
29
|
import { ChatsCacheModel, defaultChatData } from './ChatsCacheModel'
|
|
@@ -34,6 +34,7 @@ import { ChatBotTextManager } from './ChatBoxTextManager'
|
|
|
34
34
|
import { ControlledSample } from '../../../lib/effector/ControlledSample'
|
|
35
35
|
import { transformAlternatives } from '../helpers'
|
|
36
36
|
import { IS_WEB } from '@magmamath/react-native-ui'
|
|
37
|
+
import { T2SConfig } from '../types/t2s.types'
|
|
37
38
|
|
|
38
39
|
export class ChatbotModel {
|
|
39
40
|
public readonly textManager = new ChatBotTextManager()
|
|
@@ -45,7 +46,7 @@ export class ChatbotModel {
|
|
|
45
46
|
public readonly api: ChatbotAPI
|
|
46
47
|
|
|
47
48
|
public readonly translation: ChatbotTranslation
|
|
48
|
-
public readonly t2s:
|
|
49
|
+
public readonly t2s: ChatTTSModel
|
|
49
50
|
public readonly errorSpotting: ErrorSpottingModel
|
|
50
51
|
public readonly textInput = new ChatBotTextInput()
|
|
51
52
|
|
|
@@ -57,7 +58,7 @@ export class ChatbotModel {
|
|
|
57
58
|
|
|
58
59
|
readonly resetAlternatives = createEvent()
|
|
59
60
|
readonly setAlternatives = createEvent<GetAlternativesResponse | null>()
|
|
60
|
-
readonly $alternatives
|
|
61
|
+
readonly $alternatives = createStore<GetAlternativesResponse | null>(null)
|
|
61
62
|
|
|
62
63
|
readonly setIsOpen = createEvent<boolean>()
|
|
63
64
|
readonly toggleOpen = createEvent()
|
|
@@ -86,18 +87,18 @@ export class ChatbotModel {
|
|
|
86
87
|
this.api = new ChatbotAPI({ ...api, postMessage: this.threadManager.postMessage })
|
|
87
88
|
|
|
88
89
|
this.$chatAccess = chatAccess
|
|
90
|
+
if ($key) this.bindKey($key)
|
|
89
91
|
|
|
90
92
|
this.threadManager.setApi({ getHint: api.requestHint, sendMessage: api.sendMessage })
|
|
91
93
|
if (threadMessagesLimit) {
|
|
92
94
|
this.threadManager.setMessagesLimit(threadMessagesLimit)
|
|
93
95
|
}
|
|
94
96
|
|
|
95
|
-
this.$alternatives
|
|
97
|
+
this.$alternatives
|
|
96
98
|
.on(this.api.getAlternativesFx.doneData, (_, payload) => transformAlternatives(payload))
|
|
97
99
|
.on(this.setAlternatives, (_, payload) => transformAlternatives(payload))
|
|
98
100
|
.reset(this.resetAlternatives)
|
|
99
101
|
|
|
100
|
-
this.t2s = new ChatTextToSpeechModel({ api: this.api })
|
|
101
102
|
this.translation = new ChatbotTranslation({
|
|
102
103
|
$context: this.$context,
|
|
103
104
|
defaultMessages: this.defaultMessages,
|
|
@@ -110,11 +111,15 @@ export class ChatbotModel {
|
|
|
110
111
|
chats: this.cache,
|
|
111
112
|
})
|
|
112
113
|
|
|
113
|
-
this.
|
|
114
|
+
this.t2s = new ChatTTSModel({
|
|
115
|
+
api: this.api,
|
|
114
116
|
$currentChatData: this.$currentChatData,
|
|
117
|
+
$isTranslated: this.translation.$isTranslated,
|
|
115
118
|
})
|
|
116
119
|
|
|
117
|
-
|
|
120
|
+
this.errorSpotting = new ErrorSpottingModel({
|
|
121
|
+
$currentChatData: this.$currentChatData,
|
|
122
|
+
})
|
|
118
123
|
|
|
119
124
|
sample({
|
|
120
125
|
source: this.$isOpen.updates,
|
|
@@ -122,6 +127,14 @@ export class ChatbotModel {
|
|
|
122
127
|
target: [this.t2s.reset, this.errorSpotting.spottingHidden],
|
|
123
128
|
})
|
|
124
129
|
|
|
130
|
+
sample({
|
|
131
|
+
clock: this.setIsOpen,
|
|
132
|
+
source: this.$currentChatData,
|
|
133
|
+
filter: ({ hasBeenOpened }, isOpen) => isOpen && !hasBeenOpened,
|
|
134
|
+
fn: ({ key }) => ({ key, data: { hasBeenOpened: true } }),
|
|
135
|
+
target: this.cache.update,
|
|
136
|
+
})
|
|
137
|
+
|
|
125
138
|
sample({
|
|
126
139
|
clock: this.removeLastMessage,
|
|
127
140
|
source: [this.$lastMessageKey, this.cache.$data] as const,
|
|
@@ -156,7 +169,12 @@ export class ChatbotModel {
|
|
|
156
169
|
...source,
|
|
157
170
|
}),
|
|
158
171
|
effect: createEffect(
|
|
159
|
-
({
|
|
172
|
+
({
|
|
173
|
+
currentChatData,
|
|
174
|
+
initOnly,
|
|
175
|
+
chatAccess,
|
|
176
|
+
withGreetingMessage = true,
|
|
177
|
+
}: StartConversationFxData) => {
|
|
160
178
|
const { key, messages } = currentChatData
|
|
161
179
|
|
|
162
180
|
if (!chatAccess) return
|
|
@@ -166,7 +184,7 @@ export class ChatbotModel {
|
|
|
166
184
|
return this.reinitConversation({ key })
|
|
167
185
|
}
|
|
168
186
|
this.cache.add(key, {
|
|
169
|
-
messages: [this.defaultMessages.start],
|
|
187
|
+
messages: withGreetingMessage ? [this.defaultMessages.start] : [],
|
|
170
188
|
isAvailable: true,
|
|
171
189
|
currentThread: null,
|
|
172
190
|
})
|
|
@@ -186,29 +204,58 @@ export class ChatbotModel {
|
|
|
186
204
|
|
|
187
205
|
private createSendHelpRequestFx() {
|
|
188
206
|
const effect = attach({
|
|
189
|
-
source: {
|
|
207
|
+
source: {
|
|
208
|
+
key: this.$currentKey,
|
|
209
|
+
context: this.$context,
|
|
210
|
+
cache: this.cache.$data,
|
|
211
|
+
alternatives: this.$alternatives,
|
|
212
|
+
},
|
|
190
213
|
mapParams: (params: SendHelpParams, source) => ({
|
|
191
214
|
...params,
|
|
192
215
|
...source,
|
|
193
216
|
}),
|
|
194
217
|
effect: createEffect(
|
|
195
|
-
async ({
|
|
218
|
+
async ({
|
|
219
|
+
message,
|
|
220
|
+
translatedMessage,
|
|
221
|
+
key,
|
|
222
|
+
context,
|
|
223
|
+
isFreeText,
|
|
224
|
+
skipOwnMessage,
|
|
225
|
+
cache,
|
|
226
|
+
alternatives,
|
|
227
|
+
}: SendHelpProps) => {
|
|
196
228
|
if (!context) throw new Error('Trying to send message in chat without context')
|
|
197
229
|
this.setLastMessageKey(key)
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
230
|
+
if (skipOwnMessage) {
|
|
231
|
+
this.cache.clearMessages(key)
|
|
232
|
+
} else {
|
|
233
|
+
this.cache.addMessages(key, {
|
|
234
|
+
messages: [messagesHelper.createOwn({ message, translatedMessage })],
|
|
235
|
+
})
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const chatHistory =
|
|
239
|
+
context.assignmentId && context.problemId
|
|
240
|
+
? {
|
|
241
|
+
exerciseId: context.assignmentId,
|
|
242
|
+
problemId: context.problemId,
|
|
243
|
+
chatVersion: alternatives?.version,
|
|
244
|
+
}
|
|
245
|
+
: undefined
|
|
201
246
|
|
|
202
247
|
// Request is overridden by ThreadManager.postMessage (delegates to sendMessage/getHint)
|
|
203
248
|
const response = await this.api.postMessageFx({
|
|
204
249
|
answer: context.answer,
|
|
205
250
|
answerOptions: context.answerOptions,
|
|
206
|
-
problemDescription: context.
|
|
251
|
+
problemDescription: context.problemDescription,
|
|
252
|
+
problemStandards: context.problemStandards,
|
|
207
253
|
problemAnswer: context.problemAnswer,
|
|
208
254
|
language: context.language,
|
|
209
255
|
imageAltText: context.imageDescription,
|
|
210
256
|
imageCdnId: context.imageCdnId,
|
|
211
257
|
conversationId: cache[key].conversationId,
|
|
258
|
+
chatHistory,
|
|
212
259
|
...(isFreeText && { freeTextMessage: message }),
|
|
213
260
|
})
|
|
214
261
|
|
|
@@ -294,6 +341,10 @@ export class ChatbotModel {
|
|
|
294
341
|
this.cache.setSingleMessage(key, { ...message, options })
|
|
295
342
|
}
|
|
296
343
|
|
|
344
|
+
public addMessage({ key, ...message }: SetHintMessageProps) {
|
|
345
|
+
this.cache.addMessages(key, { messages: [message] })
|
|
346
|
+
}
|
|
347
|
+
|
|
297
348
|
public readonly reinitConversation = ({ key }: ReinitConversationProps) => {
|
|
298
349
|
this.cache.reinitChatThread(key, { initialOption: this.defaultMessages.anotherHintOption })
|
|
299
350
|
this.threadManager.reset(key)
|
|
@@ -10,10 +10,17 @@ import {
|
|
|
10
10
|
import { ChatbotMessages, ChatRequestType, IChatDrawBoardAdapter } from '../types/model.types'
|
|
11
11
|
import { CHAT_BOT_MODEL_DEFAULTS } from './constants'
|
|
12
12
|
import { prepareChatRequestPayload } from '../helpers'
|
|
13
|
+
import { RequestOptionalConfig } from 'src/lib/effector/createControllerEffect'
|
|
13
14
|
|
|
14
15
|
type ThreadManagerApi = {
|
|
15
|
-
getHint: (
|
|
16
|
-
|
|
16
|
+
getHint: (
|
|
17
|
+
props: ChatHintPayload,
|
|
18
|
+
requestConfig?: RequestOptionalConfig,
|
|
19
|
+
) => Promise<ChatHintResponse>
|
|
20
|
+
sendMessage: (
|
|
21
|
+
props: SendMessagePayload,
|
|
22
|
+
requestConfig?: RequestOptionalConfig,
|
|
23
|
+
) => Promise<SendMessageResponse>
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
type ChatBotThreadManagerProps = {
|
|
@@ -69,6 +76,7 @@ export class ChatBotThreadManager {
|
|
|
69
76
|
|
|
70
77
|
public readonly postMessage = async (
|
|
71
78
|
payload: PostMessagePayload,
|
|
79
|
+
requestConfig?: RequestOptionalConfig,
|
|
72
80
|
): Promise<PostMessageResponse> => {
|
|
73
81
|
if (!this.api) {
|
|
74
82
|
throw new Error(
|
|
@@ -80,8 +88,8 @@ export class ChatBotThreadManager {
|
|
|
80
88
|
|
|
81
89
|
const result: SendMessageResponse | ChatHintResponse =
|
|
82
90
|
type === ChatRequestType.FREETEXT
|
|
83
|
-
? await this.api.sendMessage(data)
|
|
84
|
-
: await this.api.getHint(data)
|
|
91
|
+
? await this.api.sendMessage(data, requestConfig)
|
|
92
|
+
: await this.api.getHint(data, requestConfig)
|
|
85
93
|
|
|
86
94
|
threadItem.history.push(result.message)
|
|
87
95
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { restore, createEvent, combine } from 'effector'
|
|
2
|
+
import { Timepoint } from '../types/api.types'
|
|
3
|
+
import { OnTimeUpdate } from '../types/t2s.types'
|
|
4
|
+
import { findCurrentMark } from '../helpers/ttsHighlight'
|
|
5
|
+
import { WORD_MARK_REGEX } from '../constants'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Manages word-by-word highlight state during TTS playback.
|
|
9
|
+
* Tracks which word index should be highlighted based on audio timepoints
|
|
10
|
+
* and current playback time from the AudioProvider.
|
|
11
|
+
*/
|
|
12
|
+
export class ChatTTSHighlightModel {
|
|
13
|
+
private lastMark: string | undefined = undefined
|
|
14
|
+
|
|
15
|
+
readonly setTimepoints = createEvent<Timepoint[]>()
|
|
16
|
+
readonly setTime = createEvent<number>()
|
|
17
|
+
readonly setIsActive = createEvent<boolean>()
|
|
18
|
+
readonly reset = createEvent()
|
|
19
|
+
|
|
20
|
+
readonly $time = restore(this.setTime, 0).reset(this.reset)
|
|
21
|
+
readonly $timepoints = restore(this.setTimepoints, []).reset(this.reset)
|
|
22
|
+
readonly $isActive = restore(this.setIsActive, false).reset(this.reset)
|
|
23
|
+
|
|
24
|
+
readonly $highlightedWordIndex = combine(
|
|
25
|
+
this.$timepoints,
|
|
26
|
+
this.$time,
|
|
27
|
+
this.$isActive,
|
|
28
|
+
(timepoints, time, isActive) => {
|
|
29
|
+
if (!isActive || !timepoints.length) return -1
|
|
30
|
+
|
|
31
|
+
const currentMark = findCurrentMark(timepoints, time)
|
|
32
|
+
if (!currentMark) return -1
|
|
33
|
+
|
|
34
|
+
const match = currentMark.match(WORD_MARK_REGEX)
|
|
35
|
+
return match ? parseInt(match[1], 10) : -1
|
|
36
|
+
},
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Sets timepoints and starts listening to AudioProvider time updates.
|
|
41
|
+
* Only triggers store updates when the highlighted word actually changes.
|
|
42
|
+
*/
|
|
43
|
+
activate(timepoints: Timepoint[], onTimeUpdate: OnTimeUpdate) {
|
|
44
|
+
this.setTimepoints(timepoints)
|
|
45
|
+
this.setIsActive(true)
|
|
46
|
+
this.lastMark = undefined
|
|
47
|
+
|
|
48
|
+
onTimeUpdate((time: number) => {
|
|
49
|
+
const currentMark = findCurrentMark(this.$timepoints.getState(), time)
|
|
50
|
+
if (!currentMark) return
|
|
51
|
+
|
|
52
|
+
if (currentMark !== this.lastMark) {
|
|
53
|
+
this.lastMark = currentMark
|
|
54
|
+
this.setTime(time)
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
deactivate(onTimeUpdate: OnTimeUpdate | null) {
|
|
60
|
+
onTimeUpdate?.(null)
|
|
61
|
+
this.lastMark = undefined
|
|
62
|
+
this.reset()
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { restore, createEvent, createEffect, sample, Store } from 'effector'
|
|
2
|
+
import { AUDIO_CONFIG, DEFAULT_VOICE } from '../constants'
|
|
3
|
+
import {
|
|
4
|
+
AudioCache,
|
|
5
|
+
AudioConfig,
|
|
6
|
+
AudioProvider,
|
|
7
|
+
AudioStatus,
|
|
8
|
+
PlayTextToSpeechProps,
|
|
9
|
+
T2SConfig,
|
|
10
|
+
} from '../types/t2s.types'
|
|
11
|
+
|
|
12
|
+
import { ChatItem } from '../types/units.types'
|
|
13
|
+
import { textToSSML } from '../helpers/ttsHighlight'
|
|
14
|
+
import { ChatbotAPI } from './ChatbotApi'
|
|
15
|
+
import { ChatTTSHighlightModel } from './ChatTTSHighlightModel'
|
|
16
|
+
|
|
17
|
+
type ChatTextToSpeechModelProps = {
|
|
18
|
+
api: ChatbotAPI
|
|
19
|
+
$currentChatData: Store<ChatItem>
|
|
20
|
+
$isTranslated: Store<boolean>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class ChatTTSModel {
|
|
24
|
+
private readonly api: ChatbotAPI
|
|
25
|
+
public readonly wordHighlight = new ChatTTSHighlightModel()
|
|
26
|
+
private readonly audioCache = new Map<string, AudioCache>()
|
|
27
|
+
private readonly $currentChatData
|
|
28
|
+
private readonly $isTranslated
|
|
29
|
+
private audioProvider: AudioProvider | null = null
|
|
30
|
+
private wordHighlightEnabled = false
|
|
31
|
+
|
|
32
|
+
readonly setCurrentPlayingId = createEvent<string | null>()
|
|
33
|
+
readonly $currentPlayingId = restore(this.setCurrentPlayingId, null)
|
|
34
|
+
readonly setStatus = createEvent<AudioStatus>()
|
|
35
|
+
readonly $status = restore(this.setStatus, AudioStatus.STOPPED)
|
|
36
|
+
|
|
37
|
+
private audioConfig: AudioConfig | null = null
|
|
38
|
+
private textSanitizer = (value: string) => value
|
|
39
|
+
|
|
40
|
+
constructor({ api, $currentChatData, $isTranslated }: ChatTextToSpeechModelProps) {
|
|
41
|
+
this.api = api
|
|
42
|
+
this.$currentChatData = $currentChatData
|
|
43
|
+
this.$isTranslated = $isTranslated
|
|
44
|
+
|
|
45
|
+
sample({
|
|
46
|
+
clock: $isTranslated,
|
|
47
|
+
target: this.reset,
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public setAudioConfig(config: AudioConfig | null) {
|
|
52
|
+
this.audioConfig = config
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public setConfig({ audioProvider, textSanitizer, isWordHighlightEnabled }: T2SConfig) {
|
|
56
|
+
if (audioProvider) this.audioProvider = audioProvider
|
|
57
|
+
if (textSanitizer) this.textSanitizer = textSanitizer
|
|
58
|
+
// Highlighting requires audioProvider.onTimeUpdate to sync playback time with word highlights
|
|
59
|
+
this.wordHighlightEnabled = !!isWordHighlightEnabled && !!this.audioProvider?.onTimeUpdate
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public get isWordHighlightEnabled() {
|
|
63
|
+
return this.wordHighlightEnabled
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private getCacheKey = (messageId: string, isTranslated: boolean) => {
|
|
67
|
+
return `${messageId}-${isTranslated ? 'translated' : 'original'}`
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private async fetchAudio(text: string): Promise<AudioCache> {
|
|
71
|
+
const config = this.audioConfig
|
|
72
|
+
const response = await this.api.textToSpeechTextFx({
|
|
73
|
+
input: this.wordHighlightEnabled ? { ssml: textToSSML(text) } : { text },
|
|
74
|
+
voice: config?.voice ?? DEFAULT_VOICE,
|
|
75
|
+
audioConfig: config?.audioConfig ?? AUDIO_CONFIG,
|
|
76
|
+
enableTimePointing: this.wordHighlightEnabled ? ['SSML_MARK'] : [],
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
const audioPath =
|
|
80
|
+
typeof response.audioContent === 'string'
|
|
81
|
+
? `data:audio/mpeg;base64,${response.audioContent}`
|
|
82
|
+
: (response?.audioContent ?? '')
|
|
83
|
+
|
|
84
|
+
return { audioPath, timepoints: response.timepoints ?? [] }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public async play({ message, isTranslated }: PlayTextToSpeechProps) {
|
|
88
|
+
if (!this.audioProvider) throw new Error('Audio provider is not set. Use setConfig.')
|
|
89
|
+
const messageText = isTranslated ? message.translatedMessage! : message.message
|
|
90
|
+
const messageId = message.id
|
|
91
|
+
const text = this.textSanitizer(messageText)
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
const status = this.$status.getState()
|
|
95
|
+
const playingId = this.$currentPlayingId.getState()
|
|
96
|
+
const isPlaying = status === AudioStatus.PLAYING
|
|
97
|
+
const isPaused = status === AudioStatus.PAUSED
|
|
98
|
+
const isCurrentMessage = messageId === playingId
|
|
99
|
+
|
|
100
|
+
if (isPlaying && isCurrentMessage) {
|
|
101
|
+
this.audioProvider.pause()
|
|
102
|
+
if (this.wordHighlightEnabled) this.wordHighlight.setIsActive(false)
|
|
103
|
+
this.setStatus(AudioStatus.PAUSED)
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (isPaused && isCurrentMessage) {
|
|
108
|
+
this.audioProvider.resume()
|
|
109
|
+
if (this.wordHighlightEnabled) this.wordHighlight.setIsActive(true)
|
|
110
|
+
this.setStatus(AudioStatus.PLAYING)
|
|
111
|
+
return
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (messageId && !isCurrentMessage) {
|
|
115
|
+
this.audioProvider.stop()
|
|
116
|
+
this.wordHighlight.deactivate(this.audioProvider?.onTimeUpdate ?? null)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const cacheKey = this.getCacheKey(messageId, isTranslated)
|
|
120
|
+
this.setCurrentPlayingId(messageId)
|
|
121
|
+
|
|
122
|
+
const cached = this.audioCache.get(cacheKey)
|
|
123
|
+
const { audioPath, timepoints } = cached ?? (await this.fetchAudio(text))
|
|
124
|
+
|
|
125
|
+
if (!cached) {
|
|
126
|
+
this.audioCache.set(cacheKey, { audioPath, timepoints })
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (this.wordHighlightEnabled && this.audioProvider?.onTimeUpdate && timepoints.length > 0) {
|
|
130
|
+
this.wordHighlight.activate(timepoints, this.audioProvider.onTimeUpdate)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
this.setStatus(AudioStatus.PLAYING)
|
|
134
|
+
await this.audioProvider.play(audioPath, () => {
|
|
135
|
+
this.onPlaybackComplete()
|
|
136
|
+
})
|
|
137
|
+
} catch (error) {
|
|
138
|
+
void this.reset()
|
|
139
|
+
console.error('Error playing text-to-speech: ', error)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
public async playLatest() {
|
|
144
|
+
const lastMessage = this.$currentChatData.getState().messages.at(-1)
|
|
145
|
+
if (!lastMessage) return
|
|
146
|
+
|
|
147
|
+
const isTranslated = this.$isTranslated.getState()
|
|
148
|
+
return this.play({ message: lastMessage, isTranslated })
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private onPlaybackComplete = () => {
|
|
152
|
+
this.setStatus(AudioStatus.STOPPED)
|
|
153
|
+
this.setCurrentPlayingId(null)
|
|
154
|
+
this.wordHighlight.deactivate(this.audioProvider?.onTimeUpdate ?? null)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public stop() {
|
|
158
|
+
if (!this.audioProvider) throw new Error('Audio provider is not set. Use setAudioProvider.')
|
|
159
|
+
this.audioProvider.stop()
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
public readonly reset = createEffect(() => {
|
|
163
|
+
this.stop()
|
|
164
|
+
this.setStatus(AudioStatus.STOPPED)
|
|
165
|
+
this.setCurrentPlayingId(null)
|
|
166
|
+
this.wordHighlight.deactivate(this.audioProvider?.onTimeUpdate ?? null)
|
|
167
|
+
})
|
|
168
|
+
}
|
|
@@ -13,6 +13,7 @@ export class ChatbotAPI {
|
|
|
13
13
|
constructor(api: ChatbotApiRequests) {
|
|
14
14
|
this.postMessageFx = createControllerEffect(api.postMessage)
|
|
15
15
|
this.getAlternativesFx = createEffect(api.getAlternatives)
|
|
16
|
+
this.textToSpeechTextFx = createEffect(api.postTextToSpeech)
|
|
16
17
|
this.translateTextFx = createEffect(
|
|
17
18
|
async (payload: GoogleTranslatePayload): Promise<GoogleTranslateResponse> => {
|
|
18
19
|
const response = await api.postTranslateText({
|
|
@@ -32,6 +33,5 @@ export class ChatbotAPI {
|
|
|
32
33
|
}
|
|
33
34
|
},
|
|
34
35
|
)
|
|
35
|
-
this.textToSpeechTextFx = createEffect(api.postTextToSpeech)
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -17,6 +17,10 @@ type AddMessagesProps = {
|
|
|
17
17
|
thread?: ThreadItem | null
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
type AddMessageProps = {
|
|
21
|
+
message: ConversationMessage
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
export function defaultChatData(props: Partial<ChatItem> = {}): ChatItem {
|
|
21
25
|
return {
|
|
22
26
|
messages: [],
|
|
@@ -67,6 +71,13 @@ export class ChatsCacheModel {
|
|
|
67
71
|
})
|
|
68
72
|
}
|
|
69
73
|
|
|
74
|
+
public clearMessages(key: string) {
|
|
75
|
+
this.cache.setField({
|
|
76
|
+
key,
|
|
77
|
+
fn: (current) => (current ? { ...current, messages: [] } : undefined),
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
70
81
|
public setSingleMessage(key: string, message: ConversationMessage) {
|
|
71
82
|
this.cache.setField({
|
|
72
83
|
key,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatAnswer,
|
|
1
|
+
import { ChatAnswer, Stroke } from './units.types'
|
|
2
2
|
|
|
3
3
|
export type GetAlternativesPayload = {
|
|
4
4
|
municipalityId: string
|
|
@@ -10,21 +10,36 @@ export type AlternativesOptions = {
|
|
|
10
10
|
hints: ChatAnswer[]
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
export type ChatHistory = { exerciseId: string; problemId: string; chatVersion?: string }
|
|
14
|
+
|
|
15
|
+
export type ProblemStandard = {
|
|
16
|
+
id: string
|
|
17
|
+
name: string
|
|
18
|
+
description: string
|
|
19
|
+
numberOfMatchedSkills: number
|
|
20
|
+
}
|
|
21
|
+
|
|
13
22
|
export type GetAlternativesResponse = {
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated chatAccess depends on assignment.lavaChat or class grade
|
|
25
|
+
*/
|
|
14
26
|
chatAccess?: boolean
|
|
15
27
|
isOpenChatEnabled?: boolean
|
|
28
|
+
municipalityChatEnable: boolean
|
|
16
29
|
version: string
|
|
17
30
|
options: AlternativesOptions
|
|
18
31
|
}
|
|
19
32
|
|
|
20
33
|
export type SendMessagePayload = {
|
|
21
|
-
problemDescription?: string
|
|
22
|
-
correctAnswer?: string | string[]
|
|
23
|
-
answerOptions?: string[]
|
|
24
|
-
altText?: string
|
|
25
|
-
language?: string
|
|
26
34
|
message: string
|
|
35
|
+
altText?: string
|
|
36
|
+
answerOptions?: string[]
|
|
37
|
+
chatHistory?: ChatHistory
|
|
38
|
+
correctAnswer?: string | string[]
|
|
27
39
|
conversationId?: string
|
|
40
|
+
problemDescription?: string
|
|
41
|
+
problemStandards?: ProblemStandard[]
|
|
42
|
+
language?: string
|
|
28
43
|
}
|
|
29
44
|
|
|
30
45
|
export type SendMessageResponse = {
|
|
@@ -36,12 +51,14 @@ export type PostMessagePayload = {
|
|
|
36
51
|
language: string
|
|
37
52
|
problemAnswer: string[]
|
|
38
53
|
problemDescription: string
|
|
54
|
+
problemStandards?: ProblemStandard[]
|
|
39
55
|
answer?: string | string[]
|
|
40
56
|
answerOptions?: string[]
|
|
41
57
|
imageAltText?: string
|
|
42
58
|
imageCdnId?: string
|
|
43
59
|
freeTextMessage?: string
|
|
44
60
|
conversationId?: string | null
|
|
61
|
+
chatHistory?: ChatHistory
|
|
45
62
|
}
|
|
46
63
|
|
|
47
64
|
export type PostMessageResponse = {
|
|
@@ -66,9 +83,7 @@ export type GoogleTranslateResponse = {
|
|
|
66
83
|
}
|
|
67
84
|
|
|
68
85
|
export type GoogleText2SpeechPayload = {
|
|
69
|
-
input: {
|
|
70
|
-
text: string
|
|
71
|
-
}
|
|
86
|
+
input: { text: string } | { ssml: string }
|
|
72
87
|
voice: {
|
|
73
88
|
languageCode: string
|
|
74
89
|
name: string
|
|
@@ -93,6 +108,7 @@ export type GoogleText2SpeechResponse = {
|
|
|
93
108
|
|
|
94
109
|
export type ChatHintPayload = {
|
|
95
110
|
problemDescription: string
|
|
111
|
+
problemStandards?: ProblemStandard[]
|
|
96
112
|
correctAnswer: string[]
|
|
97
113
|
userAnswer?: string | string[]
|
|
98
114
|
stroke?: Stroke[]
|
|
@@ -108,13 +124,3 @@ export type ChatHintResponse = {
|
|
|
108
124
|
conversationId?: string | null
|
|
109
125
|
errorStrokeIds?: string[]
|
|
110
126
|
}
|
|
111
|
-
export type ErrorSpottingPayload = {
|
|
112
|
-
strokes: FullStrokeData[]
|
|
113
|
-
problemDescription: string
|
|
114
|
-
correctAnswer: string[]
|
|
115
|
-
userAnswer: string | string[]
|
|
116
|
-
hint: string
|
|
117
|
-
}
|
|
118
|
-
export type ErrorSpottingResponse = {
|
|
119
|
-
highlightedStrokeIds: string[]
|
|
120
|
-
}
|