@magmamath/students-features 0.3.2 → 0.4.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +12 -4
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +6 -4
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +12 -1
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +5 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/context/ChatBotContext.js +17 -0
- package/dist/commonjs/features/chatbot/context/ChatBotContext.js.map +1 -0
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.js +58 -0
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.js.map +1 -0
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js +99 -0
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +1 -0
- package/dist/commonjs/features/chatbot/index.js +0 -7
- package/dist/commonjs/features/chatbot/index.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +136 -117
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/{ChatBotMessageHandler.js → ChatBotThreadManager.js} +28 -17
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/{api.js → ChatbotApi.js} +16 -1
- package/dist/commonjs/features/chatbot/model/ChatbotApi.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js +110 -0
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js +0 -1
- package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ThreadItem.js +21 -8
- package/dist/commonjs/features/chatbot/model/ThreadItem.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/messagesHelper.js +1 -5
- package/dist/commonjs/features/chatbot/model/messagesHelper.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/t2s.js +0 -6
- package/dist/commonjs/features/chatbot/model/t2s.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/translation.helpers.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/translation.js +54 -45
- package/dist/commonjs/features/chatbot/model/translation.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/api.types.js +4 -0
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/units.types.js +2 -0
- package/dist/commonjs/features/chatbot/types/units.types.js.map +1 -0
- package/dist/commonjs/features/feedback/components/TeacherFeedbackButton/colorSchemes.js +18 -9
- package/dist/commonjs/features/feedback/components/TeacherFeedbackButton/colorSchemes.js.map +1 -1
- package/dist/commonjs/lib/effector/createEntityFieldStore.js +4 -0
- package/dist/commonjs/lib/effector/createEntityFieldStore.js.map +1 -1
- package/dist/commonjs/lib/helpers/randomElements.js +24 -0
- package/dist/commonjs/lib/helpers/randomElements.js.map +1 -0
- package/dist/commonjs/shared/icons/HighlighterIcon.js +36 -0
- package/dist/commonjs/shared/icons/HighlighterIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/StopIcon.js +33 -0
- package/dist/commonjs/shared/icons/StopIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/icon.types.js +4 -0
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +12 -4
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +6 -4
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +12 -1
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +6 -2
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/context/ChatBotContext.js +12 -0
- package/dist/module/features/chatbot/context/ChatBotContext.js.map +1 -0
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingButton.js +52 -0
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingButton.js.map +1 -0
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js +94 -0
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +1 -0
- package/dist/module/features/chatbot/index.js +0 -1
- package/dist/module/features/chatbot/index.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotModel.js +138 -119
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/{ChatBotMessageHandler.js → ChatBotThreadManager.js} +26 -15
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -0
- package/dist/module/features/chatbot/model/{api.js → ChatbotApi.js} +16 -1
- package/dist/module/features/chatbot/model/ChatbotApi.js.map +1 -0
- package/dist/module/features/chatbot/model/ChatsCacheModel.js +104 -0
- package/dist/module/features/chatbot/model/ChatsCacheModel.js.map +1 -0
- package/dist/module/features/chatbot/model/DefaultMessageCreator.js +0 -1
- package/dist/module/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
- package/dist/module/features/chatbot/model/ThreadItem.js +21 -8
- package/dist/module/features/chatbot/model/ThreadItem.js.map +1 -1
- package/dist/module/features/chatbot/model/messagesHelper.js +1 -5
- package/dist/module/features/chatbot/model/messagesHelper.js.map +1 -1
- package/dist/module/features/chatbot/model/t2s.js +1 -7
- package/dist/module/features/chatbot/model/t2s.js.map +1 -1
- package/dist/module/features/chatbot/model/translation.helpers.js.map +1 -1
- package/dist/module/features/chatbot/model/translation.js +54 -45
- package/dist/module/features/chatbot/model/translation.js.map +1 -1
- package/dist/module/features/chatbot/types/api.types.js +2 -0
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/features/chatbot/types/units.types.js +2 -0
- package/dist/module/features/chatbot/types/units.types.js.map +1 -0
- package/dist/module/features/feedback/components/TeacherFeedbackButton/colorSchemes.js +18 -9
- package/dist/module/features/feedback/components/TeacherFeedbackButton/colorSchemes.js.map +1 -1
- package/dist/module/lib/effector/createEntityFieldStore.js +4 -0
- package/dist/module/lib/effector/createEntityFieldStore.js.map +1 -1
- package/dist/module/lib/helpers/randomElements.js +20 -0
- package/dist/module/lib/helpers/randomElements.js.map +1 -0
- package/dist/module/shared/icons/HighlighterIcon.js +29 -0
- package/dist/module/shared/icons/HighlighterIcon.js.map +1 -0
- package/dist/module/shared/icons/StopIcon.js +26 -0
- package/dist/module/shared/icons/StopIcon.js.map +1 -0
- package/dist/module/shared/icons/icon.types.js +2 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.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/ChatMessages/ChatbotMessages.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/context/ChatBotContext.d.ts +8 -0
- package/dist/typescript/commonjs/features/chatbot/context/ChatBotContext.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts +3 -0
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +28 -0
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +4 -3
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +19 -14
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/{module/features/chatbot/model/ChatBotMessageHandler.d.ts → commonjs/features/chatbot/model/ChatBotThreadManager.d.ts} +11 -8
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/{api.d.ts → ChatbotApi.d.ts} +4 -3
- package/dist/typescript/commonjs/features/chatbot/model/ChatbotApi.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts +26 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts +3 -2
- package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts +12 -6
- package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts +3 -4
- package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts +2 -4
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts +7 -8
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts +2 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +2 -11
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +26 -19
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts +2 -1
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +31 -0
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/feedback/components/TeacherFeedbackButton/colorSchemes.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts +2 -0
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/helpers/randomElements.d.ts +2 -0
- package/dist/typescript/commonjs/lib/helpers/randomElements.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/HighlighterIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/HighlighterIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/StopIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/StopIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/icon.types.d.ts +2 -0
- package/dist/typescript/commonjs/shared/icons/icon.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.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/ChatMessages/ChatbotMessages.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/context/ChatBotContext.d.ts +8 -0
- package/dist/typescript/module/features/chatbot/context/ChatBotContext.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts +3 -0
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +28 -0
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/index.d.ts +4 -3
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +19 -14
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/{commonjs/features/chatbot/model/ChatBotMessageHandler.d.ts → module/features/chatbot/model/ChatBotThreadManager.d.ts} +11 -8
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/{api.d.ts → ChatbotApi.d.ts} +4 -3
- package/dist/typescript/module/features/chatbot/model/ChatbotApi.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts +26 -0
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts +3 -2
- package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts +12 -6
- package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts +3 -4
- package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts +2 -4
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/translation.d.ts +7 -8
- package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts +2 -1
- package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +2 -11
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts +26 -19
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts +2 -1
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts +31 -0
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -0
- package/dist/typescript/module/features/feedback/components/TeacherFeedbackButton/colorSchemes.d.ts.map +1 -1
- package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts +2 -0
- package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts.map +1 -1
- package/dist/typescript/module/lib/helpers/randomElements.d.ts +2 -0
- package/dist/typescript/module/lib/helpers/randomElements.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/HighlighterIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/HighlighterIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/StopIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/StopIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/icon.types.d.ts +2 -0
- package/dist/typescript/module/shared/icons/icon.types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/features/chatbot/components/ChatControls/ChatControls.tsx +10 -3
- package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +1 -0
- package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +3 -0
- package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +14 -0
- package/src/features/chatbot/components/Chatbot.tsx +3 -2
- package/src/features/chatbot/context/ChatBotContext.ts +18 -0
- package/src/features/chatbot/errorSpotting/ErrorSpottingButton.tsx +53 -0
- package/src/features/chatbot/errorSpotting/ErrorSpottingModel.ts +116 -0
- package/src/features/chatbot/index.ts +3 -3
- package/src/features/chatbot/model/ChatBotModel.ts +123 -124
- package/src/features/chatbot/model/{ChatBotMessageHandler.ts → ChatBotThreadManager.ts} +28 -16
- package/src/features/chatbot/model/{api.ts → ChatbotApi.ts} +19 -2
- package/src/features/chatbot/model/ChatsCacheModel.ts +94 -0
- package/src/features/chatbot/model/DefaultMessageCreator.ts +3 -3
- package/src/features/chatbot/model/ThreadItem.ts +20 -9
- package/src/features/chatbot/model/messagesHelper.ts +2 -6
- package/src/features/chatbot/model/t2s.ts +3 -10
- package/src/features/chatbot/model/translation.helpers.ts +2 -1
- package/src/features/chatbot/model/translation.ts +52 -46
- package/src/features/chatbot/types/api.types.ts +2 -12
- package/src/features/chatbot/types/model.types.ts +38 -26
- package/src/features/chatbot/types/translation.types.ts +2 -1
- package/src/features/chatbot/types/units.types.ts +34 -0
- package/src/features/feedback/components/TeacherFeedbackButton/colorSchemes.ts +9 -0
- package/src/lib/effector/createEntityFieldStore.ts +9 -1
- package/src/lib/helpers/randomElements.ts +22 -0
- package/src/shared/icons/HighlighterIcon.tsx +21 -0
- package/src/shared/icons/StopIcon.tsx +17 -0
- package/src/shared/icons/icon.types.ts +9 -6
- package/dist/commonjs/features/chatbot/model/ChatBotMessageHandler.js.map +0 -1
- package/dist/commonjs/features/chatbot/model/api.js.map +0 -1
- package/dist/module/features/chatbot/model/ChatBotMessageHandler.js.map +0 -1
- package/dist/module/features/chatbot/model/api.js.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotMessageHandler.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/api.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotMessageHandler.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/api.d.ts.map +0 -1
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
import { EventCallable, Store } from 'effector';
|
|
2
2
|
import { TranslateMessageFxProps } from '../types/translation.types';
|
|
3
|
-
import { ChatbotContext, ChatbotMessages
|
|
3
|
+
import { ChatbotContext, ChatbotMessages } from '../types/model.types';
|
|
4
4
|
import { GetAlternativesResponse } from '../types/api.types';
|
|
5
|
-
import { ChatbotAPI } from './
|
|
6
|
-
import {
|
|
5
|
+
import { ChatbotAPI } from './ChatbotApi';
|
|
6
|
+
import { ChatsCacheModel } from './ChatsCacheModel';
|
|
7
|
+
import { ConversationMessage } from '../types/units.types';
|
|
7
8
|
type ChatbotTranslationProps = {
|
|
8
9
|
api: ChatbotAPI;
|
|
9
10
|
$key: Store<string>;
|
|
10
11
|
defaultMessages: ChatbotMessages;
|
|
11
|
-
messagesModel: EntityFieldStore<ConversationMessage[]>;
|
|
12
12
|
$context: Store<ChatbotContext | null>;
|
|
13
13
|
alternativesModel: {
|
|
14
14
|
set: EventCallable<GetAlternativesResponse | null>;
|
|
15
15
|
$store: Store<GetAlternativesResponse | null>;
|
|
16
16
|
};
|
|
17
|
+
chats: ChatsCacheModel;
|
|
17
18
|
};
|
|
18
19
|
export declare class ChatbotTranslation {
|
|
19
20
|
private readonly api;
|
|
20
21
|
private readonly $key;
|
|
21
22
|
private readonly $context;
|
|
22
23
|
private readonly defaultMessages;
|
|
23
|
-
private readonly messagesModel;
|
|
24
24
|
private readonly alternativesModel;
|
|
25
25
|
readonly setIsTranslated: EventCallable<boolean>;
|
|
26
26
|
readonly $isTranslated: import("effector").StoreWritable<boolean>;
|
|
27
27
|
readonly translateAllMessagesFx: import("effector").Effect<void, ConversationMessage[], Error>;
|
|
28
|
-
constructor({ api, $key, defaultMessages,
|
|
28
|
+
constructor({ api, $key, defaultMessages, alternativesModel, $context, chats, }: ChatbotTranslationProps);
|
|
29
29
|
private shouldSkipTranslation;
|
|
30
|
-
private initTranslationSamples;
|
|
31
30
|
private translateRequest;
|
|
32
31
|
private addTranslationToAlternatives;
|
|
33
32
|
private readonly translateBatchFx;
|
|
34
|
-
readonly
|
|
33
|
+
readonly applyTranslationFx: import("effector").Effect<Omit<TranslateMessageFxProps, "isTranslated">, ConversationMessage[], Error>;
|
|
35
34
|
reset(): void;
|
|
36
35
|
}
|
|
37
36
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/translation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,aAAa,EAAmB,KAAK,EAAE,MAAM,UAAU,CAAA;AACnG,OAAO,EAGL,uBAAuB,EAExB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/translation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,aAAa,EAAmB,KAAK,EAAE,MAAM,UAAU,CAAA;AACnG,OAAO,EAGL,uBAAuB,EAExB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAOzC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE1D,KAAK,uBAAuB,GAAG;IAC7B,GAAG,EAAE,UAAU,CAAA;IACf,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACnB,eAAe,EAAE,eAAe,CAAA;IAChC,QAAQ,EAAE,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IACtC,iBAAiB,EAAE;QACjB,GAAG,EAAE,aAAa,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAA;QAClD,MAAM,EAAE,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAA;KAC9C,CAAA;IACD,KAAK,EAAE,eAAe,CAAA;CACvB,CAAA;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAA;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAA;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAA;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAA;IAChC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAA;IAElC,QAAQ,CAAC,eAAe,yBAAyB;IACjD,QAAQ,CAAC,aAAa,4CAAuC;IAE7D,QAAQ,CAAC,sBAAsB,gEAAA;gBAEnB,EACV,GAAG,EACH,IAAI,EACJ,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,KAAK,GACN,EAAE,uBAAuB;IAyB1B,OAAO,CAAC,qBAAqB;YAef,gBAAgB;IAmB9B,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAkDhC;IAED,SAAgB,kBAAkB,yGAmChC;IAEK,KAAK;CAGb"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AddTranslationToAlternativesProps, GetOptionsProps, GetOptionsResult } from '../types/translation.types';
|
|
2
|
-
import {
|
|
2
|
+
import { GetAlternativesResponse } from '../types/api.types';
|
|
3
|
+
import { ChatAnswer } from '../types/units.types';
|
|
3
4
|
export declare function getOptionsForTranslation({ lastMessage, alternatives, }: GetOptionsProps): GetOptionsResult;
|
|
4
5
|
export declare function addTranslationsToAlternative({ alternatives, translatedHints, translatedDefaults, }: AddTranslationToAlternativesProps): GetAlternativesResponse;
|
|
5
6
|
export declare function addTranslationToOptions(options: ChatAnswer[], translations: string[]): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/translation.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,eAAe,EACf,gBAAgB,EACjB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"translation.helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/translation.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,eAAe,EACf,gBAAgB,EACjB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,wBAAgB,wBAAwB,CAAC,EACvC,WAAW,EACX,YAAY,GACb,EAAE,eAAe,GAAG,gBAAgB,CAmBpC;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,YAAY,EACZ,eAAe,EACf,kBAAkB,GACnB,EAAE,iCAAiC,GAAG,uBAAuB,CAe7D;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE;;;;IAKpF"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
text: string;
|
|
3
|
-
promptKey: string;
|
|
4
|
-
translatedText?: string;
|
|
5
|
-
};
|
|
1
|
+
import { ChatAnswer, IThreadItem, Stroke } from './units.types';
|
|
6
2
|
export type GetAlternativesPayload = {
|
|
7
3
|
municipalityId: string;
|
|
8
4
|
assignmentClassGrade: number;
|
|
@@ -18,15 +14,14 @@ export type PostMessagePayload = {
|
|
|
18
14
|
language: string;
|
|
19
15
|
problemAnswer: string[];
|
|
20
16
|
answer?: string | string[];
|
|
21
|
-
threadId?: string | null;
|
|
22
17
|
problem: string;
|
|
23
18
|
imageAltText?: string;
|
|
24
19
|
};
|
|
25
20
|
export type PostMessageResponse = {
|
|
26
21
|
message: string;
|
|
27
|
-
threadId: string;
|
|
28
22
|
options: ChatAnswer[];
|
|
29
23
|
endMessage?: boolean;
|
|
24
|
+
thread: IThreadItem;
|
|
30
25
|
};
|
|
31
26
|
export type GoogleTranslatePayload = {
|
|
32
27
|
text: string[];
|
|
@@ -57,10 +52,6 @@ export type GoogleText2SpeechPayload = {
|
|
|
57
52
|
export type GoogleText2SpeechResponse = string | undefined | {
|
|
58
53
|
audioContent?: string;
|
|
59
54
|
};
|
|
60
|
-
export type Stroke = {
|
|
61
|
-
x: number[];
|
|
62
|
-
y: number[];
|
|
63
|
-
};
|
|
64
55
|
export type ChatHintPayload = {
|
|
65
56
|
problemDescription: string;
|
|
66
57
|
correctAnswer: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/api.types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"api.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/api.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;CAC7B,GAAG,IAAI,CAAA;AAER,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,EAAE;QACP,OAAO,EAAE,UAAU,EAAE,CAAA;QACrB,KAAK,EAAE,UAAU,EAAE,CAAA;KACpB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,WAAW,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE;QACJ,YAAY,EAAE;YAAE,cAAc,EAAE,MAAM,CAAC;YAAC,sBAAsB,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAC3E,CAAA;CACF,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAA;QACpB,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,WAAW,EAAE;QACX,aAAa,EAAE,MAAM,CAAA;QACrB,KAAK,EAAE,MAAM,CAAA;QACb,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,MAAM,GAAG,SAAS,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEtF,MAAM,MAAM,eAAe,GAAG;IAC5B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA"}
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
import type { Store } from 'effector';
|
|
2
|
-
import {
|
|
2
|
+
import { ChatHintPayload, ChatHintResponse, GetAlternativesPayload, GetAlternativesResponse, GoogleText2SpeechPayload, GoogleText2SpeechResponse, GoogleTranslatePayload, GoogleTranslateResponse, PostMessagePayload, PostMessageResponse } from './api.types';
|
|
3
3
|
import { ExtendWithOptional } from '../../../lib/helpers/types';
|
|
4
|
-
|
|
5
|
-
id: string;
|
|
6
|
-
message: string;
|
|
7
|
-
threadId: string;
|
|
8
|
-
options: ChatAnswer[];
|
|
9
|
-
isOwnMessage: boolean;
|
|
10
|
-
translatedMessage?: string;
|
|
11
|
-
endMessage?: boolean;
|
|
12
|
-
};
|
|
4
|
+
import { ChatAnswer, ConversationMessage, FullStrokeData } from './units.types';
|
|
13
5
|
export type ChatbotMessages = {
|
|
14
6
|
error: ConversationMessage;
|
|
15
7
|
start: ConversationMessage;
|
|
16
8
|
endMessage: ConversationMessage;
|
|
17
9
|
anotherHintOption: ChatAnswer;
|
|
18
10
|
};
|
|
11
|
+
export type SpotErrorPayload = {
|
|
12
|
+
strokes: FullStrokeData[];
|
|
13
|
+
};
|
|
14
|
+
export type SpotErrorResponse = {
|
|
15
|
+
strokesIds: string[];
|
|
16
|
+
};
|
|
17
|
+
export type ChatbotApiRequests = {
|
|
18
|
+
getAlternatives: (props: GetAlternativesPayload) => Promise<GetAlternativesResponse>;
|
|
19
|
+
postMessage: (props: PostMessagePayload) => Promise<PostMessageResponse>;
|
|
20
|
+
postTranslateText: (props: GoogleTranslatePayload) => Promise<GoogleTranslateResponse>;
|
|
21
|
+
postTextToSpeech: (props: GoogleText2SpeechPayload) => Promise<GoogleText2SpeechResponse>;
|
|
22
|
+
spotError: (props: SpotErrorPayload) => Promise<SpotErrorResponse>;
|
|
23
|
+
};
|
|
19
24
|
export type ChatbotModelProps = {
|
|
20
25
|
$key?: Store<string>;
|
|
21
|
-
api: {
|
|
22
|
-
|
|
23
|
-
postMessage: (props: PostMessagePayload) => Promise<PostMessageResponse>;
|
|
24
|
-
postTranslateText: (props: GoogleTranslatePayload) => Promise<GoogleTranslateResponse>;
|
|
25
|
-
postTextToSpeech: (props: GoogleText2SpeechPayload) => Promise<GoogleText2SpeechResponse>;
|
|
26
|
+
api: Omit<ChatbotApiRequests, 'postMessage'> & {
|
|
27
|
+
requestHint: (props: ChatHintPayload) => Promise<ChatHintResponse>;
|
|
26
28
|
};
|
|
27
29
|
messages: ChatbotMessages;
|
|
30
|
+
threadMessagesLimit?: number;
|
|
28
31
|
};
|
|
29
32
|
export type SendHelpParams = {
|
|
30
33
|
message: string;
|
|
@@ -32,8 +35,6 @@ export type SendHelpParams = {
|
|
|
32
35
|
};
|
|
33
36
|
export type SendHelpProps = SendHelpParams & {
|
|
34
37
|
key: string;
|
|
35
|
-
isTranslated: boolean;
|
|
36
|
-
threadId: string;
|
|
37
38
|
context: ChatbotContext | null;
|
|
38
39
|
};
|
|
39
40
|
export type SetHintMessageProps = {
|
|
@@ -55,9 +56,14 @@ export type ChatbotRenderer = {
|
|
|
55
56
|
variant: MessageVariant;
|
|
56
57
|
withTextToSpeech: boolean;
|
|
57
58
|
};
|
|
58
|
-
export type CreateMessageResponse = ExtendWithOptional<PostMessageResponse, ConversationMessage>;
|
|
59
|
+
export type CreateMessageResponse = ExtendWithOptional<Omit<PostMessageResponse, 'thread'>, ConversationMessage>;
|
|
60
|
+
type GetVisibleStrokesResponse = {
|
|
61
|
+
strokes: FullStrokeData[];
|
|
62
|
+
validationKey: string;
|
|
63
|
+
};
|
|
59
64
|
export type IChatDrawBoardAdapter = {
|
|
60
|
-
|
|
65
|
+
$strokesValidationKey: Store<string | null>;
|
|
66
|
+
getVisibleStrokes(): Promise<GetVisibleStrokesResponse | null>;
|
|
61
67
|
};
|
|
62
68
|
export type ChatbotContext = {
|
|
63
69
|
language: string;
|
|
@@ -67,4 +73,5 @@ export type ChatbotContext = {
|
|
|
67
73
|
translationTargetLanguage: string;
|
|
68
74
|
imageDescription?: string;
|
|
69
75
|
};
|
|
76
|
+
export {};
|
|
70
77
|
//# sourceMappingURL=model.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/model.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"model.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/model.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { ConversationMessage } from './model.types';
|
|
2
1
|
import { GetAlternativesResponse } from './api.types';
|
|
2
|
+
import { ConversationMessage } from './units.types';
|
|
3
3
|
export type TranslateBatchFxProps = {
|
|
4
4
|
messages: ConversationMessage[];
|
|
5
5
|
targetLanguage: string;
|
|
6
6
|
alternatives: GetAlternativesResponse | null;
|
|
7
7
|
};
|
|
8
8
|
export type TranslateMessageFxProps = {
|
|
9
|
+
preventTranslate?: boolean;
|
|
9
10
|
messages: ConversationMessage[];
|
|
10
11
|
targetLanguage: string;
|
|
11
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/translation.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"translation.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/translation.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,YAAY,EAAE,uBAAuB,CAAA;IACrC,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B,CAAA;AACD,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAA;IAC5C,WAAW,EAAE,mBAAmB,GAAG,SAAS,CAAA;CAC7C,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC5B,YAAY,EAAE;QACZ,KAAK,EAAE,MAAM,EAAE,CAAA;QACf,OAAO,EAAE,MAAM,EAAE,CAAA;KAClB,GAAG,IAAI,CAAA;CACT,CAAA;AAED,MAAM,MAAM,qBAAqB,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI;IACzE,QAAQ,EAAE,IAAI,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type Stroke = {
|
|
2
|
+
x: number[];
|
|
3
|
+
y: number[];
|
|
4
|
+
};
|
|
5
|
+
export type FullStrokeData = Stroke & {
|
|
6
|
+
id?: string;
|
|
7
|
+
};
|
|
8
|
+
export type IThreadItem = {
|
|
9
|
+
key: string | null;
|
|
10
|
+
strokes: FullStrokeData[] | null;
|
|
11
|
+
history: string[];
|
|
12
|
+
};
|
|
13
|
+
export type ChatAnswer = {
|
|
14
|
+
text: string;
|
|
15
|
+
promptKey: string;
|
|
16
|
+
translatedText?: string;
|
|
17
|
+
};
|
|
18
|
+
export type ConversationMessage = {
|
|
19
|
+
id: string;
|
|
20
|
+
message: string;
|
|
21
|
+
options: ChatAnswer[];
|
|
22
|
+
isOwnMessage: boolean;
|
|
23
|
+
translatedMessage?: string;
|
|
24
|
+
endMessage?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export type ChatItem = {
|
|
27
|
+
messages: ConversationMessage[];
|
|
28
|
+
isAvailable: boolean;
|
|
29
|
+
currentThread: IThreadItem | null;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=units.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"units.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/units.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,EAAE,MAAM,EAAE,CAAA;IACX,CAAC,EAAE,MAAM,EAAE,CAAA;CACZ,CAAA;AACD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IACpC,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IAChC,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,EAAE,WAAW,GAAG,IAAI,CAAA;CAClC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorSchemes.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/feedback/components/TeacherFeedbackButton/colorSchemes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAU,MAAM,4BAA4B,CAAA;AAEjF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"colorSchemes.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/feedback/components/TeacherFeedbackButton/colorSchemes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAU,MAAM,4BAA4B,CAAA;AAEjF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CA6DvF,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Event } from 'effector';
|
|
1
2
|
type UpdateField<T> = {
|
|
2
3
|
key: string;
|
|
3
4
|
} & ({
|
|
@@ -11,6 +12,7 @@ export declare class EntityFieldStore<T> {
|
|
|
11
12
|
readonly setField: import("effector").EventCallable<UpdateField<T>>;
|
|
12
13
|
readonly reset: import("effector").EventCallable<void>;
|
|
13
14
|
readonly $state: import("effector").StoreWritable<Record<string, T>>;
|
|
15
|
+
on<EV>(event: Event<EV>, fn: (state: Record<string, T>, payload: EV) => Record<string, T> | void): this;
|
|
14
16
|
}
|
|
15
17
|
export declare function createEntityFieldStore<T>(): EntityFieldStore<T>;
|
|
16
18
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createEntityFieldStore.d.ts","sourceRoot":"","sources":["../../../../../src/lib/effector/createEntityFieldStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createEntityFieldStore.d.ts","sourceRoot":"","sources":["../../../../../src/lib/effector/createEntityFieldStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,EAAE,MAAM,UAAU,CAAA;AAE1D,KAAK,WAAW,CAAC,CAAC,IAAI;IACpB,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,CAAC;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,EAAE,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAC;IAAC,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,IAAI,CAAA;CAAE,CAAC,CAAA;AAEnF,qBAAa,gBAAgB,CAAC,CAAC;IAC7B,SAAgB,QAAQ,mDAAgC;IACxD,SAAgB,KAAK,yCAAgB;IAErC,SAAgB,MAAM,sDAUF;IAEb,EAAE,CAAC,EAAE,EACV,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,EAChB,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,IAAI;CAK1E;AAED,wBAAgB,sBAAsB,CAAC,CAAC,yBAEvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomElements.d.ts","sourceRoot":"","sources":["../../../../../src/lib/helpers/randomElements.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,SAAe,GAAG,CAAC,EAAE,CAqB1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HighlighterIcon.d.ts","sourceRoot":"","sources":["../../../../../src/shared/icons/HighlighterIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC,wBAAgB,eAAe,CAAC,EAAE,IAAS,EAAE,KAAwB,EAAE,KAAK,EAAE,EAAE,SAAS,qBAexF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StopIcon.d.ts","sourceRoot":"","sources":["../../../../../src/shared/icons/StopIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC,wBAAgB,QAAQ,CAAC,EAAE,IAAS,EAAE,KAAwB,EAAE,KAAK,EAAE,EAAE,SAAS,qBAWjF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
1
2
|
export type IconProps = {
|
|
2
3
|
color?: string;
|
|
3
4
|
className?: string;
|
|
@@ -5,5 +6,6 @@ export type IconProps = {
|
|
|
5
6
|
strokeWidth?: string;
|
|
6
7
|
width?: number;
|
|
7
8
|
height?: number;
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
8
10
|
};
|
|
9
11
|
//# sourceMappingURL=icon.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.types.d.ts","sourceRoot":"","sources":["../../../../../src/shared/icons/icon.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;
|
|
1
|
+
{"version":3,"file":"icon.types.d.ts","sourceRoot":"","sources":["../../../../../src/shared/icons/icon.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEnD,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC7B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magmamath/students-features",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-rc.0",
|
|
4
4
|
"description": "Magmamath features library",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/commonjs/index.js",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"effector-react": "^23.2.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
+
"@magmamath/react-native-ui": "*",
|
|
24
25
|
"react": "*",
|
|
25
26
|
"react-native": "*",
|
|
26
|
-
"react-native-svg": "^15.10.0"
|
|
27
|
-
"@magmamath/react-native-ui": "*"
|
|
27
|
+
"react-native-svg": "^15.10.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@magmamath/react-native-ui": "0.
|
|
30
|
+
"@magmamath/react-native-ui": "0.4.1-rc.0",
|
|
31
31
|
"@react-native/eslint-config": "^0.73.1",
|
|
32
32
|
"@release-it/conventional-changelog": "^9.0.2",
|
|
33
33
|
"@types/jest": "^29.5.5",
|
|
@@ -64,20 +64,27 @@ export const ChatControls = ({
|
|
|
64
64
|
}}
|
|
65
65
|
variant={ButtonVariant.PRIMARY}
|
|
66
66
|
size={ButtonSize.LARGE}
|
|
67
|
-
colorScheme={ButtonColor.
|
|
67
|
+
colorScheme={ButtonColor.WHITE}
|
|
68
68
|
raiseLevel={5}
|
|
69
69
|
customColorScheme={{
|
|
70
70
|
[ButtonStates.DEFAULT]: {
|
|
71
|
-
backgroundColor:
|
|
71
|
+
backgroundColor: COLORS.NEUTRAL_1,
|
|
72
72
|
borderColor: COLORS.NEUTRAL_5,
|
|
73
73
|
raiseColor: COLORS.NEUTRAL_5,
|
|
74
|
+
color: COLORS.NEUTRAL_10,
|
|
74
75
|
},
|
|
75
76
|
[ButtonStates.PRESSED]: {
|
|
76
77
|
backgroundColor: COLORS.NEUTRAL_4,
|
|
77
78
|
borderColor: COLORS.NEUTRAL_5,
|
|
78
79
|
raiseColor: COLORS.NEUTRAL_5,
|
|
80
|
+
color: COLORS.NEUTRAL_1,
|
|
79
81
|
},
|
|
80
|
-
|
|
82
|
+
[ButtonStates.HOVER]: {
|
|
83
|
+
backgroundColor: COLORS.NEUTRAL_3,
|
|
84
|
+
borderColor: COLORS.NEUTRAL_5,
|
|
85
|
+
raiseColor: COLORS.NEUTRAL_5,
|
|
86
|
+
color: COLORS.NEUTRAL_10,
|
|
87
|
+
}}}
|
|
81
88
|
>
|
|
82
89
|
<CloseIcon />
|
|
83
90
|
</Button>
|
|
@@ -4,6 +4,7 @@ import { VariantProps } from './ChatMessage'
|
|
|
4
4
|
import { ChatbotIcon } from '../../../../shared/icons/ChatbotIcon'
|
|
5
5
|
import { MessageTextToSpeech } from './MessageTextToSpeech'
|
|
6
6
|
import { MessageVariant } from '../../types/model.types'
|
|
7
|
+
import { ErrorSpottingButton } from '../../errorSpotting/ErrorSpottingButton'
|
|
7
8
|
|
|
8
9
|
export const ReceivedMessage = ({
|
|
9
10
|
message,
|
|
@@ -13,6 +14,7 @@ export const ReceivedMessage = ({
|
|
|
13
14
|
audioStatus,
|
|
14
15
|
renderer,
|
|
15
16
|
withTextToSpeech = true,
|
|
17
|
+
withErrorSpotting,
|
|
16
18
|
}: VariantProps) => (
|
|
17
19
|
<View style={styles.container}>
|
|
18
20
|
<View style={styles.icon}>
|
|
@@ -24,6 +26,7 @@ export const ReceivedMessage = ({
|
|
|
24
26
|
{renderer
|
|
25
27
|
? renderer({ message, variant: MessageVariant.RECEIVED, withTextToSpeech })
|
|
26
28
|
: message}
|
|
29
|
+
{!!withErrorSpotting && <ErrorSpottingButton />}
|
|
27
30
|
</Text>
|
|
28
31
|
{withTextToSpeech && (
|
|
29
32
|
<MessageTextToSpeech
|
|
@@ -7,6 +7,7 @@ import { MessageLoader } from '../ChatMessage/MessageLoader'
|
|
|
7
7
|
import { Alternatives } from '../Alternatives/Alternatives'
|
|
8
8
|
import { AUDIO_CONFIG, DEFAULT_VOICE, TEXT_TO_SPEECH_CONFIG } from '../../constants'
|
|
9
9
|
import { MessageVariant, ChatbotRenderer } from '../../types/model.types'
|
|
10
|
+
import { ConversationMessage } from '../../types/units.types'
|
|
10
11
|
|
|
11
12
|
type ChatbotMessagesProps = {
|
|
12
13
|
model: ChatbotModel
|
|
@@ -26,6 +27,16 @@ const BOTTOM_OFFSET = Platform.select({
|
|
|
26
27
|
default: 294,
|
|
27
28
|
})
|
|
28
29
|
|
|
30
|
+
function findListReceivedMessage(messages: ConversationMessage[]) {
|
|
31
|
+
let i = messages.length - 1
|
|
32
|
+
while (i >= 2) {
|
|
33
|
+
const message = messages[i]
|
|
34
|
+
if (!message.isOwnMessage && !message.endMessage) return messages[i]
|
|
35
|
+
i--
|
|
36
|
+
}
|
|
37
|
+
return null
|
|
38
|
+
}
|
|
39
|
+
|
|
29
40
|
export const ChatbotMessages = ({
|
|
30
41
|
model,
|
|
31
42
|
isHintFeedback,
|
|
@@ -63,6 +74,8 @@ export const ChatbotMessages = ({
|
|
|
63
74
|
void model.sendHelpRequestFx({ message, translatedMessage })
|
|
64
75
|
}
|
|
65
76
|
|
|
77
|
+
const lastReceivedMessage = findListReceivedMessage(messages)
|
|
78
|
+
|
|
66
79
|
return (
|
|
67
80
|
<View style={[styles.container, { maxHeight: MAX_HEIGHT }]}>
|
|
68
81
|
<ScrollView
|
|
@@ -89,6 +102,7 @@ export const ChatbotMessages = ({
|
|
|
89
102
|
isTextToSpeechPending={isTextToSpeechPending}
|
|
90
103
|
variant={isOwnMessage ? MessageVariant.SENT : MessageVariant.RECEIVED}
|
|
91
104
|
withTextToSpeech={isTextToSpeechEnabled && !isOwnMessage}
|
|
105
|
+
withErrorSpotting={!isHelpRequestPending && lastReceivedMessage?.id === id}
|
|
92
106
|
/>
|
|
93
107
|
))}
|
|
94
108
|
|
|
@@ -6,6 +6,7 @@ import { ChatControls } from './ChatControls/ChatControls'
|
|
|
6
6
|
import { AUDIO_CONFIG, DEFAULT_VOICE } from '../constants'
|
|
7
7
|
import { ChatbotRenderer } from '../types/model.types'
|
|
8
8
|
import React from 'react'
|
|
9
|
+
import { ChatBotContext } from '../context/ChatBotContext'
|
|
9
10
|
|
|
10
11
|
type ChatbotProps = {
|
|
11
12
|
model: ChatbotModel
|
|
@@ -48,7 +49,7 @@ export const Chatbot = ({
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
return (
|
|
51
|
-
|
|
52
|
+
<ChatBotContext.Provider value={{ model }}>
|
|
52
53
|
<ChatbotMessages
|
|
53
54
|
model={model}
|
|
54
55
|
renderer={renderer}
|
|
@@ -67,6 +68,6 @@ export const Chatbot = ({
|
|
|
67
68
|
ButtonWrapper={ButtonWrapper}
|
|
68
69
|
iconSize={iconSize}
|
|
69
70
|
/>
|
|
70
|
-
|
|
71
|
+
</ChatBotContext.Provider>
|
|
71
72
|
)
|
|
72
73
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react'
|
|
2
|
+
import { ChatbotModel } from '../model/ChatBotModel'
|
|
3
|
+
|
|
4
|
+
type ChatBotContextProps = {
|
|
5
|
+
model: ChatbotModel
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const ChatBotContext = createContext<ChatBotContextProps | null>(null)
|
|
9
|
+
|
|
10
|
+
export function useChatModel() {
|
|
11
|
+
const context = useContext(ChatBotContext)
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
'Something went wrong, you are probably trying to use component that is supposed to be inside ChatBotContext.Provider',
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
return context.model
|
|
18
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Button, COLORS, StopIcon } from '@magmamath/react-native-ui'
|
|
3
|
+
import { useChatModel } from '../context/ChatBotContext'
|
|
4
|
+
import { useStoreMap, useUnit } from 'effector-react'
|
|
5
|
+
import { StyleSheet, View } from 'react-native'
|
|
6
|
+
import { HighlighterIcon } from '../../../shared/icons/HighlighterIcon'
|
|
7
|
+
|
|
8
|
+
export const ErrorSpottingButton = () => {
|
|
9
|
+
const model = useChatModel()
|
|
10
|
+
const activeErrorSpotting = useUnit(model.errorSpotting.$activeData)
|
|
11
|
+
const validationKey = useUnit(model.errorSpotting.$validationKey)
|
|
12
|
+
const isLoading = useUnit(model.errorSpotting.$isLoading)
|
|
13
|
+
const currentThread = useStoreMap(model.$currentChatData, (chatData) => chatData.currentThread)
|
|
14
|
+
|
|
15
|
+
if (!currentThread?.strokes) return null
|
|
16
|
+
|
|
17
|
+
const isActive = !!activeErrorSpotting?.isActive
|
|
18
|
+
return (
|
|
19
|
+
<View style={styles.container}>
|
|
20
|
+
<Button
|
|
21
|
+
style={buttonStyles}
|
|
22
|
+
disabled={validationKey !== currentThread.key}
|
|
23
|
+
isActive={isActive}
|
|
24
|
+
isLoading={isLoading}
|
|
25
|
+
variant={'secondary'}
|
|
26
|
+
colorScheme={'blue'}
|
|
27
|
+
size={'small'}
|
|
28
|
+
onPress={() => {
|
|
29
|
+
if (isLoading) return
|
|
30
|
+
model.errorSpotting.errorSpottingPressed()
|
|
31
|
+
}}
|
|
32
|
+
icon={isActive ? <StopIcon color={COLORS.NEUTRAL_1} /> : <HighlighterIcon />}
|
|
33
|
+
>
|
|
34
|
+
show error
|
|
35
|
+
</Button>
|
|
36
|
+
</View>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const buttonStyles = StyleSheet.create({
|
|
41
|
+
container: {
|
|
42
|
+
marginLeft: 'auto',
|
|
43
|
+
},
|
|
44
|
+
text: {
|
|
45
|
+
textTransform: 'uppercase',
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const styles = StyleSheet.create({
|
|
50
|
+
container: {
|
|
51
|
+
width: '100%',
|
|
52
|
+
},
|
|
53
|
+
})
|