@magmamath/students-features 0.2.22 → 0.3.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/Alternatives/Alternatives.js +8 -10
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +6 -15
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +3 -4
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +3 -2
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +4 -5
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +14 -23
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +6 -9
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/index.js +2 -2
- package/dist/commonjs/features/chatbot/index.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/{model.js → ChatBotModel.js} +83 -117
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/t2s.js +7 -4
- package/dist/commonjs/features/chatbot/model/t2s.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/translation.js +15 -30
- package/dist/commonjs/features/chatbot/model/translation.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/features/feedback/model/model.js +1 -1
- package/dist/commonjs/features/feedback/model/model.js.map +1 -1
- package/dist/commonjs/lib/effector/createEntityFieldStore.js +8 -26
- package/dist/commonjs/lib/effector/createEntityFieldStore.js.map +1 -1
- package/dist/commonjs/shared/icons/ChatbotIcon.js +106 -613
- package/dist/commonjs/shared/icons/ChatbotIcon.js.map +1 -1
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +6 -8
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +6 -15
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +3 -4
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +3 -2
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +4 -5
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +14 -23
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +6 -9
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/index.js +1 -1
- package/dist/module/features/chatbot/index.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotModel.js +208 -0
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -0
- package/dist/module/features/chatbot/model/t2s.js +8 -5
- package/dist/module/features/chatbot/model/t2s.js.map +1 -1
- package/dist/module/features/chatbot/model/translation.js +15 -30
- package/dist/module/features/chatbot/model/translation.js.map +1 -1
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/features/feedback/model/model.js +1 -1
- package/dist/module/features/feedback/model/model.js.map +1 -1
- package/dist/module/lib/effector/createEntityFieldStore.js +8 -26
- package/dist/module/lib/effector/createEntityFieldStore.js.map +1 -1
- package/dist/module/shared/icons/ChatbotIcon.js +107 -614
- package/dist/module/shared/icons/ChatbotIcon.js.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts +2 -6
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts +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 +2 -6
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +1 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/{model.d.ts → ChatBotModel.d.ts} +19 -35
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +8 -20
- 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 +1 -5
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts +4 -9
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/icons/ChatbotIcon.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts +1 -1
- package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts +2 -6
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts +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 +2 -6
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/index.d.ts +1 -1
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/{model.d.ts → ChatBotModel.d.ts} +19 -35
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts +1 -1
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/translation.d.ts +1 -1
- package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts +8 -20
- 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 +1 -5
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts +4 -9
- package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts.map +1 -1
- package/dist/typescript/module/shared/icons/ChatbotIcon.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/chatbot/components/Alternatives/Alternatives.tsx +7 -10
- package/src/features/chatbot/components/ChatControls/ChatControls.tsx +5 -10
- package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +2 -3
- package/src/features/chatbot/components/ChatMessage/MessageTextToSpeech.tsx +2 -1
- package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +3 -4
- package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +15 -24
- package/src/features/chatbot/components/Chatbot.tsx +6 -10
- package/src/features/chatbot/index.ts +1 -1
- package/src/features/chatbot/model/ChatBotModel.ts +222 -0
- package/src/features/chatbot/model/t2s.ts +8 -5
- package/src/features/chatbot/model/translation.ts +181 -201
- package/src/features/chatbot/types/model.types.ts +8 -14
- package/src/features/chatbot/types/translation.types.ts +10 -12
- package/src/features/feedback/model/model.ts +1 -1
- package/src/lib/effector/createEntityFieldStore.ts +9 -35
- package/src/shared/icons/ChatbotIcon.tsx +85 -500
- package/dist/commonjs/features/chatbot/model/model.js.map +0 -1
- package/dist/module/features/chatbot/model/model.js +0 -242
- package/dist/module/features/chatbot/model/model.js.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/model.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/model.d.ts.map +0 -1
- package/src/features/chatbot/model/model.ts +0 -268
|
@@ -18,7 +18,7 @@ export declare class ChatTextToSpeechModel {
|
|
|
18
18
|
private getCacheKey;
|
|
19
19
|
play({ text, messageId, isTranslated, config }: PlayTextToSpeechProps): Promise<void>;
|
|
20
20
|
stop(): void;
|
|
21
|
-
reset()
|
|
21
|
+
readonly reset: import("effector/effector.umd").Effect<void, void, Error>;
|
|
22
22
|
}
|
|
23
23
|
export {};
|
|
24
24
|
//# sourceMappingURL=t2s.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"t2s.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/t2s.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,
|
|
1
|
+
{"version":3,"file":"t2s.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/t2s.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,EAAU,MAAM,UAAU,CAAA;AAE9D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGlC,KAAK,0BAA0B,GAAG;IAChC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACvB,GAAG,EAAE,UAAU,CAAA;CAChB,CAAA;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAY;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IACxD,OAAO,CAAC,aAAa,CAA6B;IAElD,QAAQ,CAAC,mBAAmB,kDAA+B;IAC3D,QAAQ,CAAC,iBAAiB,kDAA0C;IACpE,QAAQ,CAAC,SAAS,gDAA6B;IAC/C,QAAQ,CAAC,OAAO,gDAA+C;gBAEnD,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,0BAA0B;IAUjD,gBAAgB,CAAC,aAAa,EAAE,aAAa;IAIpD,OAAO,CAAC,WAAW,CAElB;IAEK,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,qBAAqB;IA0DpE,IAAI;IAKX,SAAgB,KAAK,4DAInB;CACH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Effect } from 'effector';
|
|
2
|
-
import { ChatbotModel } from './
|
|
2
|
+
import { ChatbotModel } from './ChatBotModel';
|
|
3
3
|
import { TranslateAlternativesFxProps, TranslateBatchFxProps, TranslateMessageFxProps } from '../types/translation.types';
|
|
4
4
|
import { ConversationMessage } from '../types/model.types';
|
|
5
5
|
import { GetAlternativesResponse } from '../types/api.types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/translation.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,MAAM,EAAU,MAAM,UAAU,CAAA;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/translation.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,MAAM,EAAU,MAAM,UAAU,CAAA;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAG5D,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IAEpC,QAAQ,CAAC,eAAe,4CAAyB;IACjD,QAAQ,CAAC,aAAa,4CAAuC;IAE7D,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC,uBAAuB,EAAE,mBAAmB,CAAC,CAAA;IACjF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,mBAAmB,EAAE,CAAC,CAAA;IACzF,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CACtC,4BAA4B,CAAC,QAAQ,CAAC,EACtC,uBAAuB,GAAG,IAAI,CAC/B,CAAA;gBAEW,YAAY,EAAE,YAAY;IAUtC,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,iCAAiC;IAsDzC,OAAO,CAAC,4BAA4B;IAuBpC,OAAO,CAAC,0BAA0B;YAoDpB,uBAAuB;IAmB9B,KAAK;CAGb"}
|
|
@@ -8,21 +8,9 @@ export type ConversationMessage = {
|
|
|
8
8
|
isOwnMessage: boolean;
|
|
9
9
|
translatedMessage?: string;
|
|
10
10
|
};
|
|
11
|
-
export type EntityIds = {
|
|
12
|
-
entityId: string;
|
|
13
|
-
fieldId: string;
|
|
14
|
-
};
|
|
15
|
-
export type ChatMessagesModel = EntityIds & {
|
|
16
|
-
messages: ConversationMessage[];
|
|
17
|
-
};
|
|
18
|
-
export type ThreadIdsModel = EntityIds & {
|
|
19
|
-
threadId: string;
|
|
20
|
-
};
|
|
21
|
-
export type AvailableChatsModel = EntityIds & {
|
|
22
|
-
isAvailable: boolean;
|
|
23
|
-
};
|
|
24
11
|
export type ChatbotModelProps = {
|
|
25
|
-
|
|
12
|
+
$key?: Store<string>;
|
|
13
|
+
credits?: {
|
|
26
14
|
$assignmentId: Store<string>;
|
|
27
15
|
$exerciseId: Store<string>;
|
|
28
16
|
};
|
|
@@ -44,14 +32,14 @@ export type SendHelpParams = {
|
|
|
44
32
|
translatedMessage?: string;
|
|
45
33
|
};
|
|
46
34
|
export type SendHelpProps = SendHelpParams & {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
messages: Record<string, Record<string, {
|
|
50
|
-
messages: ConversationMessage[];
|
|
51
|
-
}>>;
|
|
35
|
+
key: string;
|
|
36
|
+
messages: Record<string, ConversationMessage[]>;
|
|
52
37
|
isTranslated: boolean;
|
|
53
38
|
};
|
|
54
|
-
export type SetHintMessageProps =
|
|
39
|
+
export type SetHintMessageProps = {
|
|
40
|
+
entityId: string;
|
|
41
|
+
fieldId: string;
|
|
42
|
+
} & ConversationMessage;
|
|
55
43
|
export declare enum MessageVariant {
|
|
56
44
|
SENT = "sent",
|
|
57
45
|
RECEIVED = "received"
|
|
@@ -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,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,sBAAsB,EACvB,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,
|
|
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,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,sBAAsB,EACvB,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACpB,OAAO,CAAC,EAAE;QACR,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;QAC5B,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;KAC3B,CAAA;IACD,GAAG,EAAE;QACH,eAAe,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;QACpF,WAAW,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAA;QACxE,iBAAiB,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;QACtF,gBAAgB,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAA;KAC1F,CAAA;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,mBAAmB,CAAA;QAC1B,KAAK,EAAE,mBAAmB,CAAA;KAC3B,CAAA;CACF,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,kBAAkB,CAAA;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,yBAAyB,EAAE,MAAM,CAAA;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG;IAC3C,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAA;IAC/C,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,mBAAmB,CAAA;AAEvB,oBAAY,cAAc;IACxB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { ConversationMessage } from './model.types';
|
|
2
2
|
import { GetAlternativesResponse } from './api.types';
|
|
3
3
|
export type TranslateBatchFxProps = {
|
|
4
|
-
messages:
|
|
5
|
-
messages: ConversationMessage[];
|
|
6
|
-
}>>;
|
|
7
|
-
assignmentId: string;
|
|
8
|
-
exerciseId: string;
|
|
4
|
+
messages: ConversationMessage[];
|
|
9
5
|
params: {
|
|
10
6
|
targetLanguage: string;
|
|
11
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/translation.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,MAAM,qBAAqB,GAAG;
|
|
1
|
+
{"version":3,"file":"translation.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/translation.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,MAAM,EAAE;QACN,cAAc,EAAE,MAAM,CAAA;KACvB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,mBAAmB,CAAA;IAC5B,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAA;IAC5C,MAAM,EAAE;QACN,cAAc,EAAE,MAAM,CAAA;KACvB,CAAA;CACF,CAAA"}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
type UpdateField<T> = {
|
|
2
|
-
|
|
3
|
-
fieldId: string;
|
|
2
|
+
key: string;
|
|
4
3
|
data: T;
|
|
5
4
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare function createEntityFieldStore<T, U = UpdateField<T>>({ mapper, }?: CreateEntityFieldStoreSettings<T, U>): {
|
|
10
|
-
$state: import("effector").StoreWritable<Record<string, Record<string, T>>>;
|
|
11
|
-
setField: (value: U) => void;
|
|
12
|
-
fieldAdded: import("effector").EventCallable<UpdateField<T>>;
|
|
5
|
+
export declare function createEntityFieldStore<T>(): {
|
|
6
|
+
$state: import("effector").StoreWritable<Record<string, T>>;
|
|
7
|
+
setField: import("effector").EventCallable<UpdateField<T>>;
|
|
13
8
|
reset: import("effector").EventCallable<void>;
|
|
14
9
|
};
|
|
15
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createEntityFieldStore.d.ts","sourceRoot":"","sources":["../../../../../src/lib/effector/createEntityFieldStore.ts"],"names":[],"mappings":"AAEA,KAAK,WAAW,CAAC,CAAC,IAAI;
|
|
1
|
+
{"version":3,"file":"createEntityFieldStore.d.ts","sourceRoot":"","sources":["../../../../../src/lib/effector/createEntityFieldStore.ts"],"names":[],"mappings":"AAEA,KAAK,WAAW,CAAC,CAAC,IAAI;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,CAAC,CAAA;CACR,CAAA;AAED,wBAAgB,sBAAsB,CAAC,CAAC;;;;EASvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatbotIcon.d.ts","sourceRoot":"","sources":["../../../../../src/shared/icons/ChatbotIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,eAAO,MAAM,WAAW,sBAAiC,SAAS,
|
|
1
|
+
{"version":3,"file":"ChatbotIcon.d.ts","sourceRoot":"","sources":["../../../../../src/shared/icons/ChatbotIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,eAAO,MAAM,WAAW,sBAAiC,SAAS,sBAwGjE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { useMemo } from 'react'
|
|
3
2
|
import { StyleSheet, View } from 'react-native'
|
|
4
3
|
import { useStoreMap, useUnit } from 'effector-react'
|
|
5
4
|
|
|
6
|
-
import { ChatbotModel } from '../../model/
|
|
5
|
+
import { ChatbotModel } from '../../model/ChatBotModel'
|
|
7
6
|
import { HelpRequestOption } from './HelpRequestOption'
|
|
8
7
|
|
|
9
8
|
type AlternativesProps = {
|
|
@@ -19,26 +18,24 @@ export const Alternatives = ({
|
|
|
19
18
|
hasMessages,
|
|
20
19
|
isHintFeedback,
|
|
21
20
|
}: AlternativesProps) => {
|
|
22
|
-
const
|
|
23
|
-
const exerciseId = useUnit(model.credits.$exerciseId)
|
|
21
|
+
const key = useUnit(model.$currentKey)
|
|
24
22
|
const isTranslated = useUnit(model.translation.$isTranslated)
|
|
25
23
|
const alternatives = useUnit(model.$alternatives)
|
|
26
24
|
const isTranslationPending = useUnit(model.translation.translateBatchFx.pending)
|
|
27
|
-
|
|
28
25
|
const lastMessageOptions = useStoreMap({
|
|
29
26
|
store: model.messages.$state,
|
|
30
|
-
keys: [
|
|
27
|
+
keys: [key],
|
|
31
28
|
fn: state => {
|
|
32
|
-
const lastMessage = state[
|
|
29
|
+
const lastMessage = state[key]?.at(-1)
|
|
33
30
|
return lastMessage ? lastMessage.options : []
|
|
34
31
|
},
|
|
35
32
|
})
|
|
36
33
|
|
|
37
|
-
const options =
|
|
38
|
-
if (hasMessages) return lastMessageOptions
|
|
34
|
+
const options = (() => {
|
|
35
|
+
if (hasMessages) return lastMessageOptions
|
|
39
36
|
if (isHintFeedback) return alternatives?.options.hints ?? []
|
|
40
37
|
return alternatives?.options.default ?? []
|
|
41
|
-
}
|
|
38
|
+
})()
|
|
42
39
|
|
|
43
40
|
return (
|
|
44
41
|
<View style={styles.container}>
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
COLORS,
|
|
11
11
|
} from '@magmamath/react-native-ui'
|
|
12
12
|
import { useUnit } from 'effector-react'
|
|
13
|
-
import { ChatbotModel } from '../../model/
|
|
13
|
+
import { ChatbotModel } from '../../model/ChatBotModel'
|
|
14
14
|
import { ChatbotIcon } from '../../../../shared/icons/ChatbotIcon'
|
|
15
15
|
import { GlobeIcon } from '../../../../shared/icons/GlobeIcon'
|
|
16
16
|
import { CloseIcon } from '../../../../shared/icons/CloseIcon'
|
|
@@ -22,7 +22,6 @@ type ChatControlsProps = {
|
|
|
22
22
|
onPressClose: () => void
|
|
23
23
|
isTranslationEnabled: boolean
|
|
24
24
|
ButtonWrapper: ComponentType<PropsWithChildren>
|
|
25
|
-
iconSize?: { width: number; height: number }
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
export const ChatControls = ({
|
|
@@ -32,7 +31,6 @@ export const ChatControls = ({
|
|
|
32
31
|
onPressClose,
|
|
33
32
|
isTranslationEnabled,
|
|
34
33
|
ButtonWrapper,
|
|
35
|
-
iconSize = { width: 80, height: 100 },
|
|
36
34
|
}: ChatControlsProps) => {
|
|
37
35
|
const isOpen = useUnit(model.$isOpen)
|
|
38
36
|
const isTranslated = useUnit(model.translation.$isTranslated)
|
|
@@ -40,10 +38,8 @@ export const ChatControls = ({
|
|
|
40
38
|
const isHelpRequestPending = useUnit(model.sendHelpRequestFx.pending)
|
|
41
39
|
|
|
42
40
|
if (isOpen) {
|
|
43
|
-
const backgroundColor = isTranslated ?
|
|
44
|
-
|
|
45
|
-
const translatedFillColor = isTranslated ? COLORS.NEUTRAL_1 : COLORS.NEUTRAL_9;
|
|
46
|
-
const fillColor = isHelpRequestPending ? COLORS.NEUTRAL_5 : translatedFillColor;
|
|
41
|
+
const backgroundColor = isTranslated ? '#55ABE0' : '#FFF'
|
|
42
|
+
const fillColor = isTranslated ? '#FFF' : '#4D4D63'
|
|
47
43
|
|
|
48
44
|
return (
|
|
49
45
|
<View style={styles.container}>
|
|
@@ -89,7 +85,7 @@ export const ChatControls = ({
|
|
|
89
85
|
<View style={styles.container}>
|
|
90
86
|
<ButtonWrapper>
|
|
91
87
|
<Pressable onPress={onPressChatIcon}>
|
|
92
|
-
<ChatbotIcon
|
|
88
|
+
<ChatbotIcon />
|
|
93
89
|
</Pressable>
|
|
94
90
|
</ButtonWrapper>
|
|
95
91
|
</View>
|
|
@@ -101,9 +97,8 @@ const styles = StyleSheet.create({
|
|
|
101
97
|
alignItems: 'center',
|
|
102
98
|
justifyContent: 'flex-end',
|
|
103
99
|
flexDirection: 'row',
|
|
104
|
-
|
|
100
|
+
height: 60,
|
|
105
101
|
gap: 8,
|
|
106
|
-
paddingBottom: 5,
|
|
107
102
|
},
|
|
108
103
|
buttonClose: {
|
|
109
104
|
width: 50,
|
|
@@ -6,7 +6,7 @@ import { ThreeDotsLoader } from '../ThreeDotsLoader/ThreeDotsLoader'
|
|
|
6
6
|
export const MessageLoader = () => (
|
|
7
7
|
<View style={styles.container}>
|
|
8
8
|
<View style={styles.icon}>
|
|
9
|
-
<ChatbotIcon width={
|
|
9
|
+
<ChatbotIcon width={38} height={38} />
|
|
10
10
|
</View>
|
|
11
11
|
<View style={styles.loader}>
|
|
12
12
|
<ThreeDotsLoader />
|
|
@@ -17,8 +17,7 @@ export const MessageLoader = () => (
|
|
|
17
17
|
const styles = StyleSheet.create({
|
|
18
18
|
container: {
|
|
19
19
|
flexDirection: 'row',
|
|
20
|
-
width:
|
|
21
|
-
alignItems: 'flex-end',
|
|
20
|
+
width: 305,
|
|
22
21
|
},
|
|
23
22
|
icon: {
|
|
24
23
|
alignSelf: 'flex-end',
|
|
@@ -53,9 +53,10 @@ export const MessageTextToSpeech = ({
|
|
|
53
53
|
|
|
54
54
|
const styles = StyleSheet.create({
|
|
55
55
|
container: {
|
|
56
|
-
alignSelf: '
|
|
56
|
+
alignSelf: 'flex-end',
|
|
57
57
|
justifyContent: 'flex-end',
|
|
58
58
|
width: 45,
|
|
59
|
+
height: '100%',
|
|
59
60
|
},
|
|
60
61
|
button: {
|
|
61
62
|
alignItems: 'center',
|
|
@@ -16,7 +16,7 @@ export const ReceivedMessage = ({
|
|
|
16
16
|
}: VariantProps) => (
|
|
17
17
|
<View style={styles.container}>
|
|
18
18
|
<View style={styles.icon}>
|
|
19
|
-
<ChatbotIcon width={
|
|
19
|
+
<ChatbotIcon width={38} height={38} />
|
|
20
20
|
</View>
|
|
21
21
|
|
|
22
22
|
<View style={styles.message}>
|
|
@@ -42,9 +42,8 @@ const styles = StyleSheet.create({
|
|
|
42
42
|
container: {
|
|
43
43
|
flex: 1,
|
|
44
44
|
flexDirection: 'row',
|
|
45
|
-
maxWidth:
|
|
46
|
-
width:
|
|
47
|
-
alignItems: 'flex-end',
|
|
45
|
+
maxWidth: 350,
|
|
46
|
+
width: 350,
|
|
48
47
|
},
|
|
49
48
|
icon: {
|
|
50
49
|
alignSelf: 'flex-end',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode, useRef } from 'react'
|
|
2
2
|
import { Platform, ScrollView, StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
3
3
|
import { useStoreMap, useUnit } from 'effector-react'
|
|
4
|
-
import { ChatbotModel } from '../../model/
|
|
4
|
+
import { ChatbotModel } from '../../model/ChatBotModel'
|
|
5
5
|
import { ChatMessage } from '../ChatMessage/ChatMessage'
|
|
6
6
|
import { MessageLoader } from '../ChatMessage/MessageLoader'
|
|
7
7
|
import { Alternatives } from '../Alternatives/Alternatives'
|
|
@@ -25,8 +25,8 @@ type ChatbotMessagesProps = {
|
|
|
25
25
|
|
|
26
26
|
const TOOLBAR_HEIGHT = 140
|
|
27
27
|
const BOTTOM_OFFSET = Platform.select({
|
|
28
|
-
web:
|
|
29
|
-
default:
|
|
28
|
+
web: 250,
|
|
29
|
+
default: 284,
|
|
30
30
|
})
|
|
31
31
|
|
|
32
32
|
export const ChatbotMessages = ({
|
|
@@ -41,8 +41,7 @@ export const ChatbotMessages = ({
|
|
|
41
41
|
}: ChatbotMessagesProps) => {
|
|
42
42
|
const dimensions = useWindowDimensions()
|
|
43
43
|
const ref = useRef<ScrollView>(null)
|
|
44
|
-
const
|
|
45
|
-
const exerciseId = useUnit(model.credits.$exerciseId)
|
|
44
|
+
const currentKey = useUnit(model.$currentKey)
|
|
46
45
|
const isOpen = useUnit(model.$isOpen)
|
|
47
46
|
|
|
48
47
|
const isHelpRequestPending = useUnit(model.sendHelpRequestFx.pending)
|
|
@@ -56,30 +55,22 @@ export const ChatbotMessages = ({
|
|
|
56
55
|
|
|
57
56
|
const messages = useStoreMap({
|
|
58
57
|
store: model.messages.$state,
|
|
59
|
-
keys: [
|
|
60
|
-
fn: state => state[
|
|
58
|
+
keys: [currentKey],
|
|
59
|
+
fn: state => state[currentKey] ?? [],
|
|
61
60
|
})
|
|
62
61
|
|
|
63
62
|
const playTextToSpeech = (id: string, message: string, translatedMessage?: string) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
} else {
|
|
72
|
-
model.t2s.play({
|
|
73
|
-
text: sanitizeSpeechInput(message),
|
|
74
|
-
messageId: id,
|
|
75
|
-
isTranslated: false,
|
|
76
|
-
config: textToSpeechConfig ?? TEXT_TO_SPEECH_CONFIG,
|
|
77
|
-
})
|
|
78
|
-
}
|
|
63
|
+
const text = isTranslated ? (translatedMessage as string) : message
|
|
64
|
+
void model.t2s.play({
|
|
65
|
+
text: sanitizeSpeechInput(text),
|
|
66
|
+
messageId: id,
|
|
67
|
+
isTranslated,
|
|
68
|
+
config: textToSpeechConfig ?? TEXT_TO_SPEECH_CONFIG,
|
|
69
|
+
})
|
|
79
70
|
}
|
|
80
71
|
|
|
81
72
|
const askChatForHelp = (message: string, promptKey: string, translatedMessage?: string) => {
|
|
82
|
-
model.sendHelpRequestFx({
|
|
73
|
+
void model.sendHelpRequestFx({
|
|
83
74
|
payload: { ...sendHelpRequestPayload, type: promptKey },
|
|
84
75
|
message,
|
|
85
76
|
translatedMessage,
|
|
@@ -137,7 +128,7 @@ const styles = StyleSheet.create({
|
|
|
137
128
|
container: {
|
|
138
129
|
flex: 1,
|
|
139
130
|
alignItems: 'flex-end',
|
|
140
|
-
width:
|
|
131
|
+
width: 350,
|
|
141
132
|
height: '100%',
|
|
142
133
|
},
|
|
143
134
|
list: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ComponentType, PropsWithChildren, ReactNode
|
|
1
|
+
import { ComponentType, PropsWithChildren, ReactNode } from 'react'
|
|
2
2
|
import { useStoreMap, useUnit } from 'effector-react'
|
|
3
|
-
import { ChatbotModel } from '../model/
|
|
3
|
+
import { ChatbotModel } from '../model/ChatBotModel'
|
|
4
4
|
import { ChatbotMessages } from './ChatMessages/ChatbotMessages'
|
|
5
5
|
import { ChatControls } from './ChatControls/ChatControls'
|
|
6
6
|
import { PostMessagePayload } from '../types/api.types'
|
|
@@ -22,7 +22,6 @@ type ChatbotProps = {
|
|
|
22
22
|
}
|
|
23
23
|
ButtonWrapper: ComponentType<PropsWithChildren>
|
|
24
24
|
renderer?: (props: ChatbotRenderer) => ReactNode
|
|
25
|
-
iconSize?: { width: number; height: number } // TODO: use number instead
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
export const Chatbot = ({
|
|
@@ -36,20 +35,18 @@ export const Chatbot = ({
|
|
|
36
35
|
isTranslationEnabled,
|
|
37
36
|
renderer,
|
|
38
37
|
ButtonWrapper,
|
|
39
|
-
iconSize,
|
|
40
38
|
}: ChatbotProps) => {
|
|
41
|
-
const
|
|
42
|
-
const exerciseId = useUnit(model.credits.$exerciseId)
|
|
39
|
+
const currentKey = useUnit(model.$currentKey)
|
|
43
40
|
const alternatives = useUnit(model.$alternatives)
|
|
44
41
|
|
|
45
42
|
const isAvailable = useStoreMap({
|
|
46
43
|
store: model.availableChats.$state,
|
|
47
|
-
keys: [
|
|
48
|
-
fn: state => !!state[
|
|
44
|
+
keys: [currentKey],
|
|
45
|
+
fn: state => !!state[currentKey],
|
|
49
46
|
})
|
|
50
47
|
|
|
51
48
|
const translateMessages = () => {
|
|
52
|
-
model.translation.translateBatchFx({
|
|
49
|
+
void model.translation.translateBatchFx({
|
|
53
50
|
targetLanguage: translationTargetLanguage,
|
|
54
51
|
})
|
|
55
52
|
}
|
|
@@ -81,7 +78,6 @@ export const Chatbot = ({
|
|
|
81
78
|
onPressClose={closeChat}
|
|
82
79
|
isTranslationEnabled={isTranslationEnabled}
|
|
83
80
|
ButtonWrapper={ButtonWrapper}
|
|
84
|
-
iconSize={iconSize}
|
|
85
81
|
/>
|
|
86
82
|
</>
|
|
87
83
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Chatbot } from './components/Chatbot'
|
|
2
|
-
export { ChatbotModel } from './model/
|
|
2
|
+
export { ChatbotModel } from './model/ChatBotModel'
|
|
3
3
|
export { AudioStatus, type AudioProvider } from './types/t2s.types'
|
|
4
4
|
export { MessageVariant, type ConversationMessage, type ChatbotRenderer } from './types/model.types'
|