@magmamath/students-features 0.3.0-rc.9 → 0.3.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 +6 -9
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +13 -5
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +4 -3
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +2 -3
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +5 -4
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +6 -9
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +8 -9
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +70 -88
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/api.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/messagesHelper.js +46 -0
- package/dist/commonjs/features/chatbot/model/messagesHelper.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/translation.helpers.js +69 -0
- package/dist/commonjs/features/chatbot/model/translation.helpers.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/translation.js +106 -135
- 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/index.js +9 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/lib/helpers/types.js +2 -0
- package/dist/commonjs/lib/helpers/types.js.map +1 -0
- package/dist/commonjs/shared/icons/ChatbotIcon.js +613 -106
- package/dist/commonjs/shared/icons/ChatbotIcon.js.map +1 -1
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +6 -9
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +13 -5
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +4 -3
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +2 -3
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +5 -4
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +6 -9
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +8 -9
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/index.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotModel.js +71 -89
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/api.js.map +1 -1
- package/dist/module/features/chatbot/model/messagesHelper.js +41 -0
- package/dist/module/features/chatbot/model/messagesHelper.js.map +1 -0
- package/dist/module/features/chatbot/model/translation.helpers.js +63 -0
- package/dist/module/features/chatbot/model/translation.helpers.js.map +1 -0
- package/dist/module/features/chatbot/model/translation.js +107 -136
- 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/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/helpers/types.js +2 -0
- package/dist/module/lib/helpers/types.js.map +1 -0
- package/dist/module/shared/icons/ChatbotIcon.js +614 -107
- package/dist/module/shared/icons/ChatbotIcon.js.map +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 +5 -1
- 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.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +5 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +2 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +12 -6
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/api.d.ts +5 -7
- package/dist/typescript/commonjs/features/chatbot/model/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts +21 -0
- package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts +9 -9
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts +10 -0
- package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +1 -0
- 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 +6 -3
- 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 +20 -5
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/index.d.ts +1 -0
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/helpers/types.d.ts +2 -0
- package/dist/typescript/commonjs/lib/helpers/types.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/ChatbotIcon.d.ts.map +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 +5 -1
- 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.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +5 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/index.d.ts +2 -1
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +12 -6
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/api.d.ts +5 -7
- package/dist/typescript/module/features/chatbot/model/api.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts +21 -0
- package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/translation.d.ts +9 -9
- package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts +10 -0
- package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +1 -0
- 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 +6 -3
- 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 +20 -5
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/module/index.d.ts +1 -0
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/dist/typescript/module/lib/helpers/types.d.ts +2 -0
- package/dist/typescript/module/lib/helpers/types.d.ts.map +1 -0
- 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 +4 -9
- package/src/features/chatbot/components/ChatControls/ChatControls.tsx +6 -3
- package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +3 -2
- package/src/features/chatbot/components/ChatMessage/MessageTextToSpeech.tsx +1 -2
- package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +4 -3
- package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +4 -9
- package/src/features/chatbot/components/Chatbot.tsx +5 -8
- package/src/features/chatbot/index.ts +7 -1
- package/src/features/chatbot/model/ChatBotModel.ts +63 -88
- package/src/features/chatbot/model/api.ts +24 -33
- package/src/features/chatbot/model/messagesHelper.ts +48 -0
- package/src/features/chatbot/model/translation.helpers.ts +58 -0
- package/src/features/chatbot/model/translation.ts +112 -160
- package/src/features/chatbot/types/api.types.ts +1 -0
- package/src/features/chatbot/types/model.types.ts +7 -3
- package/src/features/chatbot/types/translation.types.ts +21 -5
- package/src/index.ts +1 -0
- package/src/lib/helpers/types.ts +1 -0
- package/src/shared/icons/ChatbotIcon.tsx +500 -85
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ConversationMessage, CreateMessageResponse } from '../types/model.types';
|
|
2
|
+
type OwnMessageProps = {
|
|
3
|
+
message?: string;
|
|
4
|
+
translatedMessage?: string;
|
|
5
|
+
threadId?: string | null;
|
|
6
|
+
};
|
|
7
|
+
export declare class messagesHelper {
|
|
8
|
+
static createAnswer(data: CreateMessageResponse): ConversationMessage;
|
|
9
|
+
static createLast(data: CreateMessageResponse): {
|
|
10
|
+
id: string;
|
|
11
|
+
message: string;
|
|
12
|
+
translatedMessage: string | undefined;
|
|
13
|
+
isOwnMessage: boolean;
|
|
14
|
+
options: never[];
|
|
15
|
+
threadId: string;
|
|
16
|
+
endMessage: boolean;
|
|
17
|
+
};
|
|
18
|
+
static createOwn({ message, translatedMessage, threadId, }: OwnMessageProps): ConversationMessage;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=messagesHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagesHelper.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/messagesHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAEjF,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,qBAAa,cAAc;WACX,YAAY,CAAC,IAAI,EAAE,qBAAqB,GAAG,mBAAmB;WAW9D,UAAU,CAAC,IAAI,EAAE,qBAAqB;;;;;;;;;WAYtC,SAAS,CAAC,EACtB,OAAY,EACZ,iBAAiB,EACjB,QAAQ,GACT,EAAE,eAAe,GAAG,mBAAmB;CAUzC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { EventCallable, Store } from 'effector';
|
|
2
|
+
import { TranslateMessageFxProps } from '../types/translation.types';
|
|
3
3
|
import { ChatbotModelProps, ConversationMessage } from '../types/model.types';
|
|
4
4
|
import { GetAlternativesResponse } from '../types/api.types';
|
|
5
5
|
import { ChatbotAPI } from './api';
|
|
@@ -22,16 +22,16 @@ export declare class ChatbotTranslation {
|
|
|
22
22
|
private readonly alternativesModel;
|
|
23
23
|
readonly setIsTranslated: EventCallable<boolean>;
|
|
24
24
|
readonly $isTranslated: import("effector").StoreWritable<boolean>;
|
|
25
|
-
readonly
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
readonly translateAllMessagesFx: import("effector").Effect<{
|
|
26
|
+
targetLanguage: string;
|
|
27
|
+
}, ConversationMessage[], Error>;
|
|
28
28
|
constructor({ api, $key, defaultMessages, messagesModel, alternativesModel, }: ChatbotTranslationProps);
|
|
29
29
|
private shouldSkipTranslation;
|
|
30
30
|
private initTranslationSamples;
|
|
31
|
-
private
|
|
32
|
-
private
|
|
33
|
-
private
|
|
34
|
-
|
|
31
|
+
private translateRequest;
|
|
32
|
+
private addTranslationToAlternatives;
|
|
33
|
+
private readonly translateBatchFx;
|
|
34
|
+
readonly translateMessagesFx: import("effector").Effect<TranslateMessageFxProps, ConversationMessage[], Error>;
|
|
35
35
|
reset(): void;
|
|
36
36
|
}
|
|
37
37
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/translation.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAA;AAO/E,KAAK,uBAAuB,GAAG;IAC7B,GAAG,EAAE,UAAU,CAAA;IACf,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACnB,eAAe,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAA;IAC9C,aAAa,EAAE,gBAAgB,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACtD,iBAAiB,EAAE;QACjB,GAAG,EAAE,aAAa,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAA;QAClD,MAAM,EAAE,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAA;KAC9C,CAAA;CACF,CAAA;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAA;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAA;IACrB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAA;IAChC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAA;IAC9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAA;IAElC,QAAQ,CAAC,eAAe,yBAAyB;IACjD,QAAQ,CAAC,aAAa,4CAAuC;IAE7D,QAAQ,CAAC,sBAAsB;;qCAAA;gBAEnB,EACV,GAAG,EACH,IAAI,EACJ,eAAe,EACf,aAAa,EACb,iBAAiB,GAClB,EAAE,uBAAuB;IAmB1B,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,sBAAsB;YAShB,gBAAgB;IAmB9B,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAkDhC;IAED,SAAgB,mBAAmB,mFA0BlC;IAEM,KAAK;CAGb"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AddTranslationToAlternativesProps, GetOptionsProps, GetOptionsResult } from '../types/translation.types';
|
|
2
|
+
import { ChatAnswer, GetAlternativesResponse } from '../types/api.types';
|
|
3
|
+
export declare function getOptionsForTranslation({ lastMessage, alternatives, }: GetOptionsProps): GetOptionsResult;
|
|
4
|
+
export declare function addTranslationsToAlternative({ alternatives, translatedHints, translatedDefaults, }: AddTranslationToAlternativesProps): GetAlternativesResponse;
|
|
5
|
+
export declare function addTranslationToOptions(options: ChatAnswer[], translations: string[]): {
|
|
6
|
+
translatedText: string;
|
|
7
|
+
text: string;
|
|
8
|
+
promptKey: string;
|
|
9
|
+
}[];
|
|
10
|
+
//# sourceMappingURL=translation.helpers.d.ts.map
|
|
@@ -0,0 +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,UAAU,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAExE,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/api.types.ts"],"names":[],"mappings":"AAAA,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,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,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,cAAc,EAAE;QAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,UAAU,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"api.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/api.types.ts"],"names":[],"mappings":"AAAA,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,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,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,cAAc,EAAE;QAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Store } from 'effector';
|
|
2
2
|
import { GetAlternativesResponse, PostMessagePayload, PostMessageResponse, GoogleTranslatePayload, GoogleTranslateResponse, GoogleText2SpeechPayload, GoogleText2SpeechResponse, ChatAnswer, GetAlternativesPayload } from './api.types';
|
|
3
|
+
import { AccomplishTo } from '../../../lib/helpers/types';
|
|
3
4
|
export type ConversationMessage = {
|
|
4
5
|
id: string;
|
|
5
6
|
message: string;
|
|
@@ -7,6 +8,7 @@ export type ConversationMessage = {
|
|
|
7
8
|
options: ChatAnswer[];
|
|
8
9
|
isOwnMessage: boolean;
|
|
9
10
|
translatedMessage?: string;
|
|
11
|
+
endMessage?: boolean;
|
|
10
12
|
};
|
|
11
13
|
export type ChatbotModelProps = {
|
|
12
14
|
$key?: Store<string>;
|
|
@@ -19,6 +21,8 @@ export type ChatbotModelProps = {
|
|
|
19
21
|
messages: {
|
|
20
22
|
error: ConversationMessage;
|
|
21
23
|
start: ConversationMessage;
|
|
24
|
+
endMessage: ConversationMessage;
|
|
25
|
+
anotherHintOption: ChatAnswer;
|
|
22
26
|
};
|
|
23
27
|
};
|
|
24
28
|
export type SendHelpParams = {
|
|
@@ -29,12 +33,10 @@ export type SendHelpParams = {
|
|
|
29
33
|
};
|
|
30
34
|
export type SendHelpProps = SendHelpParams & {
|
|
31
35
|
key: string;
|
|
32
|
-
messages: Record<string, ConversationMessage[]>;
|
|
33
36
|
isTranslated: boolean;
|
|
34
37
|
};
|
|
35
38
|
export type SetHintMessageProps = {
|
|
36
|
-
|
|
37
|
-
fieldId: string;
|
|
39
|
+
key: string;
|
|
38
40
|
} & ConversationMessage;
|
|
39
41
|
export type StartConversationFxData = {
|
|
40
42
|
key: string;
|
|
@@ -49,4 +51,5 @@ export type ChatbotRenderer = {
|
|
|
49
51
|
variant: MessageVariant;
|
|
50
52
|
withTextToSpeech: boolean;
|
|
51
53
|
};
|
|
54
|
+
export type CreateMessageResponse = AccomplishTo<PostMessageResponse, ConversationMessage>;
|
|
52
55
|
//# 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,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,sBAAsB,EACvB,MAAM,aAAa,CAAA;
|
|
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;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD,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;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACpB,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;QAC1B,UAAU,EAAE,mBAAmB,CAAA;QAC/B,iBAAiB,EAAE,UAAU,CAAA;KAC9B,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,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,mBAAmB,CAAA;AAEvB,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,mBAAmB,EAAE,CAAA;CAChC,CAAA;AAED,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;AAED,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAA"}
|
|
@@ -5,15 +5,30 @@ export type TranslateBatchFxProps = {
|
|
|
5
5
|
params: {
|
|
6
6
|
targetLanguage: string;
|
|
7
7
|
};
|
|
8
|
+
alternatives: GetAlternativesResponse | null;
|
|
8
9
|
};
|
|
9
10
|
export type TranslateMessageFxProps = {
|
|
10
|
-
|
|
11
|
+
messages: ConversationMessage[];
|
|
11
12
|
targetLanguage: string;
|
|
12
13
|
};
|
|
13
|
-
export type
|
|
14
|
+
export type AddTranslationToAlternativesProps = {
|
|
15
|
+
alternatives: GetAlternativesResponse;
|
|
16
|
+
translatedHints: string[];
|
|
17
|
+
translatedDefaults: string[];
|
|
18
|
+
};
|
|
19
|
+
export type GetOptionsProps = {
|
|
14
20
|
alternatives: GetAlternativesResponse | null;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
lastMessage: ConversationMessage | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type GetOptionsResult = {
|
|
24
|
+
lastMessage: string[] | null;
|
|
25
|
+
alternatives: {
|
|
26
|
+
hints: string[];
|
|
27
|
+
default: string[];
|
|
28
|
+
} | null;
|
|
29
|
+
};
|
|
30
|
+
export type TranslateRequestProps<List extends Record<string, string[]>> = {
|
|
31
|
+
textList: List;
|
|
32
|
+
targetLanguage: string;
|
|
18
33
|
};
|
|
19
34
|
//# sourceMappingURL=translation.types.d.ts.map
|
|
@@ -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;IAClC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,MAAM,EAAE;QACN,cAAc,EAAE,MAAM,CAAA;KACvB,CAAA;
|
|
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;IACD,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { useFeaturesLocalization, setFeaturesLocalization, Locale } from './shared/translation';
|
|
2
2
|
export type { LocalizationConfig } from './shared/translation';
|
|
3
|
+
export { generateRandomId } from './lib/helpers/helpers';
|
|
3
4
|
export * from './features/chatbot';
|
|
4
5
|
export * from './features/feedback';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC/F,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC/F,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/helpers/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA"}
|
|
@@ -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,sBAugBjE,CAAA"}
|
package/package.json
CHANGED
|
@@ -18,17 +18,12 @@ export const Alternatives = ({
|
|
|
18
18
|
hasMessages,
|
|
19
19
|
isHintFeedback,
|
|
20
20
|
}: AlternativesProps) => {
|
|
21
|
-
const key = useUnit(model.$currentKey)
|
|
22
21
|
const isTranslated = useUnit(model.translation.$isTranslated)
|
|
23
22
|
const alternatives = useUnit(model.$alternatives)
|
|
24
|
-
const isTranslationPending = useUnit(model.translation.
|
|
25
|
-
const lastMessageOptions = useStoreMap({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
fn: (state) => {
|
|
29
|
-
const lastMessage = state[key]?.at(-1)
|
|
30
|
-
return lastMessage ? lastMessage.options : []
|
|
31
|
-
},
|
|
23
|
+
const isTranslationPending = useUnit(model.translation.translateAllMessagesFx.pending)
|
|
24
|
+
const lastMessageOptions = useStoreMap(model.$currentChatData, ({ messages }) => {
|
|
25
|
+
const lastMessage = messages.at(-1)
|
|
26
|
+
return lastMessage?.options ?? []
|
|
32
27
|
})
|
|
33
28
|
|
|
34
29
|
const options = (() => {
|
|
@@ -22,6 +22,7 @@ type ChatControlsProps = {
|
|
|
22
22
|
onPressClose: () => void
|
|
23
23
|
isTranslationEnabled: boolean
|
|
24
24
|
ButtonWrapper: ComponentType<PropsWithChildren>
|
|
25
|
+
iconSize?: { width: number; height: number }
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export const ChatControls = ({
|
|
@@ -31,10 +32,11 @@ export const ChatControls = ({
|
|
|
31
32
|
onPressClose,
|
|
32
33
|
isTranslationEnabled,
|
|
33
34
|
ButtonWrapper,
|
|
35
|
+
iconSize = { width: 80, height: 100 },
|
|
34
36
|
}: ChatControlsProps) => {
|
|
35
37
|
const isOpen = useUnit(model.$isOpen)
|
|
36
38
|
const isTranslated = useUnit(model.translation.$isTranslated)
|
|
37
|
-
const isTranslationPending = useUnit(model.translation.
|
|
39
|
+
const isTranslationPending = useUnit(model.translation.translateAllMessagesFx.pending)
|
|
38
40
|
const isHelpRequestPending = useUnit(model.sendHelpRequestFx.pending)
|
|
39
41
|
|
|
40
42
|
if (isOpen) {
|
|
@@ -85,7 +87,7 @@ export const ChatControls = ({
|
|
|
85
87
|
<View style={styles.container}>
|
|
86
88
|
<ButtonWrapper>
|
|
87
89
|
<Pressable onPress={onPressChatIcon}>
|
|
88
|
-
<ChatbotIcon />
|
|
90
|
+
<ChatbotIcon width={iconSize?.width} height={iconSize?.height} />
|
|
89
91
|
</Pressable>
|
|
90
92
|
</ButtonWrapper>
|
|
91
93
|
</View>
|
|
@@ -97,8 +99,9 @@ const styles = StyleSheet.create({
|
|
|
97
99
|
alignItems: 'center',
|
|
98
100
|
justifyContent: 'flex-end',
|
|
99
101
|
flexDirection: 'row',
|
|
100
|
-
|
|
102
|
+
maxHeight: 100,
|
|
101
103
|
gap: 8,
|
|
104
|
+
paddingBottom: 5,
|
|
102
105
|
},
|
|
103
106
|
buttonClose: {
|
|
104
107
|
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={60} height={80} />
|
|
10
10
|
</View>
|
|
11
11
|
<View style={styles.loader}>
|
|
12
12
|
<ThreeDotsLoader />
|
|
@@ -17,7 +17,8 @@ export const MessageLoader = () => (
|
|
|
17
17
|
const styles = StyleSheet.create({
|
|
18
18
|
container: {
|
|
19
19
|
flexDirection: 'row',
|
|
20
|
-
width:
|
|
20
|
+
width: 327,
|
|
21
|
+
alignItems: 'flex-end',
|
|
21
22
|
},
|
|
22
23
|
icon: {
|
|
23
24
|
alignSelf: 'flex-end',
|
|
@@ -53,10 +53,9 @@ export const MessageTextToSpeech = ({
|
|
|
53
53
|
|
|
54
54
|
const styles = StyleSheet.create({
|
|
55
55
|
container: {
|
|
56
|
-
alignSelf: '
|
|
56
|
+
alignSelf: 'stretch',
|
|
57
57
|
justifyContent: 'flex-end',
|
|
58
58
|
width: 45,
|
|
59
|
-
height: '100%',
|
|
60
59
|
},
|
|
61
60
|
button: {
|
|
62
61
|
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={60} height={80} />
|
|
20
20
|
</View>
|
|
21
21
|
|
|
22
22
|
<View style={styles.message}>
|
|
@@ -42,8 +42,9 @@ const styles = StyleSheet.create({
|
|
|
42
42
|
container: {
|
|
43
43
|
flex: 1,
|
|
44
44
|
flexDirection: 'row',
|
|
45
|
-
maxWidth:
|
|
46
|
-
width:
|
|
45
|
+
maxWidth: 372,
|
|
46
|
+
width: 372,
|
|
47
|
+
alignItems: 'flex-end',
|
|
47
48
|
},
|
|
48
49
|
icon: {
|
|
49
50
|
alignSelf: 'flex-end',
|
|
@@ -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: 265,
|
|
29
|
+
default: 294,
|
|
30
30
|
})
|
|
31
31
|
|
|
32
32
|
export const ChatbotMessages = ({
|
|
@@ -41,7 +41,6 @@ export const ChatbotMessages = ({
|
|
|
41
41
|
}: ChatbotMessagesProps) => {
|
|
42
42
|
const dimensions = useWindowDimensions()
|
|
43
43
|
const ref = useRef<ScrollView>(null)
|
|
44
|
-
const currentKey = useUnit(model.$currentKey)
|
|
45
44
|
const isOpen = useUnit(model.$isOpen)
|
|
46
45
|
|
|
47
46
|
const isHelpRequestPending = useUnit(model.sendHelpRequestFx.pending)
|
|
@@ -53,11 +52,7 @@ export const ChatbotMessages = ({
|
|
|
53
52
|
|
|
54
53
|
const MAX_HEIGHT = dimensions.height - TOOLBAR_HEIGHT - BOTTOM_OFFSET
|
|
55
54
|
|
|
56
|
-
const messages = useStoreMap({
|
|
57
|
-
store: model.messages.$state,
|
|
58
|
-
keys: [currentKey],
|
|
59
|
-
fn: state => state[currentKey] ?? [],
|
|
60
|
-
})
|
|
55
|
+
const messages = useStoreMap(model.$currentChatData, ({ messages }) => messages)
|
|
61
56
|
|
|
62
57
|
const playTextToSpeech = (id: string, message: string, translatedMessage?: string) => {
|
|
63
58
|
const text = isTranslated ? (translatedMessage as string) : message
|
|
@@ -128,7 +123,7 @@ const styles = StyleSheet.create({
|
|
|
128
123
|
container: {
|
|
129
124
|
flex: 1,
|
|
130
125
|
alignItems: 'flex-end',
|
|
131
|
-
width:
|
|
126
|
+
width: 372,
|
|
132
127
|
height: '100%',
|
|
133
128
|
},
|
|
134
129
|
list: {
|
|
@@ -22,6 +22,7 @@ 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
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export const Chatbot = ({
|
|
@@ -35,18 +36,13 @@ export const Chatbot = ({
|
|
|
35
36
|
isTranslationEnabled,
|
|
36
37
|
renderer,
|
|
37
38
|
ButtonWrapper,
|
|
39
|
+
iconSize,
|
|
38
40
|
}: ChatbotProps) => {
|
|
39
|
-
const currentKey = useUnit(model.$currentKey)
|
|
40
41
|
const alternatives = useUnit(model.$alternatives)
|
|
41
|
-
|
|
42
|
-
const isAvailable = useStoreMap({
|
|
43
|
-
store: model.availableChats.$state,
|
|
44
|
-
keys: [currentKey],
|
|
45
|
-
fn: state => !!state[currentKey],
|
|
46
|
-
})
|
|
42
|
+
const isAvailable = useStoreMap(model.$currentChatData, ({ isAvailable }) => isAvailable)
|
|
47
43
|
|
|
48
44
|
const translateMessages = () => {
|
|
49
|
-
void model.translation.
|
|
45
|
+
void model.translation.translateAllMessagesFx({
|
|
50
46
|
targetLanguage: translationTargetLanguage,
|
|
51
47
|
})
|
|
52
48
|
}
|
|
@@ -78,6 +74,7 @@ export const Chatbot = ({
|
|
|
78
74
|
onPressClose={closeChat}
|
|
79
75
|
isTranslationEnabled={isTranslationEnabled}
|
|
80
76
|
ButtonWrapper={ButtonWrapper}
|
|
77
|
+
iconSize={iconSize}
|
|
81
78
|
/>
|
|
82
79
|
</>
|
|
83
80
|
)
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export { Chatbot } from './components/Chatbot'
|
|
2
2
|
export { ChatbotModel } from './model/ChatBotModel'
|
|
3
3
|
export { AudioStatus, type AudioProvider } from './types/t2s.types'
|
|
4
|
-
export {
|
|
4
|
+
export {
|
|
5
|
+
MessageVariant,
|
|
6
|
+
type ConversationMessage,
|
|
7
|
+
type ChatbotRenderer,
|
|
8
|
+
type ChatbotModelProps,
|
|
9
|
+
} from './types/model.types'
|
|
10
|
+
export type { PostMessageResponse, ChatAnswer } from './types/api.types'
|