@chainlit/react-client 0.2.1 → 0.2.2
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 +1 -2
- package/dist/index.d.mts +40 -43
- package/dist/index.d.ts +40 -43
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -7,14 +7,14 @@ import * as swr__internal from 'swr/_internal';
|
|
|
7
7
|
import { SWRConfiguration } from 'swr';
|
|
8
8
|
|
|
9
9
|
interface IAction {
|
|
10
|
-
|
|
10
|
+
label: string;
|
|
11
11
|
forId: string;
|
|
12
12
|
id: string;
|
|
13
|
-
|
|
13
|
+
payload: Record<string, unknown>;
|
|
14
14
|
name: string;
|
|
15
15
|
onClick: () => void;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
tooltip: string;
|
|
17
|
+
icon?: string;
|
|
18
18
|
}
|
|
19
19
|
interface ICallFn {
|
|
20
20
|
callback: (payload: Record<string, any>) => void;
|
|
@@ -22,8 +22,8 @@ interface ICallFn {
|
|
|
22
22
|
args: Record<string, any>;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
type IElement = IImageElement | ITextElement | IPdfElement | ITasklistElement | IAudioElement | IVideoElement | IFileElement | IPlotlyElement | IDataframeElement;
|
|
26
|
-
type IMessageElement = IImageElement | ITextElement | IPdfElement | IAudioElement | IVideoElement | IFileElement | IPlotlyElement | IDataframeElement;
|
|
25
|
+
type IElement = IImageElement | ITextElement | IPdfElement | ITasklistElement | IAudioElement | IVideoElement | IFileElement | IPlotlyElement | IDataframeElement | ICustomElement;
|
|
26
|
+
type IMessageElement = IImageElement | ITextElement | IPdfElement | IAudioElement | IVideoElement | IFileElement | IPlotlyElement | IDataframeElement | ICustomElement;
|
|
27
27
|
type ElementType = IElement['type'];
|
|
28
28
|
type IElementSize = 'small' | 'medium' | 'large';
|
|
29
29
|
interface TElement<T> {
|
|
@@ -61,6 +61,9 @@ interface IFileElement extends TMessageElement<'file'> {
|
|
|
61
61
|
type IPlotlyElement = TMessageElement<'plotly'>;
|
|
62
62
|
type ITasklistElement = TElement<'tasklist'>;
|
|
63
63
|
type IDataframeElement = TMessageElement<'dataframe'>;
|
|
64
|
+
interface ICustomElement extends TMessageElement<'custom'> {
|
|
65
|
+
props: Record<string, unknown>;
|
|
66
|
+
}
|
|
64
67
|
|
|
65
68
|
interface IFeedback {
|
|
66
69
|
id?: string;
|
|
@@ -170,18 +173,19 @@ interface IAuthConfig {
|
|
|
170
173
|
requireLogin: boolean;
|
|
171
174
|
passwordAuth: boolean;
|
|
172
175
|
headerAuth: boolean;
|
|
173
|
-
cookieAuth: boolean;
|
|
174
176
|
oauthProviders: string[];
|
|
177
|
+
default_theme?: 'light' | 'dark';
|
|
175
178
|
}
|
|
176
179
|
interface IChainlitConfig {
|
|
177
180
|
markdown?: string;
|
|
178
181
|
ui: {
|
|
179
182
|
name: string;
|
|
180
183
|
description?: string;
|
|
184
|
+
font_family?: string;
|
|
185
|
+
default_theme?: 'light' | 'dark';
|
|
186
|
+
layout?: 'default' | 'wide';
|
|
181
187
|
cot: 'hidden' | 'tool_call' | 'full';
|
|
182
|
-
default_collapse_content?: boolean;
|
|
183
188
|
github?: string;
|
|
184
|
-
theme: any;
|
|
185
189
|
custom_css?: string;
|
|
186
190
|
custom_js?: string;
|
|
187
191
|
custom_font?: string;
|
|
@@ -237,11 +241,6 @@ declare const useChatInteract: () => {
|
|
|
237
241
|
id: string;
|
|
238
242
|
}>;
|
|
239
243
|
};
|
|
240
|
-
callAction: (action: IAction) => Promise<{
|
|
241
|
-
id: string;
|
|
242
|
-
status: boolean;
|
|
243
|
-
response?: string | undefined;
|
|
244
|
-
}> | undefined;
|
|
245
244
|
clear: () => void;
|
|
246
245
|
replyMessage: (message: IStep) => void;
|
|
247
246
|
sendMessage: (message: PartialBy<IStep, 'createdAt' | 'id'>, fileReferences?: IFileRef[]) => void;
|
|
@@ -285,8 +284,7 @@ declare const chatSettingsValueState: recoil.RecoilState<any>;
|
|
|
285
284
|
declare const elementState: recoil.RecoilState<IMessageElement[]>;
|
|
286
285
|
declare const tasklistState: recoil.RecoilState<ITasklistElement[]>;
|
|
287
286
|
declare const firstUserInteraction: recoil.RecoilState<string | undefined>;
|
|
288
|
-
declare const
|
|
289
|
-
declare const userState: recoil.RecoilState<IUser | null>;
|
|
287
|
+
declare const userState: recoil.RecoilState<IUser | null | undefined>;
|
|
290
288
|
declare const configState: recoil.RecoilState<IChainlitConfig | undefined>;
|
|
291
289
|
declare const authState: recoil.RecoilState<IAuthConfig | undefined>;
|
|
292
290
|
declare const threadHistoryState: recoil.RecoilState<ThreadHistory | undefined>;
|
|
@@ -294,10 +292,9 @@ declare const sideViewState: recoil.RecoilState<IMessageElement | undefined>;
|
|
|
294
292
|
declare const currentThreadIdState: recoil.RecoilState<string | undefined>;
|
|
295
293
|
|
|
296
294
|
declare const useChatSession: () => {
|
|
297
|
-
connect: lodash.DebouncedFunc<({ transports, userEnv
|
|
295
|
+
connect: lodash.DebouncedFunc<({ transports, userEnv }: {
|
|
298
296
|
transports?: string[] | undefined;
|
|
299
297
|
userEnv: Record<string, string>;
|
|
300
|
-
accessToken?: string | undefined;
|
|
301
298
|
}) => void>;
|
|
302
299
|
disconnect: () => void;
|
|
303
300
|
session: ISession | undefined;
|
|
@@ -316,7 +313,7 @@ declare const useAudio: () => {
|
|
|
316
313
|
wavStreamPlayer: any;
|
|
317
314
|
};
|
|
318
315
|
|
|
319
|
-
declare const useConfig: (
|
|
316
|
+
declare const useConfig: () => {
|
|
320
317
|
config: IChainlitConfig | undefined;
|
|
321
318
|
error: Error | undefined;
|
|
322
319
|
isLoading: boolean;
|
|
@@ -328,27 +325,19 @@ declare const useAuth: () => {
|
|
|
328
325
|
user: null;
|
|
329
326
|
isReady: boolean;
|
|
330
327
|
isAuthenticated: boolean;
|
|
331
|
-
accessToken: string;
|
|
332
328
|
logout: () => Promise<void>;
|
|
333
|
-
setAccessToken: () => void;
|
|
334
329
|
setUserFromAPI: () => Promise<void>;
|
|
335
|
-
cookieAuth: boolean | undefined;
|
|
336
330
|
} | {
|
|
337
331
|
data: IAuthConfig | undefined;
|
|
338
|
-
user: IUser | null;
|
|
332
|
+
user: IUser | null | undefined;
|
|
339
333
|
isReady: boolean;
|
|
340
334
|
isAuthenticated: boolean;
|
|
341
|
-
accessToken: string | undefined;
|
|
342
335
|
logout: (reload?: boolean) => Promise<void>;
|
|
343
|
-
setAccessToken: (token: string) => void;
|
|
344
336
|
setUserFromAPI: swr__internal.KeyedMutator<IUser>;
|
|
345
|
-
cookieAuth: boolean | undefined;
|
|
346
337
|
};
|
|
347
338
|
|
|
348
|
-
declare const fetcher: (client: ChainlitAPI, endpoint: string
|
|
349
|
-
declare function useApi<T>(path?: string | null, {
|
|
350
|
-
token?: string;
|
|
351
|
-
}): swr__internal.SWRResponse<T, Error, Partial<swr__internal.PublicConfiguration<T, Error, swr__internal.BareFetcher<T>>> | undefined>;
|
|
339
|
+
declare const fetcher: (client: ChainlitAPI, endpoint: string) => Promise<any>;
|
|
340
|
+
declare function useApi<T>(path?: string | null, { ...swrConfig }?: SWRConfiguration): swr__internal.SWRResponse<T, Error, Partial<swr__internal.PublicConfiguration<T, Error, swr__internal.BareFetcher<T>>> | undefined>;
|
|
352
341
|
|
|
353
342
|
interface IThreadFilters {
|
|
354
343
|
search?: string;
|
|
@@ -378,36 +367,44 @@ declare class APIBase {
|
|
|
378
367
|
buildEndpoint(path: string): string;
|
|
379
368
|
private getDetailFromErrorResponse;
|
|
380
369
|
private handleRequestError;
|
|
381
|
-
fetch(method: string, path: string,
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
370
|
+
fetch(method: string, path: string, data?: Payload, signal?: AbortSignal, headers?: {
|
|
371
|
+
Authorization?: string;
|
|
372
|
+
'Content-Type'?: string;
|
|
373
|
+
}): Promise<Response>;
|
|
374
|
+
get(endpoint: string): Promise<Response>;
|
|
375
|
+
post(endpoint: string, data: Payload, signal?: AbortSignal): Promise<Response>;
|
|
376
|
+
put(endpoint: string, data: Payload): Promise<Response>;
|
|
377
|
+
patch(endpoint: string, data: Payload): Promise<Response>;
|
|
378
|
+
delete(endpoint: string, data: Payload): Promise<Response>;
|
|
387
379
|
}
|
|
388
380
|
declare class ChainlitAPI extends APIBase {
|
|
389
381
|
headerAuth(): Promise<any>;
|
|
382
|
+
jwtAuth(token: string): Promise<any>;
|
|
390
383
|
passwordAuth(data: FormData): Promise<any>;
|
|
391
|
-
getUser(
|
|
384
|
+
getUser(): Promise<IUser>;
|
|
392
385
|
logout(): Promise<any>;
|
|
393
|
-
setFeedback(feedback: IFeedback
|
|
386
|
+
setFeedback(feedback: IFeedback): Promise<{
|
|
394
387
|
success: boolean;
|
|
395
388
|
feedbackId: string;
|
|
396
389
|
}>;
|
|
397
|
-
deleteFeedback(feedbackId: string
|
|
390
|
+
deleteFeedback(feedbackId: string): Promise<{
|
|
398
391
|
success: boolean;
|
|
399
392
|
}>;
|
|
400
|
-
listThreads(pagination: IPagination, filter: IThreadFilters
|
|
393
|
+
listThreads(pagination: IPagination, filter: IThreadFilters): Promise<{
|
|
401
394
|
pageInfo: IPageInfo;
|
|
402
395
|
data: IThread[];
|
|
403
396
|
}>;
|
|
404
|
-
|
|
405
|
-
|
|
397
|
+
renameThread(threadId: string, name: string): Promise<any>;
|
|
398
|
+
deleteThread(threadId: string): Promise<any>;
|
|
399
|
+
uploadFile(file: File, onProgress: (progress: number) => void, sessionId: string): {
|
|
406
400
|
xhr: XMLHttpRequest;
|
|
407
401
|
promise: Promise<{
|
|
408
402
|
id: string;
|
|
409
403
|
}>;
|
|
410
404
|
};
|
|
405
|
+
callAction(action: IAction, sessionId: string): Promise<any>;
|
|
406
|
+
updateElement(element: IElement, sessionId: string): Promise<any>;
|
|
407
|
+
deleteElement(element: IElement, sessionId: string): Promise<any>;
|
|
411
408
|
getElementUrl(id: string, sessionId: string): string;
|
|
412
409
|
getLogoEndpoint(theme: string): string;
|
|
413
410
|
getOAuthEndpoint(provider: string): string;
|
|
@@ -429,4 +426,4 @@ declare const WavRenderer: {
|
|
|
429
426
|
drawBars: (ctx: CanvasRenderingContext2D, data: Float32Array, cssWidth: number, cssHeight: number, color: string, pointCount?: number, barWidth?: number, barSpacing?: number, center?: boolean) => void;
|
|
430
427
|
};
|
|
431
428
|
|
|
432
|
-
export { APIBase, ActionSpec, AuthProvider, ChainlitAPI, ChainlitContext, ChatProfile, ClientError, ElementType, FileSpec, IAction, IAsk, IAudioConfig, IAudioElement, IAuthConfig, ICallFn, IChainlitConfig, IDataframeElement, IElement, IElementSize, IFeedback, IFileElement, IFileRef, IImageElement, IMessageElement, IPageInfo, IPagination, IPdfElement, IPlotlyElement, ISession, IStarter, IStep, ITasklistElement, ITextElement, IThread, IThreadFilters, IToken, IUser, IUserMetadata, IVideoElement, ThreadHistory, UserInput, WavRenderer,
|
|
429
|
+
export { APIBase, ActionSpec, AuthProvider, ChainlitAPI, ChainlitContext, ChatProfile, ClientError, ElementType, FileSpec, IAction, IAsk, IAudioConfig, IAudioElement, IAuthConfig, ICallFn, IChainlitConfig, ICustomElement, IDataframeElement, IElement, IElementSize, IFeedback, IFileElement, IFileRef, IImageElement, IMessageElement, IPageInfo, IPagination, IPdfElement, IPlotlyElement, ISession, IStarter, IStep, ITasklistElement, ITextElement, IThread, IThreadFilters, IToken, IUser, IUserMetadata, IVideoElement, ThreadHistory, UserInput, WavRenderer, actionState, addMessage, addMessageToParent, askUserState, audioConnectionState, authState, callFnState, chatProfileState, chatSettingsDefaultValueSelector, chatSettingsInputsState, chatSettingsValueState, configState, currentThreadIdState, defaultChainlitContext, deleteMessageById, elementState, fetcher, firstUserInteraction, hasMessageById, isAiSpeakingState, isLastMessage, loadingState, messagesState, nestMessages, sessionIdState, sessionState, sideViewState, tasklistState, threadHistoryState, threadIdToResumeState, tokenCountState, updateMessageById, updateMessageContentById, useApi, useAudio, useAuth, useChatData, useChatInteract, useChatMessages, useChatSession, useConfig, userState, wavRecorderState, wavStreamPlayerState };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,14 +7,14 @@ import * as swr__internal from 'swr/_internal';
|
|
|
7
7
|
import { SWRConfiguration } from 'swr';
|
|
8
8
|
|
|
9
9
|
interface IAction {
|
|
10
|
-
|
|
10
|
+
label: string;
|
|
11
11
|
forId: string;
|
|
12
12
|
id: string;
|
|
13
|
-
|
|
13
|
+
payload: Record<string, unknown>;
|
|
14
14
|
name: string;
|
|
15
15
|
onClick: () => void;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
tooltip: string;
|
|
17
|
+
icon?: string;
|
|
18
18
|
}
|
|
19
19
|
interface ICallFn {
|
|
20
20
|
callback: (payload: Record<string, any>) => void;
|
|
@@ -22,8 +22,8 @@ interface ICallFn {
|
|
|
22
22
|
args: Record<string, any>;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
type IElement = IImageElement | ITextElement | IPdfElement | ITasklistElement | IAudioElement | IVideoElement | IFileElement | IPlotlyElement | IDataframeElement;
|
|
26
|
-
type IMessageElement = IImageElement | ITextElement | IPdfElement | IAudioElement | IVideoElement | IFileElement | IPlotlyElement | IDataframeElement;
|
|
25
|
+
type IElement = IImageElement | ITextElement | IPdfElement | ITasklistElement | IAudioElement | IVideoElement | IFileElement | IPlotlyElement | IDataframeElement | ICustomElement;
|
|
26
|
+
type IMessageElement = IImageElement | ITextElement | IPdfElement | IAudioElement | IVideoElement | IFileElement | IPlotlyElement | IDataframeElement | ICustomElement;
|
|
27
27
|
type ElementType = IElement['type'];
|
|
28
28
|
type IElementSize = 'small' | 'medium' | 'large';
|
|
29
29
|
interface TElement<T> {
|
|
@@ -61,6 +61,9 @@ interface IFileElement extends TMessageElement<'file'> {
|
|
|
61
61
|
type IPlotlyElement = TMessageElement<'plotly'>;
|
|
62
62
|
type ITasklistElement = TElement<'tasklist'>;
|
|
63
63
|
type IDataframeElement = TMessageElement<'dataframe'>;
|
|
64
|
+
interface ICustomElement extends TMessageElement<'custom'> {
|
|
65
|
+
props: Record<string, unknown>;
|
|
66
|
+
}
|
|
64
67
|
|
|
65
68
|
interface IFeedback {
|
|
66
69
|
id?: string;
|
|
@@ -170,18 +173,19 @@ interface IAuthConfig {
|
|
|
170
173
|
requireLogin: boolean;
|
|
171
174
|
passwordAuth: boolean;
|
|
172
175
|
headerAuth: boolean;
|
|
173
|
-
cookieAuth: boolean;
|
|
174
176
|
oauthProviders: string[];
|
|
177
|
+
default_theme?: 'light' | 'dark';
|
|
175
178
|
}
|
|
176
179
|
interface IChainlitConfig {
|
|
177
180
|
markdown?: string;
|
|
178
181
|
ui: {
|
|
179
182
|
name: string;
|
|
180
183
|
description?: string;
|
|
184
|
+
font_family?: string;
|
|
185
|
+
default_theme?: 'light' | 'dark';
|
|
186
|
+
layout?: 'default' | 'wide';
|
|
181
187
|
cot: 'hidden' | 'tool_call' | 'full';
|
|
182
|
-
default_collapse_content?: boolean;
|
|
183
188
|
github?: string;
|
|
184
|
-
theme: any;
|
|
185
189
|
custom_css?: string;
|
|
186
190
|
custom_js?: string;
|
|
187
191
|
custom_font?: string;
|
|
@@ -237,11 +241,6 @@ declare const useChatInteract: () => {
|
|
|
237
241
|
id: string;
|
|
238
242
|
}>;
|
|
239
243
|
};
|
|
240
|
-
callAction: (action: IAction) => Promise<{
|
|
241
|
-
id: string;
|
|
242
|
-
status: boolean;
|
|
243
|
-
response?: string | undefined;
|
|
244
|
-
}> | undefined;
|
|
245
244
|
clear: () => void;
|
|
246
245
|
replyMessage: (message: IStep) => void;
|
|
247
246
|
sendMessage: (message: PartialBy<IStep, 'createdAt' | 'id'>, fileReferences?: IFileRef[]) => void;
|
|
@@ -285,8 +284,7 @@ declare const chatSettingsValueState: recoil.RecoilState<any>;
|
|
|
285
284
|
declare const elementState: recoil.RecoilState<IMessageElement[]>;
|
|
286
285
|
declare const tasklistState: recoil.RecoilState<ITasklistElement[]>;
|
|
287
286
|
declare const firstUserInteraction: recoil.RecoilState<string | undefined>;
|
|
288
|
-
declare const
|
|
289
|
-
declare const userState: recoil.RecoilState<IUser | null>;
|
|
287
|
+
declare const userState: recoil.RecoilState<IUser | null | undefined>;
|
|
290
288
|
declare const configState: recoil.RecoilState<IChainlitConfig | undefined>;
|
|
291
289
|
declare const authState: recoil.RecoilState<IAuthConfig | undefined>;
|
|
292
290
|
declare const threadHistoryState: recoil.RecoilState<ThreadHistory | undefined>;
|
|
@@ -294,10 +292,9 @@ declare const sideViewState: recoil.RecoilState<IMessageElement | undefined>;
|
|
|
294
292
|
declare const currentThreadIdState: recoil.RecoilState<string | undefined>;
|
|
295
293
|
|
|
296
294
|
declare const useChatSession: () => {
|
|
297
|
-
connect: lodash.DebouncedFunc<({ transports, userEnv
|
|
295
|
+
connect: lodash.DebouncedFunc<({ transports, userEnv }: {
|
|
298
296
|
transports?: string[] | undefined;
|
|
299
297
|
userEnv: Record<string, string>;
|
|
300
|
-
accessToken?: string | undefined;
|
|
301
298
|
}) => void>;
|
|
302
299
|
disconnect: () => void;
|
|
303
300
|
session: ISession | undefined;
|
|
@@ -316,7 +313,7 @@ declare const useAudio: () => {
|
|
|
316
313
|
wavStreamPlayer: any;
|
|
317
314
|
};
|
|
318
315
|
|
|
319
|
-
declare const useConfig: (
|
|
316
|
+
declare const useConfig: () => {
|
|
320
317
|
config: IChainlitConfig | undefined;
|
|
321
318
|
error: Error | undefined;
|
|
322
319
|
isLoading: boolean;
|
|
@@ -328,27 +325,19 @@ declare const useAuth: () => {
|
|
|
328
325
|
user: null;
|
|
329
326
|
isReady: boolean;
|
|
330
327
|
isAuthenticated: boolean;
|
|
331
|
-
accessToken: string;
|
|
332
328
|
logout: () => Promise<void>;
|
|
333
|
-
setAccessToken: () => void;
|
|
334
329
|
setUserFromAPI: () => Promise<void>;
|
|
335
|
-
cookieAuth: boolean | undefined;
|
|
336
330
|
} | {
|
|
337
331
|
data: IAuthConfig | undefined;
|
|
338
|
-
user: IUser | null;
|
|
332
|
+
user: IUser | null | undefined;
|
|
339
333
|
isReady: boolean;
|
|
340
334
|
isAuthenticated: boolean;
|
|
341
|
-
accessToken: string | undefined;
|
|
342
335
|
logout: (reload?: boolean) => Promise<void>;
|
|
343
|
-
setAccessToken: (token: string) => void;
|
|
344
336
|
setUserFromAPI: swr__internal.KeyedMutator<IUser>;
|
|
345
|
-
cookieAuth: boolean | undefined;
|
|
346
337
|
};
|
|
347
338
|
|
|
348
|
-
declare const fetcher: (client: ChainlitAPI, endpoint: string
|
|
349
|
-
declare function useApi<T>(path?: string | null, {
|
|
350
|
-
token?: string;
|
|
351
|
-
}): swr__internal.SWRResponse<T, Error, Partial<swr__internal.PublicConfiguration<T, Error, swr__internal.BareFetcher<T>>> | undefined>;
|
|
339
|
+
declare const fetcher: (client: ChainlitAPI, endpoint: string) => Promise<any>;
|
|
340
|
+
declare function useApi<T>(path?: string | null, { ...swrConfig }?: SWRConfiguration): swr__internal.SWRResponse<T, Error, Partial<swr__internal.PublicConfiguration<T, Error, swr__internal.BareFetcher<T>>> | undefined>;
|
|
352
341
|
|
|
353
342
|
interface IThreadFilters {
|
|
354
343
|
search?: string;
|
|
@@ -378,36 +367,44 @@ declare class APIBase {
|
|
|
378
367
|
buildEndpoint(path: string): string;
|
|
379
368
|
private getDetailFromErrorResponse;
|
|
380
369
|
private handleRequestError;
|
|
381
|
-
fetch(method: string, path: string,
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
370
|
+
fetch(method: string, path: string, data?: Payload, signal?: AbortSignal, headers?: {
|
|
371
|
+
Authorization?: string;
|
|
372
|
+
'Content-Type'?: string;
|
|
373
|
+
}): Promise<Response>;
|
|
374
|
+
get(endpoint: string): Promise<Response>;
|
|
375
|
+
post(endpoint: string, data: Payload, signal?: AbortSignal): Promise<Response>;
|
|
376
|
+
put(endpoint: string, data: Payload): Promise<Response>;
|
|
377
|
+
patch(endpoint: string, data: Payload): Promise<Response>;
|
|
378
|
+
delete(endpoint: string, data: Payload): Promise<Response>;
|
|
387
379
|
}
|
|
388
380
|
declare class ChainlitAPI extends APIBase {
|
|
389
381
|
headerAuth(): Promise<any>;
|
|
382
|
+
jwtAuth(token: string): Promise<any>;
|
|
390
383
|
passwordAuth(data: FormData): Promise<any>;
|
|
391
|
-
getUser(
|
|
384
|
+
getUser(): Promise<IUser>;
|
|
392
385
|
logout(): Promise<any>;
|
|
393
|
-
setFeedback(feedback: IFeedback
|
|
386
|
+
setFeedback(feedback: IFeedback): Promise<{
|
|
394
387
|
success: boolean;
|
|
395
388
|
feedbackId: string;
|
|
396
389
|
}>;
|
|
397
|
-
deleteFeedback(feedbackId: string
|
|
390
|
+
deleteFeedback(feedbackId: string): Promise<{
|
|
398
391
|
success: boolean;
|
|
399
392
|
}>;
|
|
400
|
-
listThreads(pagination: IPagination, filter: IThreadFilters
|
|
393
|
+
listThreads(pagination: IPagination, filter: IThreadFilters): Promise<{
|
|
401
394
|
pageInfo: IPageInfo;
|
|
402
395
|
data: IThread[];
|
|
403
396
|
}>;
|
|
404
|
-
|
|
405
|
-
|
|
397
|
+
renameThread(threadId: string, name: string): Promise<any>;
|
|
398
|
+
deleteThread(threadId: string): Promise<any>;
|
|
399
|
+
uploadFile(file: File, onProgress: (progress: number) => void, sessionId: string): {
|
|
406
400
|
xhr: XMLHttpRequest;
|
|
407
401
|
promise: Promise<{
|
|
408
402
|
id: string;
|
|
409
403
|
}>;
|
|
410
404
|
};
|
|
405
|
+
callAction(action: IAction, sessionId: string): Promise<any>;
|
|
406
|
+
updateElement(element: IElement, sessionId: string): Promise<any>;
|
|
407
|
+
deleteElement(element: IElement, sessionId: string): Promise<any>;
|
|
411
408
|
getElementUrl(id: string, sessionId: string): string;
|
|
412
409
|
getLogoEndpoint(theme: string): string;
|
|
413
410
|
getOAuthEndpoint(provider: string): string;
|
|
@@ -429,4 +426,4 @@ declare const WavRenderer: {
|
|
|
429
426
|
drawBars: (ctx: CanvasRenderingContext2D, data: Float32Array, cssWidth: number, cssHeight: number, color: string, pointCount?: number, barWidth?: number, barSpacing?: number, center?: boolean) => void;
|
|
430
427
|
};
|
|
431
428
|
|
|
432
|
-
export { APIBase, ActionSpec, AuthProvider, ChainlitAPI, ChainlitContext, ChatProfile, ClientError, ElementType, FileSpec, IAction, IAsk, IAudioConfig, IAudioElement, IAuthConfig, ICallFn, IChainlitConfig, IDataframeElement, IElement, IElementSize, IFeedback, IFileElement, IFileRef, IImageElement, IMessageElement, IPageInfo, IPagination, IPdfElement, IPlotlyElement, ISession, IStarter, IStep, ITasklistElement, ITextElement, IThread, IThreadFilters, IToken, IUser, IUserMetadata, IVideoElement, ThreadHistory, UserInput, WavRenderer,
|
|
429
|
+
export { APIBase, ActionSpec, AuthProvider, ChainlitAPI, ChainlitContext, ChatProfile, ClientError, ElementType, FileSpec, IAction, IAsk, IAudioConfig, IAudioElement, IAuthConfig, ICallFn, IChainlitConfig, ICustomElement, IDataframeElement, IElement, IElementSize, IFeedback, IFileElement, IFileRef, IImageElement, IMessageElement, IPageInfo, IPagination, IPdfElement, IPlotlyElement, ISession, IStarter, IStep, ITasklistElement, ITextElement, IThread, IThreadFilters, IToken, IUser, IUserMetadata, IVideoElement, ThreadHistory, UserInput, WavRenderer, actionState, addMessage, addMessageToParent, askUserState, audioConnectionState, authState, callFnState, chatProfileState, chatSettingsDefaultValueSelector, chatSettingsInputsState, chatSettingsValueState, configState, currentThreadIdState, defaultChainlitContext, deleteMessageById, elementState, fetcher, firstUserInteraction, hasMessageById, isAiSpeakingState, isLastMessage, loadingState, messagesState, nestMessages, sessionIdState, sessionState, sideViewState, tasklistState, threadHistoryState, threadIdToResumeState, tokenCountState, updateMessageById, updateMessageContentById, useApi, useAudio, useAuth, useChatData, useChatInteract, useChatMessages, useChatSession, useConfig, userState, wavRecorderState, wavStreamPlayerState };
|