@alxxsck/ai-assistant 2.5.1 → 2.7.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/README.md +33 -2
- package/dist/App.d.ts +1 -0
- package/dist/{Avatar-DklBomzT.js → Avatar-BBTR5vL8.js} +1 -1
- package/dist/{ChatWidgetContent-DbOTIErq.js → ChatWidgetContent-Dhn8opnF.js} +2474 -2136
- package/dist/api/messages.api.d.ts +6 -5
- package/dist/avatar/publicAnimations.d.ts +1 -1
- package/dist/bridge-ai-chat-widget.es.js +5 -4
- package/dist/domain/message/message.store.d.ts +14 -1
- package/dist/domain/voice/voice.store.d.ts +2 -0
- package/dist/i18n/I18nProvider.d.ts +4 -0
- package/dist/i18n/i18n-context.d.ts +9 -0
- package/dist/i18n/i18n.d.ts +3 -0
- package/dist/i18n/messages.d.ts +101 -0
- package/dist/i18n/useI18n.d.ts +2 -0
- package/dist/{index-D9W50u8W.js → index-Cyv8CKEt.js} +4834 -3380
- package/dist/index.d.ts +4 -0
- package/dist/index.types.d.ts +2 -0
- package/dist/ui/components/ChatPaginationSkeleton.d.ts +2 -0
- package/dist/ui/components/chat-list-timestamp.d.ts +2 -0
- package/dist/ui/error-messages.d.ts +15 -5
- package/dist/ui/hooks/useCursorPagination.d.ts +15 -0
- package/dist/ui/hooks/usePinnedAutoScroll.d.ts +2 -1
- package/dist/ui/hooks/usePrependScrollAnchor.d.ts +13 -0
- package/package.json +3 -1
|
@@ -2,19 +2,20 @@ import type { AppApi } from "@/App";
|
|
|
2
2
|
import type { WidgetConfig } from "@/index.types";
|
|
3
3
|
import { type ConversationData, type MessageData, type RawMessageData } from "./messages.api.types";
|
|
4
4
|
export declare const MAX_FETCH_MESSAGES = 100;
|
|
5
|
-
type
|
|
6
|
-
items:
|
|
5
|
+
export type CursorPage<T> = {
|
|
6
|
+
items: T[];
|
|
7
7
|
nextCursor: string | null;
|
|
8
8
|
};
|
|
9
|
+
type ConversationsResponse = CursorPage<ConversationData>;
|
|
9
10
|
export declare class ChatApiError extends Error {
|
|
10
11
|
readonly status: number;
|
|
11
12
|
constructor(status: number, message: string);
|
|
12
13
|
}
|
|
13
14
|
export declare const isConversationClosedError: (error: unknown) => boolean;
|
|
14
15
|
export declare const normalizeMessage: (message: RawMessageData, config: WidgetConfig) => MessageData;
|
|
15
|
-
export declare const listConversations: (config: WidgetConfig, api: AppApi) => Promise<ConversationsResponse>;
|
|
16
|
-
export declare const listConversationMessages: (config: WidgetConfig, api: AppApi, conversationId: string) => Promise<MessageData
|
|
16
|
+
export declare const listConversations: (config: WidgetConfig, api: AppApi, cursor?: string, signal?: AbortSignal) => Promise<ConversationsResponse>;
|
|
17
|
+
export declare const listConversationMessages: (config: WidgetConfig, api: AppApi, conversationId: string, cursor?: string, signal?: AbortSignal) => Promise<CursorPage<MessageData>>;
|
|
17
18
|
export declare const createConversation: (config: WidgetConfig, api: AppApi) => Promise<ConversationData>;
|
|
18
|
-
export declare const selectConversation: (config: WidgetConfig, api: AppApi, conversationId: string) => Promise<ConversationData>;
|
|
19
|
+
export declare const selectConversation: (config: WidgetConfig, api: AppApi, conversationId: string, signal?: AbortSignal) => Promise<ConversationData>;
|
|
19
20
|
export declare function sendMessage(config: WidgetConfig, api: AppApi, messageText: string, conversationId?: string, clientMessageId?: `${string}-${string}-${string}-${string}-${string}`): Promise<MessageData>;
|
|
20
21
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const EXTERNALLY_AVAILABLE_ACTIONS: readonly ["
|
|
1
|
+
export declare const EXTERNALLY_AVAILABLE_ACTIONS: readonly ["deposit", "excited", "fix_hair", "kiss", "spin", "win_small"];
|
|
2
2
|
export type ExternallyAvailableActions = (typeof EXTERNALLY_AVAILABLE_ACTIONS)[number];
|
|
3
3
|
export declare function isExternallyAvailableAction(value: string): value is ExternallyAvailableActions;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as L, K as s, S as t, L as E } from "./index-Cyv8CKEt.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
L as ChatWidgetInstance,
|
|
4
|
+
s as EXTERNALLY_AVAILABLE_ACTIONS,
|
|
5
|
+
t as SUPPORTED_LOCALES,
|
|
6
|
+
E as isExternallyAvailableAction
|
|
6
7
|
};
|
|
@@ -21,8 +21,13 @@ export type MessageStore = {
|
|
|
21
21
|
currentThreadMessages: MessageData[];
|
|
22
22
|
messages: MessageData[];
|
|
23
23
|
conversations: ConversationData[];
|
|
24
|
+
conversationsNextCursor: string | null;
|
|
25
|
+
isLoadingMoreConversations: boolean;
|
|
24
26
|
threadIds: string[];
|
|
25
27
|
loadedThreadIds: Set<string>;
|
|
28
|
+
threadMessagesNextCursor: Map<string, string | null>;
|
|
29
|
+
loadingOlderThreadIds: Set<string>;
|
|
30
|
+
refreshingThreadIds: Set<string>;
|
|
26
31
|
threads: Map<string, MessageData[]>;
|
|
27
32
|
threadsPreviews: ThreadSummary[];
|
|
28
33
|
sendError: string | null;
|
|
@@ -54,16 +59,24 @@ export type MessageStoreActions = {
|
|
|
54
59
|
handleMessagesAgenticSteps: (message: AgenticStepsAppendedData) => void;
|
|
55
60
|
updateThreads: () => void;
|
|
56
61
|
fetchThreadMessages: (conversationId: string) => Promise<void>;
|
|
62
|
+
fetchOlderThreadMessages: (conversationId: string) => Promise<void>;
|
|
63
|
+
cancelThreadMessagesRequest: (conversationId: string) => void;
|
|
64
|
+
cancelConversationPagination: () => void;
|
|
57
65
|
setCurrentThreadMessages: (conversationId: string) => void;
|
|
58
66
|
sendServiceMessage: (message: string) => Promise<void>;
|
|
59
67
|
updateConfig: (config: WidgetConfig, api: AppApi) => void;
|
|
60
|
-
recoverMessages: () => Promise<void>;
|
|
68
|
+
recoverMessages: (preserveLoadedConversations?: boolean) => Promise<void>;
|
|
69
|
+
fetchMoreConversations: () => Promise<void>;
|
|
61
70
|
};
|
|
62
71
|
export declare const useMessageStore: import("zustand").UseBoundStore<import("zustand").StoreApi<MessageStore>>;
|
|
63
72
|
export declare const useSelectCurrentThreadId: () => string | undefined;
|
|
64
73
|
export declare const useSelectCurrentThreadMessages: () => MessageData[];
|
|
65
74
|
export declare const useSelectThreadsPreviews: () => ThreadSummary[];
|
|
75
|
+
export declare const useHasMoreConversations: () => boolean;
|
|
76
|
+
export declare const useIsLoadingMoreConversations: () => boolean;
|
|
66
77
|
export declare const useCurrentThreadId: () => string | undefined;
|
|
78
|
+
export declare const useCurrentThreadHasOlderMessages: () => boolean;
|
|
79
|
+
export declare const useIsLoadingOlderCurrentThread: () => boolean;
|
|
67
80
|
export declare const useLatestReadMessageDate: () => string | null;
|
|
68
81
|
export declare const useLatestMessageDate: () => string | null;
|
|
69
82
|
export declare const useSendError: () => string | null;
|
|
@@ -4,12 +4,14 @@ import type { VoiceSessionData } from "@/api/voice.api.types";
|
|
|
4
4
|
import type { SpeakTextCommandContext, StartVoiceConversationCommandContext } from "@/domain/command/command.types";
|
|
5
5
|
import type { WidgetConfig } from "@/index.types";
|
|
6
6
|
type VoiceStatus = "idle" | "connecting" | "listening" | "speaking" | "error";
|
|
7
|
+
export type VoiceErrorCode = "audio_playback_failed" | "session_failed" | "connection_closed" | "connection_timed_out" | "microphone_blocked" | "microphone_unsupported";
|
|
7
8
|
type VoiceStore = {
|
|
8
9
|
config: WidgetConfig | null;
|
|
9
10
|
api: AppApi | null;
|
|
10
11
|
session: VoiceSessionData | null;
|
|
11
12
|
status: VoiceStatus;
|
|
12
13
|
errorMessage: string | null;
|
|
14
|
+
errorCode: VoiceErrorCode | null;
|
|
13
15
|
socket: Socket | null;
|
|
14
16
|
localStream: MediaStream | null;
|
|
15
17
|
inputAudioContext: AudioContext | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type SupportedLocale } from "./i18n";
|
|
2
|
+
import { type TranslationKey } from "./messages";
|
|
3
|
+
export type I18nContextValue = {
|
|
4
|
+
locale: SupportedLocale;
|
|
5
|
+
direction: "ltr" | "rtl";
|
|
6
|
+
t: (key: TranslationKey, params?: Record<string, string | number>) => string;
|
|
7
|
+
};
|
|
8
|
+
export declare const createI18nValue: (localeTag?: string) => I18nContextValue;
|
|
9
|
+
export declare const I18nContext: import("react").Context<I18nContextValue>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type SupportedLocale } from "./i18n";
|
|
2
|
+
declare const en: {
|
|
3
|
+
readonly app: {
|
|
4
|
+
readonly restart: "Restart Lola";
|
|
5
|
+
};
|
|
6
|
+
readonly launcher: {
|
|
7
|
+
readonly open: "Open Lola";
|
|
8
|
+
};
|
|
9
|
+
readonly widget: {
|
|
10
|
+
readonly resizeVertical: "Resize Lola vertically";
|
|
11
|
+
readonly resizeHorizontal: "Resize Lola horizontally";
|
|
12
|
+
readonly resizeDiagonal: "Resize Lola diagonally";
|
|
13
|
+
readonly resize: "Resize Lola";
|
|
14
|
+
};
|
|
15
|
+
readonly controls: {
|
|
16
|
+
readonly close: "Close chat";
|
|
17
|
+
readonly move: "Move Lola";
|
|
18
|
+
readonly exitFullscreen: "Exit fullscreen";
|
|
19
|
+
readonly enterFullscreen: "Enter fullscreen";
|
|
20
|
+
readonly openChatList: "Open chat list";
|
|
21
|
+
};
|
|
22
|
+
readonly avatar: {
|
|
23
|
+
readonly gettingReady: "Lola is getting ready…";
|
|
24
|
+
};
|
|
25
|
+
readonly chat: {
|
|
26
|
+
readonly back: "Back to chat";
|
|
27
|
+
readonly listTitle: "Chats";
|
|
28
|
+
readonly new: "New chat";
|
|
29
|
+
readonly loadOlder: "Load older chats";
|
|
30
|
+
readonly retryOlder: "Retry older chats";
|
|
31
|
+
readonly olderLoadFailed: "Couldn't load older chats.";
|
|
32
|
+
readonly loadingOlder: "Loading older chats";
|
|
33
|
+
readonly loadPreviousMessages: "Load previous messages";
|
|
34
|
+
readonly retryPreviousMessages: "Retry previous messages";
|
|
35
|
+
readonly previousLoadFailed: "Couldn't load previous messages.";
|
|
36
|
+
readonly loadingOlderMessages: "Loading older messages";
|
|
37
|
+
readonly loadingMessages: "Loading messages";
|
|
38
|
+
readonly switchToVoice: "Switch to voice chat";
|
|
39
|
+
readonly talk: "Talk";
|
|
40
|
+
readonly messageLabel: "Message";
|
|
41
|
+
readonly messagePlaceholder: "Message…";
|
|
42
|
+
readonly send: "Send message";
|
|
43
|
+
readonly thinking: "AI is thinking";
|
|
44
|
+
readonly unread: "Unread messages";
|
|
45
|
+
readonly chooseAnswer: "Choose an answer";
|
|
46
|
+
readonly answerSent: "Answer sent";
|
|
47
|
+
readonly answerFailed: "Failed to send. Tap again to retry.";
|
|
48
|
+
};
|
|
49
|
+
readonly error: {
|
|
50
|
+
readonly connectionFailed: "Connection failed";
|
|
51
|
+
readonly offline: "You're offline";
|
|
52
|
+
readonly agentResponseFailed: "Assistant response failed";
|
|
53
|
+
readonly sendMessageFailed: "Failed to send message";
|
|
54
|
+
readonly conversationClosed: "This chat is closed. Select or create another chat.";
|
|
55
|
+
};
|
|
56
|
+
readonly voice: {
|
|
57
|
+
readonly connecting: "Connecting…";
|
|
58
|
+
readonly speaking: "Assistant speaking…";
|
|
59
|
+
readonly incoming: "Incoming voice conversation";
|
|
60
|
+
readonly startTalking: "Start talking";
|
|
61
|
+
readonly muted: "Muted";
|
|
62
|
+
readonly calling: "Lola is calling";
|
|
63
|
+
readonly aiDisclosure: "The voice you hear is generated by AI.";
|
|
64
|
+
readonly accept: "Accept";
|
|
65
|
+
readonly decline: "Decline";
|
|
66
|
+
readonly muteMicrophone: "Mute microphone";
|
|
67
|
+
readonly unmuteMicrophone: "Unmute microphone";
|
|
68
|
+
readonly switchToText: "Switch to text chat";
|
|
69
|
+
readonly audioPlaybackFailed: "Couldn't play the assistant's voice.";
|
|
70
|
+
readonly sessionFailed: "Voice conversation failed.";
|
|
71
|
+
readonly connectionClosed: "Voice connection was closed.";
|
|
72
|
+
readonly connectionTimedOut: "Voice connection timed out.";
|
|
73
|
+
readonly microphoneBlocked: "The browser blocked microphone access.";
|
|
74
|
+
readonly microphoneUnsupported: "This browser doesn't support microphone access.";
|
|
75
|
+
};
|
|
76
|
+
readonly cta: {
|
|
77
|
+
readonly dismiss: "Dismiss action";
|
|
78
|
+
readonly openTelegram: "Open @{{username}}";
|
|
79
|
+
readonly manualCommand: "If the link doesn't work:";
|
|
80
|
+
readonly telegramPopupOpened: "Tap Start in Telegram, then come back here and confirm the connection.";
|
|
81
|
+
readonly telegramPopupBlocked: "Open the bot using the link below, tap Start, then come back to confirm.";
|
|
82
|
+
readonly telegramLinkFailed: "Couldn't create the Telegram link. Try again.";
|
|
83
|
+
readonly telegramLinkExpired: "The link expired. Tap the button to create a new one.";
|
|
84
|
+
readonly telegramPressStart: "First tap Start in Telegram, then confirm the connection here.";
|
|
85
|
+
readonly telegramConnectFailed: "Couldn't connect Telegram. Try again.";
|
|
86
|
+
readonly preparingLink: "Preparing the link…";
|
|
87
|
+
readonly confirmTelegram: "Confirm Telegram";
|
|
88
|
+
readonly confirming: "Confirming…";
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
type CatalogShape = {
|
|
92
|
+
[Group in keyof typeof en]: {
|
|
93
|
+
[Key in keyof (typeof en)[Group]]: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export type TranslationKey = {
|
|
97
|
+
[Group in keyof CatalogShape & string]: `${Group}.${keyof CatalogShape[Group] & string}`;
|
|
98
|
+
}[keyof CatalogShape & string];
|
|
99
|
+
export type TranslationMessages = Record<TranslationKey, string>;
|
|
100
|
+
export declare const MESSAGES: Record<SupportedLocale, TranslationMessages>;
|
|
101
|
+
export {};
|