@iblai/web-utils 1.7.2 → 1.7.3

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.
@@ -0,0 +1,8 @@
1
+ import { SERVICES } from '../../constants';
2
+ export declare const CHAT_CUSTOM_REDUCER_PATH = "chatCustomApiSlice";
3
+ export declare const CHAT_CUSTOM_ENDPOINTS: {
4
+ GET_CHAT_MESSAGE_TTS: {
5
+ path: (org: string, user_id: string, chat_message_id: string) => string;
6
+ service: SERVICES;
7
+ };
8
+ };
@@ -0,0 +1,272 @@
1
+ export interface GetChatMessageTtsArgs {
2
+ org: string;
3
+ user_id: string;
4
+ chat_message_id: string;
5
+ }
6
+ export declare const chatCustomApiSlice: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, {
7
+ getChatMessageTts: import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>;
8
+ }, "chatCustomApiSlice", never, typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/dist/query/react").reactHooksModuleName>;
9
+ export declare const useGetChatMessageTtsQuery: <R extends Record<string, any> = import("@reduxjs/toolkit/query").TSHelpersId<(Omit<{
10
+ status: import("@reduxjs/toolkit/query").QueryStatus.uninitialized;
11
+ originalArgs?: undefined | undefined;
12
+ data?: undefined | undefined;
13
+ error?: undefined | undefined;
14
+ requestId?: undefined | undefined;
15
+ endpointName?: string | undefined;
16
+ startedTimeStamp?: undefined | undefined;
17
+ fulfilledTimeStamp?: undefined | undefined;
18
+ } & {
19
+ currentData?: string | undefined;
20
+ isUninitialized: false;
21
+ isLoading: false;
22
+ isFetching: false;
23
+ isSuccess: false;
24
+ isError: false;
25
+ }, "isUninitialized"> & {
26
+ isUninitialized: true;
27
+ }) | import("@reduxjs/toolkit/query").TSHelpersOverride<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
28
+ currentData?: string | undefined;
29
+ isUninitialized: false;
30
+ isLoading: false;
31
+ isFetching: false;
32
+ isSuccess: false;
33
+ isError: false;
34
+ }, {
35
+ isLoading: true;
36
+ isFetching: boolean;
37
+ data: undefined;
38
+ } | ({
39
+ isSuccess: true;
40
+ isFetching: true;
41
+ error: undefined;
42
+ } & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
43
+ currentData?: string | undefined;
44
+ isUninitialized: false;
45
+ isLoading: false;
46
+ isFetching: false;
47
+ isSuccess: false;
48
+ isError: false;
49
+ }, "data" | "fulfilledTimeStamp">>) | ({
50
+ isSuccess: true;
51
+ isFetching: false;
52
+ error: undefined;
53
+ } & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
54
+ currentData?: string | undefined;
55
+ isUninitialized: false;
56
+ isLoading: false;
57
+ isFetching: false;
58
+ isSuccess: false;
59
+ isError: false;
60
+ }, "data" | "fulfilledTimeStamp" | "currentData">>) | ({
61
+ isError: true;
62
+ } & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
63
+ currentData?: string | undefined;
64
+ isUninitialized: false;
65
+ isLoading: false;
66
+ isFetching: false;
67
+ isSuccess: false;
68
+ isError: false;
69
+ }, "error">>)>> & {
70
+ status: import("@reduxjs/toolkit/query").QueryStatus;
71
+ }>(arg: GetChatMessageTtsArgs | typeof import("@reduxjs/toolkit/query").skipToken, options?: (import("@reduxjs/toolkit/query").SubscriptionOptions & {
72
+ skip?: boolean;
73
+ refetchOnMountOrArgChange?: boolean | number;
74
+ } & {
75
+ skip?: boolean;
76
+ selectFromResult?: ((state: import("@reduxjs/toolkit/query").TSHelpersId<(Omit<{
77
+ status: import("@reduxjs/toolkit/query").QueryStatus.uninitialized;
78
+ originalArgs?: undefined | undefined;
79
+ data?: undefined | undefined;
80
+ error?: undefined | undefined;
81
+ requestId?: undefined | undefined;
82
+ endpointName?: string | undefined;
83
+ startedTimeStamp?: undefined | undefined;
84
+ fulfilledTimeStamp?: undefined | undefined;
85
+ } & {
86
+ currentData?: string | undefined;
87
+ isUninitialized: false;
88
+ isLoading: false;
89
+ isFetching: false;
90
+ isSuccess: false;
91
+ isError: false;
92
+ }, "isUninitialized"> & {
93
+ isUninitialized: true;
94
+ }) | import("@reduxjs/toolkit/query").TSHelpersOverride<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
95
+ currentData?: string | undefined;
96
+ isUninitialized: false;
97
+ isLoading: false;
98
+ isFetching: false;
99
+ isSuccess: false;
100
+ isError: false;
101
+ }, {
102
+ isLoading: true;
103
+ isFetching: boolean;
104
+ data: undefined;
105
+ } | ({
106
+ isSuccess: true;
107
+ isFetching: true;
108
+ error: undefined;
109
+ } & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
110
+ currentData?: string | undefined;
111
+ isUninitialized: false;
112
+ isLoading: false;
113
+ isFetching: false;
114
+ isSuccess: false;
115
+ isError: false;
116
+ }, "data" | "fulfilledTimeStamp">>) | ({
117
+ isSuccess: true;
118
+ isFetching: false;
119
+ error: undefined;
120
+ } & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
121
+ currentData?: string | undefined;
122
+ isUninitialized: false;
123
+ isLoading: false;
124
+ isFetching: false;
125
+ isSuccess: false;
126
+ isError: false;
127
+ }, "data" | "fulfilledTimeStamp" | "currentData">>) | ({
128
+ isError: true;
129
+ } & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
130
+ currentData?: string | undefined;
131
+ isUninitialized: false;
132
+ isLoading: false;
133
+ isFetching: false;
134
+ isSuccess: false;
135
+ isError: false;
136
+ }, "error">>)>> & {
137
+ status: import("@reduxjs/toolkit/query").QueryStatus;
138
+ }) => R) | undefined;
139
+ }) | undefined) => [R][R extends any ? 0 : never] & {
140
+ refetch: () => import("@reduxjs/toolkit/query").QueryActionCreatorResult<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>>;
141
+ }, useLazyGetChatMessageTtsQuery: <R extends Record<string, any> = import("@reduxjs/toolkit/query").TSHelpersId<(Omit<{
142
+ status: import("@reduxjs/toolkit/query").QueryStatus.uninitialized;
143
+ originalArgs?: undefined | undefined;
144
+ data?: undefined | undefined;
145
+ error?: undefined | undefined;
146
+ requestId?: undefined | undefined;
147
+ endpointName?: string | undefined;
148
+ startedTimeStamp?: undefined | undefined;
149
+ fulfilledTimeStamp?: undefined | undefined;
150
+ } & {
151
+ currentData?: string | undefined;
152
+ isUninitialized: false;
153
+ isLoading: false;
154
+ isFetching: false;
155
+ isSuccess: false;
156
+ isError: false;
157
+ }, "isUninitialized"> & {
158
+ isUninitialized: true;
159
+ }) | import("@reduxjs/toolkit/query").TSHelpersOverride<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
160
+ currentData?: string | undefined;
161
+ isUninitialized: false;
162
+ isLoading: false;
163
+ isFetching: false;
164
+ isSuccess: false;
165
+ isError: false;
166
+ }, {
167
+ isLoading: true;
168
+ isFetching: boolean;
169
+ data: undefined;
170
+ } | ({
171
+ isSuccess: true;
172
+ isFetching: true;
173
+ error: undefined;
174
+ } & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
175
+ currentData?: string | undefined;
176
+ isUninitialized: false;
177
+ isLoading: false;
178
+ isFetching: false;
179
+ isSuccess: false;
180
+ isError: false;
181
+ }, "data" | "fulfilledTimeStamp">>) | ({
182
+ isSuccess: true;
183
+ isFetching: false;
184
+ error: undefined;
185
+ } & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
186
+ currentData?: string | undefined;
187
+ isUninitialized: false;
188
+ isLoading: false;
189
+ isFetching: false;
190
+ isSuccess: false;
191
+ isError: false;
192
+ }, "data" | "fulfilledTimeStamp" | "currentData">>) | ({
193
+ isError: true;
194
+ } & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
195
+ currentData?: string | undefined;
196
+ isUninitialized: false;
197
+ isLoading: false;
198
+ isFetching: false;
199
+ isSuccess: false;
200
+ isError: false;
201
+ }, "error">>)>> & {
202
+ status: import("@reduxjs/toolkit/query").QueryStatus;
203
+ }>(options?: (import("@reduxjs/toolkit/query").SubscriptionOptions & Omit<{
204
+ skip?: boolean;
205
+ selectFromResult?: ((state: import("@reduxjs/toolkit/query").TSHelpersId<(Omit<{
206
+ status: import("@reduxjs/toolkit/query").QueryStatus.uninitialized;
207
+ originalArgs?: undefined | undefined;
208
+ data?: undefined | undefined;
209
+ error?: undefined | undefined;
210
+ requestId?: undefined | undefined;
211
+ endpointName?: string | undefined;
212
+ startedTimeStamp?: undefined | undefined;
213
+ fulfilledTimeStamp?: undefined | undefined;
214
+ } & {
215
+ currentData?: string | undefined;
216
+ isUninitialized: false;
217
+ isLoading: false;
218
+ isFetching: false;
219
+ isSuccess: false;
220
+ isError: false;
221
+ }, "isUninitialized"> & {
222
+ isUninitialized: true;
223
+ }) | import("@reduxjs/toolkit/query").TSHelpersOverride<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
224
+ currentData?: string | undefined;
225
+ isUninitialized: false;
226
+ isLoading: false;
227
+ isFetching: false;
228
+ isSuccess: false;
229
+ isError: false;
230
+ }, {
231
+ isLoading: true;
232
+ isFetching: boolean;
233
+ data: undefined;
234
+ } | ({
235
+ isSuccess: true;
236
+ isFetching: true;
237
+ error: undefined;
238
+ } & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
239
+ currentData?: string | undefined;
240
+ isUninitialized: false;
241
+ isLoading: false;
242
+ isFetching: false;
243
+ isSuccess: false;
244
+ isError: false;
245
+ }, "data" | "fulfilledTimeStamp">>) | ({
246
+ isSuccess: true;
247
+ isFetching: false;
248
+ error: undefined;
249
+ } & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
250
+ currentData?: string | undefined;
251
+ isUninitialized: false;
252
+ isLoading: false;
253
+ isFetching: false;
254
+ isSuccess: false;
255
+ isError: false;
256
+ }, "data" | "fulfilledTimeStamp" | "currentData">>) | ({
257
+ isError: true;
258
+ } & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>> & {
259
+ currentData?: string | undefined;
260
+ isUninitialized: false;
261
+ isLoading: false;
262
+ isFetching: false;
263
+ isSuccess: false;
264
+ isError: false;
265
+ }, "error">>)>> & {
266
+ status: import("@reduxjs/toolkit/query").QueryStatus;
267
+ }) => R) | undefined;
268
+ }, "skip">) | undefined) => [(arg: GetChatMessageTtsArgs, preferCacheValue?: boolean) => import("@reduxjs/toolkit/query").QueryActionCreatorResult<import("@reduxjs/toolkit/query").QueryDefinition<GetChatMessageTtsArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "chatCustomApiSlice", unknown>>, [R][R extends any ? 0 : never] & {
269
+ reset: () => void;
270
+ }, {
271
+ lastArg: GetChatMessageTtsArgs;
272
+ }];
@@ -1,6 +1,7 @@
1
1
  export * from './features/api-keys/api-slice';
