@magmamath/students-features 0.3.0-rc.8 → 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 +83 -91
- 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/t2s.js +1 -2
- package/dist/commonjs/features/chatbot/model/t2s.js.map +1 -1
- 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 +121 -140
- 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/effector/createEntityFieldStore.js +14 -13
- package/dist/commonjs/lib/effector/createEntityFieldStore.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 +84 -92
- 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/t2s.js +1 -2
- package/dist/module/features/chatbot/model/t2s.js.map +1 -1
- 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 +122 -141
- 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/effector/createEntityFieldStore.js +12 -13
- package/dist/module/lib/effector/createEntityFieldStore.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 +15 -45
- 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/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 +30 -13
- 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/effector/createEntityFieldStore.d.ts +6 -5
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.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 +15 -45
- 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/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 +30 -13
- 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/effector/createEntityFieldStore.d.ts +6 -5
- package/dist/typescript/module/lib/effector/createEntityFieldStore.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 +81 -98
- package/src/features/chatbot/model/api.ts +24 -33
- package/src/features/chatbot/model/messagesHelper.ts +48 -0
- package/src/features/chatbot/model/t2s.ts +1 -2
- package/src/features/chatbot/model/translation.helpers.ts +58 -0
- package/src/features/chatbot/model/translation.ts +147 -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/effector/createEntityFieldStore.ts +11 -9
- package/src/lib/helpers/types.ts +1 -0
- package/src/shared/icons/ChatbotIcon.tsx +500 -85
|
@@ -1,5 +1,6 @@
|
|
|
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 { MessageVariant, type ConversationMessage, type ChatbotRenderer } from './types/model.types';
|
|
4
|
+
export { MessageVariant, type ConversationMessage, type ChatbotRenderer, type ChatbotModelProps, } from './types/model.types';
|
|
5
|
+
export type { PostMessageResponse, ChatAnswer } from './types/api.types';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/chatbot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/chatbot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type Store
|
|
1
|
+
import { type Store } from 'effector';
|
|
2
2
|
import { ChatbotModelProps, ConversationMessage, SendHelpParams, SetHintMessageProps } from '../types/model.types';
|
|
3
|
-
import { GetAlternativesResponse
|
|
3
|
+
import { GetAlternativesResponse } from '../types/api.types';
|
|
4
4
|
import { ChatbotAPI } from './api';
|
|
5
5
|
import { ChatbotTranslation } from './translation';
|
|
6
6
|
import { ChatTextToSpeechModel } from './t2s';
|
|
@@ -24,53 +24,23 @@ export declare class ChatbotModel {
|
|
|
24
24
|
readonly $lastMessageKey: import("effector").StoreWritable<string | null>;
|
|
25
25
|
readonly setScrollActive: import("effector").EventCallable<boolean>;
|
|
26
26
|
readonly $isScrollActive: import("effector").StoreWritable<boolean>;
|
|
27
|
-
readonly sendHelpRequestFx: Effect<SendHelpParams,
|
|
27
|
+
readonly sendHelpRequestFx: import("effector").Effect<SendHelpParams, void, Error>;
|
|
28
28
|
readonly defaultMessages: ChatbotModelProps['messages'];
|
|
29
|
+
readonly messages: import("../../../lib/effector/createEntityFieldStore").EntityFieldStore<ConversationMessage[]>;
|
|
30
|
+
readonly threadIds: import("../../../lib/effector/createEntityFieldStore").EntityFieldStore<string>;
|
|
31
|
+
readonly availableChats: import("../../../lib/effector/createEntityFieldStore").EntityFieldStore<boolean>;
|
|
32
|
+
readonly $currentChatData: Store<{
|
|
33
|
+
messages: ConversationMessage[];
|
|
34
|
+
threadId: string;
|
|
35
|
+
isAvailable: boolean;
|
|
36
|
+
key: string;
|
|
37
|
+
}>;
|
|
29
38
|
constructor({ api, messages, $key }: ChatbotModelProps);
|
|
30
|
-
readonly messages: {
|
|
31
|
-
$state: import("effector").StoreWritable<Record<string, ConversationMessage[]>>;
|
|
32
|
-
setField: import("effector").EventCallable<{
|
|
33
|
-
key: string;
|
|
34
|
-
} & ({
|
|
35
|
-
data: ConversationMessage[];
|
|
36
|
-
fn?: never;
|
|
37
|
-
} | {
|
|
38
|
-
data?: never;
|
|
39
|
-
fn: (props: void | ConversationMessage[]) => void | ConversationMessage[];
|
|
40
|
-
})>;
|
|
41
|
-
reset: import("effector").EventCallable<void>;
|
|
42
|
-
};
|
|
43
|
-
readonly threadIds: {
|
|
44
|
-
$state: import("effector").StoreWritable<Record<string, string>>;
|
|
45
|
-
setField: import("effector").EventCallable<{
|
|
46
|
-
key: string;
|
|
47
|
-
} & ({
|
|
48
|
-
data: string;
|
|
49
|
-
fn?: never;
|
|
50
|
-
} | {
|
|
51
|
-
data?: never;
|
|
52
|
-
fn: (props: string | void) => string | void;
|
|
53
|
-
})>;
|
|
54
|
-
reset: import("effector").EventCallable<void>;
|
|
55
|
-
};
|
|
56
|
-
readonly availableChats: {
|
|
57
|
-
$state: import("effector").StoreWritable<Record<string, boolean>>;
|
|
58
|
-
setField: import("effector").EventCallable<{
|
|
59
|
-
key: string;
|
|
60
|
-
} & ({
|
|
61
|
-
data: boolean;
|
|
62
|
-
fn?: never;
|
|
63
|
-
} | {
|
|
64
|
-
data?: never;
|
|
65
|
-
fn: (props: boolean | void) => boolean | void;
|
|
66
|
-
})>;
|
|
67
|
-
reset: import("effector").EventCallable<void>;
|
|
68
|
-
};
|
|
69
39
|
private createSendHelpRequestFx;
|
|
70
40
|
private initChatReplyWatcher;
|
|
71
|
-
readonly startConversation: Effect<void, void | undefined, Error>;
|
|
72
|
-
setHintMessage({
|
|
73
|
-
readonly reinitConversation: Effect<ReinitConversationProps, void, Error>;
|
|
41
|
+
readonly startConversation: import("effector").Effect<void, void | undefined, Error>;
|
|
42
|
+
setHintMessage({ key, ...message }: SetHintMessageProps): void;
|
|
43
|
+
readonly reinitConversation: import("effector").Effect<ReinitConversationProps, void, Error>;
|
|
74
44
|
bindKey($store: Store<string>): this;
|
|
75
45
|
setT2SAudioProvider(audioProvider: AudioProvider): this;
|
|
76
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBotModel.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/ChatBotModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"ChatBotModel.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/ChatBotModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,KAAK,EAIX,MAAM,UAAU,CAAA;AAEjB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EAEd,mBAAmB,EAEpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGlD,KAAK,uBAAuB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,qBAAa,YAAY;IACvB,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAA;IACxB,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAA;IACxC,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAA;IAEnC,SAAgB,WAAW,2CAAkB;IAE7C,QAAQ,CAAC,iBAAiB,yCAAgB;IAC1C,QAAQ,CAAC,eAAe,mEAAgD;IACxE,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAA;IAE7D,QAAQ,CAAC,SAAS,4CAAyB;IAC3C,QAAQ,CAAC,UAAU,yCAAgB;IACnC,QAAQ,CAAC,OAAO,4CAA0E;IAE1F,SAAgB,iBAAiB,yCAAgB;IACjD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAwB;IAC1D,SAAgB,eAAe,kDAAwC;IAEvE,QAAQ,CAAC,eAAe,4CAAyB;IACjD,QAAQ,CAAC,eAAe,4CAAuC;IAE/D,QAAQ,CAAC,iBAAiB,yDAAA;IAE1B,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAA;IAEvD,QAAQ,CAAC,QAAQ,iGAAkD;IACnE,QAAQ,CAAC,SAAS,kFAAmC;IACrD,QAAQ,CAAC,cAAc,mFAAoC;IAE3D,SAAgB,gBAAgB;;;;;OAe/B;gBAEW,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,iBAAiB;IA2BtD,OAAO,CAAC,uBAAuB;IAuD/B,OAAO,CAAC,oBAAoB;IAe5B,SAAgB,iBAAiB,2DAQ/B;IAEK,cAAc,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,EAAE,mBAAmB;IAW9D,SAAgB,kBAAkB,kEAoBhC;IAEK,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;IAQ7B,mBAAmB,CAAC,aAAa,EAAE,aAAa;CAIxD"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { Effect } from 'effector';
|
|
2
|
-
import { ControlledEffect } from '../../../lib/effector/createControllerEffect';
|
|
3
1
|
import { ChatbotModelProps } from '../types/model.types';
|
|
4
|
-
import {
|
|
2
|
+
import { GoogleTranslatePayload, GoogleTranslateResponse } from '../types/api.types';
|
|
5
3
|
export declare class ChatbotAPI {
|
|
6
|
-
postMessageFx: ControlledEffect<PostMessagePayload, PostMessageResponse>;
|
|
7
|
-
getAlternativesFx: Effect<GetAlternativesPayload, GetAlternativesResponse>;
|
|
8
|
-
translateTextFx: Effect<GoogleTranslatePayload, GoogleTranslateResponse>;
|
|
9
|
-
textToSpeechTextFx: Effect<GoogleText2SpeechPayload, GoogleText2SpeechResponse>;
|
|
4
|
+
readonly postMessageFx: import("../../../lib/effector/createControllerEffect").ControlledEffect<import("../types/api.types").PostMessagePayload, import("../types/api.types").PostMessageResponse>;
|
|
5
|
+
readonly getAlternativesFx: import("effector").Effect<import("../types/api.types").GetAlternativesPayload, import("../types/api.types").GetAlternativesResponse, Error>;
|
|
6
|
+
readonly translateTextFx: import("effector").Effect<GoogleTranslatePayload, GoogleTranslateResponse, Error>;
|
|
7
|
+
readonly textToSpeechTextFx: import("effector").Effect<import("../types/api.types").GoogleText2SpeechPayload, import("../types/api.types").GoogleText2SpeechResponse, Error>;
|
|
10
8
|
constructor(api: ChatbotModelProps['api']);
|
|
11
9
|
}
|
|
12
10
|
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAGpF,qBAAa,UAAU;IACrB,SAAgB,aAAa,6KAAA;IAC7B,SAAgB,iBAAiB,8IAAA;IACjC,SAAgB,eAAe,oFAAA;IAC/B,SAAgB,kBAAkB,kJAAA;gBAEtB,GAAG,EAAE,iBAAiB,CAAC,KAAK,CAAC;CAwB1C"}
|
|
@@ -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"}
|
|
@@ -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
|
-
readonly reset: import("effector
|
|
21
|
+
readonly reset: import("effector").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,EAAwB,MAAM,UAAU,CAAA;AAE5E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,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,+CAInB;CACH"}
|
|
@@ -1,21 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ConversationMessage } from '../types/model.types';
|
|
1
|
+
import { EventCallable, Store } from 'effector';
|
|
2
|
+
import { TranslateMessageFxProps } from '../types/translation.types';
|
|
3
|
+
import { ChatbotModelProps, ConversationMessage } from '../types/model.types';
|
|
4
4
|
import { GetAlternativesResponse } from '../types/api.types';
|
|
5
|
+
import { ChatbotAPI } from './api';
|
|
6
|
+
import { EntityFieldStore } from '../../../lib/effector/createEntityFieldStore';
|
|
7
|
+
type ChatbotTranslationProps = {
|
|
8
|
+
api: ChatbotAPI;
|
|
9
|
+
$key: Store<string>;
|
|
10
|
+
defaultMessages: ChatbotModelProps['messages'];
|
|
11
|
+
messagesModel: EntityFieldStore<ConversationMessage[]>;
|
|
12
|
+
alternativesModel: {
|
|
13
|
+
set: EventCallable<GetAlternativesResponse | null>;
|
|
14
|
+
$store: Store<GetAlternativesResponse | null>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
5
17
|
export declare class ChatbotTranslation {
|
|
6
|
-
private readonly
|
|
7
|
-
readonly
|
|
18
|
+
private readonly api;
|
|
19
|
+
private readonly $key;
|
|
20
|
+
private readonly defaultMessages;
|
|
21
|
+
private readonly messagesModel;
|
|
22
|
+
private readonly alternativesModel;
|
|
23
|
+
readonly setIsTranslated: EventCallable<boolean>;
|
|
8
24
|
readonly $isTranslated: import("effector").StoreWritable<boolean>;
|
|
9
|
-
readonly
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
25
|
+
readonly translateAllMessagesFx: import("effector").Effect<{
|
|
26
|
+
targetLanguage: string;
|
|
27
|
+
}, ConversationMessage[], Error>;
|
|
28
|
+
constructor({ api, $key, defaultMessages, messagesModel, alternativesModel, }: ChatbotTranslationProps);
|
|
13
29
|
private shouldSkipTranslation;
|
|
14
30
|
private initTranslationSamples;
|
|
15
|
-
private
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
|
|
31
|
+
private translateRequest;
|
|
32
|
+
private addTranslationToAlternatives;
|
|
33
|
+
private readonly translateBatchFx;
|
|
34
|
+
readonly translateMessagesFx: import("effector").Effect<TranslateMessageFxProps, ConversationMessage[], Error>;
|
|
19
35
|
reset(): void;
|
|
20
36
|
}
|
|
37
|
+
export {};
|
|
21
38
|
//# sourceMappingURL=translation.d.ts.map
|
|
@@ -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"}
|
|
@@ -7,10 +7,11 @@ type UpdateField<T> = {
|
|
|
7
7
|
data?: never;
|
|
8
8
|
fn: (props: T | void) => T | void;
|
|
9
9
|
});
|
|
10
|
-
export declare
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
10
|
+
export declare class EntityFieldStore<T> {
|
|
11
|
+
readonly setField: import("effector").EventCallable<UpdateField<T>>;
|
|
12
|
+
readonly reset: import("effector").EventCallable<void>;
|
|
13
|
+
readonly $state: import("effector").StoreWritable<Record<string, T>>;
|
|
14
|
+
}
|
|
15
|
+
export declare function createEntityFieldStore<T>(): EntityFieldStore<T>;
|
|
15
16
|
export {};
|
|
16
17
|
//# sourceMappingURL=createEntityFieldStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;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,wBAAgB,sBAAsB,CAAC,CAAC
|
|
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;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;CACrB;AAED,wBAAgB,sBAAsB,CAAC,CAAC,yBAEvC"}
|
|
@@ -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: {
|