2
2
  export * from './features/chat-history/api-slice';
3
3
  export * from './features/chat/api-slice';
4
+ export * from './features/chat/custom-api-slice';
4
5
  export * from './features/chat-files/api-slice';
5
6
  export * from './features/chat-files/types';
6
7
  export * from './features/llms/api-slice';
package/dist/index.d.ts CHANGED
@@ -511,6 +511,12 @@ interface ArtifactVersion {
511
511
  created_by?: string;
512
512
  change_summary?: string;
513
513
  }
514
+ interface RawMessageFromWS {
515
+ id: string;
516
+ is_ai: boolean;
517
+ is_human: boolean;
518
+ generation_id: string;
519
+ }
514
520
  interface Message$1 {
515
521
  id: string;
516
522
  role: "user" | "assistant" | "system";
@@ -1002,7 +1008,7 @@ declare const isNode: () => string | false;
1002
1008
  declare const isExpo: () => any;
1003
1009
  declare const isTauri: () => boolean;
1004
1010
  declare function isSafariBrowser(): boolean;
1005
- declare const getPlatform: () => "react-native" | "web" | "node" | "unknown";
1011
+ declare const getPlatform: () => "web" | "react-native" | "node" | "unknown";
1006
1012
  declare const safeRequire: (moduleName: string) => any;
1007
1013
  declare const getNextNavigation: () => any;
1008
1014
 
@@ -2342,4 +2348,4 @@ declare const WithPermissions: ({ rbacResource, rbacPermissions, children, }: Wi
2342
2348
  declare const checkRbacPermission: (rbacPermissions: object, rbacResource: string, enableRBAC?: boolean) => boolean;
2343
2349
 
2344
2350
  export { ALPHANUMERIC_32_REGEX, ANONYMOUS_USERNAME, AuthContext, AuthContextProvider, AuthProvider, CHAT_AREA_SIZE, CacheKeys, DEFAULT_DISCLAIMER_CONTENT, LOCAL_STORAGE_KEYS, MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS, MENTOR_CHAT_DOCUMENTS_EXTENSIONS, MENTOR_VISIBILITY, MENTOR_VISIBILITY_VALUES, METADATAS, MentorProvider, REQUIRED_ACTIONS_FOR_GROUPS, RemoteEvents, STREAMING_CONTENT_BUFFER_THRESHOLD, STREAMING_CONTENT_FLUSH_INTERVAL, SUBSCRIPTION_MESSAGES, SUBSCRIPTION_PACKAGES, SUBSCRIPTION_PACKAGES_V2, SUBSCRIPTION_TRIGGERS, SUBSCRIPTION_V2_TRIGGERS, ServiceWorkerProvider, SubscriptionFlow, SubscriptionFlowV2, TOOLS, TenantContext, TenantContextProvider, TenantProvider, TimeTracker, WithFormPermissions, WithPermissions, addFiles, addMessage, addProtocolToUrl, advancedTabs, advancedTabsProperties, appleRestrictionReducer, appleRestrictionSlice, chatActions, chatInputSlice, chatInputSliceActions, chatInputSliceReducer, chatInputSliceSelectors, chatSliceReducerShared, checkModelAvailable, checkOllamaHealth, checkRbacPermission, clearAllCaches, clearApiCache, clearAuthCookies, clearCookies, clearCurrentTenantCookie, clearFiles, clearMessages, combineCSVData, convertToOllamaMessages, createFileReference, createMultipleFileReferences, csvDataToText, defaultSessionIds, deleteCookie, deleteCookieOnAllDomains, enableChatActionsPopup, eventBus, fetchWithCache, filesReducer, filesSlice, formatRelativeTime, getAuthSpaJoinUrl, getCacheStatus, getCachedApiResponse, getCookieValue, getDomainParts, getFileInfo, getInitials, getLocalLLMSystemPrompt, getNextNavigation, getParentDomain, getPlatform, getPlatformKey, getServiceWorkerStatus, getStoredUserName, getTimeAgo, getUserEmail, getUserName, handleLogout, hostChatReducer, hostChatSlice, initServiceWorker, isAlphaNumeric32, isExpo, isFileAccepted, isInIframe, isJSON, isLoggedIn, isNode, isReactNative, isSafariBrowser, isServiceWorkerSupported, isStripeActivated, isTauri, isTauriOfflineMode, isWeb, loadMetadataConfig, markdownToPlainText, monetizationSlice, onStatusChange, onUpdate, parseCSV, preCacheMentorData, rbacReducer, redirectToAuthSpa, redirectToAuthSpaJoinTenant, registerServiceWorker, removeFile, requestPresignedUrl, safeRequire, selectActiveChatMessages, selectActiveTab, selectArtifactsEnabled, selectAttachedFiles, selectChats, selectCurrentStreamingArtifact, selectCurrentStreamingMessage, selectDocumentFilter, selectEnableChatActionsPopup, selectIframeContext, selectIsError, selectIsPending, selectIsStopped, selectIsTyping, selectLastArtifactContentFlushTime, selectMetadata, selectNumberOfActiveChatMessages, selectRbacPermissions, selectSessionId, selectSessionIds, selectShouldStartNewChat, selectShowingSharedChat, selectStatus, selectStreaming, selectStreamingArtifactContentBuffer, selectStreamingArtifactFullContent, selectToken, selectTokenEnabled, selectTools, sendMessageToParentWebsite, setAccessCheckResponse, setAdvancedDisplayMonetizationCheckoutModal, setCachedApiResponse, setCookieForAuth, setDisplayMonetizationCheckoutModal, setError402Detected, setFreeTrialUsageOptions, setOfflineStatus, setOpenAppleRestrictionModal, setOpenPricingModal, setPricingModalData, setSubscriptionStatus, setTauriMode, setTopBannerOptions, setupNetworkListeners, showMonetizationCheckoutModal, skipWaiting, streamOllamaChat, subscriptionReducer, subscriptionSlice, syncAuthToCookies, tenantKeySchema, tenantSchema, topBannerReducer, topBannerSlice, translatePrompt, unregisterServiceWorker, updateFileMetadata, updateFileProgress, updateFileRetryCount, updateFileStatus, updateFileUrl, updateFileUrlFromWebSocket, updateRbacPermissions, uploadToS3, use402ErrorCheck, useAccessingPublicRoute, useAdvancedChat, useAuthContext, useAuthProvider, useAxdToken, useCachedSessionId, useChat, useChatFileUpload, useCurrentTenant, useDayJs, useDmToken, useEmbedMode, useEventCallback, useEventListener, useExternalPricingPlan, useFileDragDrop, useIsAdmin, useIsomorphicLayoutEffect, useLocalStorage, useMentorSettings, useMentorTools, useModelFileUploadCapabilities, useOS, useProfileImageUpload, useResponsive, useServiceWorker, useShowAttachment, useShowFreeTrialDialog, useShowVoiceCall, useShowVoiceRecorder, useStripeUpgrade, useSubscriptionHandler, useSubscriptionHandlerV2, useTenantContext, useTenantMetadata, useTimeTracker, useTimeTrackerNative, useTimer, useUserAgreement, useUserData, useUserProfileUpdate, useUserTenants, useUsername, useVisitingTenant, useVoiceChat, useWelcome as useWelcomeMessage, userDataSchema, validateFile };
2345
- export type { AdvancedTab, AppleRestrictionState, ArtifactData, ArtifactPayload, ArtifactVersion, AttachedFile, AuthContextType, ChatInputState, ChatMode, ChatSliceState, ChatState, ChatStatus, CreateStripeCustomerPortalRequest, Error402MessageData, FileAttachment, FileInfo, FileProcessingEvent, FileReference, FileUploadCapabilities, FileUploadState, FilesState, HandleLogoutOptions, HostChatState, Message$1 as Message, MessageAction, MonetizationState, OAuthRequiredData, OAuthResolvedData, OllamaChatRequest, OllamaChatStreamResponse, OllamaMessage, OllamaStreamCallbacks, PricingModalData$1 as PricingModalData, PricingTablePayload, Prompt, RbacPermissions, RbacState, RedirectToAuthSpaOptions, SendMessageOptions, ServiceWorkerStatus, SessionIds, StreamingArtifact, StreamingMessage, StripeUpgradePlan, SubscriptionFlowConfig, SubscriptionFlowConfigV2, SubscriptionState, Tenant, TenantContextType, TenantKeyMentorIdParams, TenantMetadata, TimeTrackerConfig, TimeTrackerState, TopBannerOptions, TopBannerState, TopTrialBannerProps, UploadProgressCallback, UseChatProps, UseChatReturn, UseExternalPricingProps, UseProfileImageUploadOptions, UseProfileImageUploadReturn, UseTimeTrackerConfig, UseTimeTrackerNativeConfig, UseTimeTrackerNativeReturn, UseTimeTrackerReturn, UseUserProfileUpdateResult, UserProfileUpdateData };
2351
+ export type { AdvancedTab, AppleRestrictionState, ArtifactData, ArtifactPayload, ArtifactVersion, AttachedFile, AuthContextType, ChatInputState, ChatMode, ChatSliceState, ChatState, ChatStatus, CreateStripeCustomerPortalRequest, Error402MessageData, FileAttachment, FileInfo, FileProcessingEvent, FileReference, FileUploadCapabilities, FileUploadState, FilesState, HandleLogoutOptions, HostChatState, Message$1 as Message, MessageAction, MonetizationState, OAuthRequiredData, OAuthResolvedData, OllamaChatRequest, OllamaChatStreamResponse, OllamaMessage, OllamaStreamCallbacks, PricingModalData$1 as PricingModalData, PricingTablePayload, Prompt, RawMessageFromWS, RbacPermissions, RbacState, RedirectToAuthSpaOptions, SendMessageOptions, ServiceWorkerStatus, SessionIds, StreamingArtifact, StreamingMessage, StripeUpgradePlan, SubscriptionFlowConfig, SubscriptionFlowConfigV2, SubscriptionState, Tenant, TenantContextType, TenantKeyMentorIdParams, TenantMetadata, TimeTrackerConfig, TimeTrackerState, TopBannerOptions, TopBannerState, TopTrialBannerProps, UploadProgressCallback, UseChatProps, UseChatReturn, UseExternalPricingProps, UseProfileImageUploadOptions, UseProfileImageUploadReturn, UseTimeTrackerConfig, UseTimeTrackerNativeConfig, UseTimeTrackerNativeReturn, UseTimeTrackerReturn, UseUserProfileUpdateResult, UserProfileUpdateData };
package/dist/index.esm.js CHANGED
@@ -11086,6 +11086,30 @@ const chatSlice = createSlice({
11086
11086
  resetCurrentStreamingMessage: (state) => {
11087
11087
  state.currentStreamingMessage = { id: "", content: "" };
11088
11088
  },
11089
+ updateStreamingMessageId: (state, action) => {
11090
+ const oldId = state.currentStreamingMessage.id;
11091
+ const { newId } = action.payload;
11092
+ if (!newId || oldId === newId) {
11093
+ return;
11094
+ }
11095
+ if (oldId) {
11096
+ const activeMessages = state.chats[state.activeTab];
11097
+ if (activeMessages === null || activeMessages === void 0 ? void 0 : activeMessages.length) {
11098
+ const lastIndex = activeMessages.length - 1;
11099
+ const last = activeMessages[lastIndex];
11100
+ if (last.id === oldId) {
11101
+ state.chats = {
11102
+ ...state.chats,
11103
+ [state.activeTab]: [
11104
+ ...activeMessages.slice(0, lastIndex),
11105
+ { ...last, id: newId },
11106
+ ],
11107
+ };
11108
+ }
11109
+ }
11110
+ }
11111
+ state.currentStreamingMessage.id = newId;
11112
+ },
11089
11113
  setActiveTab: (state, action) => {
11090
11114
  state.activeTab = action.payload;
11091
11115
  },
@@ -12355,7 +12379,7 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
12355
12379
  onStreamingChange === null || onStreamingChange === void 0 ? void 0 : onStreamingChange(false);
12356
12380
  });
12357
12381
  socket.addEventListener("message", (event) => {
12358
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
12382
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
12359
12383
  if (isWebSocketPaused.current) {
12360
12384
  console.log("[ws-message] Message received but WebSocket is paused");
12361
12385
  return;
@@ -12928,8 +12952,23 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
12928
12952
  onStreamingChange(true);
12929
12953
  return;
12930
12954
  }
12955
+ //HANDLE RECEPTION OF CHAT MESSAGES INFO
12956
+ if ((messageData === null || messageData === void 0 ? void 0 : messageData.type) === "chat_messages" &&
12957
+ ((_t = messageData === null || messageData === void 0 ? void 0 : messageData.messages) === null || _t === void 0 ? void 0 : _t.length) > 0) {
12958
+ const chatMessageID = (_v = (_u = messageData === null || messageData === void 0 ? void 0 : messageData.messages) === null || _u === void 0 ? void 0 : _u.find((pre) => pre.is_ai)) === null || _v === void 0 ? void 0 : _v.id;
12959
+ if (chatMessageID) {
12960
+ dispatch(chatActions.updateStreamingMessageId({ newId: chatMessageID }));
12961
+ currentStreamingMessage.current = {
12962
+ ...currentStreamingMessage.current,
12963
+ id: chatMessageID,
12964
+ };
12965
+ onStreamingMessageUpdate === null || onStreamingMessageUpdate === void 0 ? void 0 : onStreamingMessageUpdate(currentStreamingMessage.current);
12966
+ return;
12967
+ }
12968
+ }
12931
12969
  // Handle streaming message content (chat text)
12932
- if (messageData.data !== undefined || messageData.eos !== undefined) {
12970
+ if ((messageData === null || messageData === void 0 ? void 0 : messageData.type) !== "chat_messages" &&
12971
+ (messageData.data !== undefined || messageData.eos !== undefined)) {
12933
12972
  const messageText = messageData.data || "";
12934
12973
  // If we have content to add, update the in-memory streaming message and Redux
12935
12974
  if (messageText && currentStreamingMessage.current) {
@@ -12945,28 +12984,28 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
12945
12984
  };
12946
12985
  onStreamingMessageUpdate === null || onStreamingMessageUpdate === void 0 ? void 0 : onStreamingMessageUpdate(currentStreamingMessage.current);
12947
12986
  // Update or add message in Redux store
12948
- if ((_t = currentStreamingMessage.current) === null || _t === void 0 ? void 0 : _t.id) {
12987
+ if ((_w = currentStreamingMessage.current) === null || _w === void 0 ? void 0 : _w.id) {
12949
12988
  // TODO: Investigate why `appendMessageToActiveTab` is consuming this action payload
12950
12989
  dispatch(chatActions.appendMessageToActiveTab(undefined));
12951
12990
  }
12952
12991
  }
12953
- // Handle end of stream
12954
12992
  if (messageData.eos) {
12993
+ // Handle end of stream
12955
12994
  const hasPendingArtifact = !!pendingArtifactVersion.current;
12956
- const hasMessageContent = !!((_u = currentStreamingMessage.current) === null || _u === void 0 ? void 0 : _u.content) &&
12995
+ const hasMessageContent = !!((_x = currentStreamingMessage.current) === null || _x === void 0 ? void 0 : _x.content) &&
12957
12996
  currentStreamingMessage.current.content.length > 0;
12958
12997
  console.log("[ws-message] End of stream (EOS) received:", {
12959
- generationId: (_v = currentStreamingMessage.current) === null || _v === void 0 ? void 0 : _v.id,
12960
- finalContentLength: (_x = (_w = currentStreamingMessage.current) === null || _w === void 0 ? void 0 : _w.content) === null || _x === void 0 ? void 0 : _x.length,
12961
- hasContent: !!((_y = currentStreamingMessage.current) === null || _y === void 0 ? void 0 : _y.content),
12998
+ generationId: (_y = currentStreamingMessage.current) === null || _y === void 0 ? void 0 : _y.id,
12999
+ finalContentLength: (_0 = (_z = currentStreamingMessage.current) === null || _z === void 0 ? void 0 : _z.content) === null || _0 === void 0 ? void 0 : _0.length,
13000
+ hasContent: !!((_1 = currentStreamingMessage.current) === null || _1 === void 0 ? void 0 : _1.content),
12962
13001
  hasPendingArtifact,
12963
13002
  });
12964
13003
  // Final update to Redux store with complete message
12965
- if (((_z = currentStreamingMessage.current) === null || _z === void 0 ? void 0 : _z.id) &&
13004
+ if (((_2 = currentStreamingMessage.current) === null || _2 === void 0 ? void 0 : _2.id) &&
12966
13005
  (hasMessageContent || hasPendingArtifact)) {
12967
13006
  console.log("[ws-message] Is currentStreamingMessage.current", {
12968
- id: (_0 = currentStreamingMessage.current) === null || _0 === void 0 ? void 0 : _0.id,
12969
- content: (_1 = currentStreamingMessage.current) === null || _1 === void 0 ? void 0 : _1.content,
13007
+ id: (_3 = currentStreamingMessage.current) === null || _3 === void 0 ? void 0 : _3.id,
13008
+ content: (_4 = currentStreamingMessage.current) === null || _4 === void 0 ? void 0 : _4.content,
12970
13009
  });
12971
13010
  // TODO: Investigate why `appendMessageToActiveTab` is consuming this action payload
12972
13011
  dispatch(chatActions.appendMessageToActiveTab(undefined));
@@ -13021,7 +13060,7 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
13021
13060
  onStatusChange("error");
13022
13061
  }
13023
13062
  });
13024
- socket.addEventListener("error", (error) => {
13063
+ socket.addEventListener("error", () => {
13025
13064
  // Don't show error if we're offline in Tauri - this is expected
13026
13065
  // Check both the ref AND navigator.onLine (the ref may not be updated yet)
13027
13066
  const isLikelyOffline = isOfflineRef.current || (isTauriApp() && !navigator.onLine);
@@ -13690,7 +13729,7 @@ function useAdvancedChat({ tenantKey, mentorId, username = ANONYMOUS_USERNAME, t
13690
13729
  ...result,
13691
13730
  role: result.type === "human" ? "user" : "assistant",
13692
13731
  visible: true,
13693
- id: new Date().getTime(),
13732
+ id: result.id || new Date().getTime(),
13694
13733
  content: typeof result.content === "object" &&
13695
13734
  result.content.length > 0
13696
13735
  ? (_c = result.content.find((item) => item.text)) === null || _c === void 0 ? void 0 : _c.text