@superinterface/react 2.17.5 → 2.18.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/index.cjs +170 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +143 -8
- package/dist/index.d.ts +143 -8
- package/dist/index.js +116 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -21,7 +21,7 @@ declare const options: {
|
|
|
21
21
|
}) => any;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
type Args$
|
|
24
|
+
type Args$8 = {
|
|
25
25
|
children: React.ReactNode;
|
|
26
26
|
baseUrl?: string;
|
|
27
27
|
variables?: {
|
|
@@ -33,7 +33,7 @@ type Args$7 = {
|
|
|
33
33
|
};
|
|
34
34
|
threadIdCookieOptions?: typeof options | null;
|
|
35
35
|
};
|
|
36
|
-
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdCookieOptions, }: Args$
|
|
36
|
+
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdCookieOptions, }: Args$8) => react_jsx_runtime.JSX.Element;
|
|
37
37
|
|
|
38
38
|
declare const useSuperinterfaceContext: () => {
|
|
39
39
|
baseUrl: string | null;
|
|
@@ -46,14 +46,14 @@ declare const useSuperinterfaceContext: () => {
|
|
|
46
46
|
createMessageAbortControllerRef: React.MutableRefObject<AbortController | null>;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
type Args$
|
|
49
|
+
type Args$7 = Args$8;
|
|
50
50
|
|
|
51
|
-
type Args$
|
|
51
|
+
type Args$6 = Args$7;
|
|
52
52
|
|
|
53
|
-
type Args$
|
|
53
|
+
type Args$5 = Omit<Args$6, 'children'>;
|
|
54
54
|
declare const Thread: {
|
|
55
|
-
(props: Args$
|
|
56
|
-
Root: ({ children, ...rest }: Args$
|
|
55
|
+
(props: Args$5): react_jsx_runtime.JSX.Element;
|
|
56
|
+
Root: ({ children, ...rest }: Args$6) => react_jsx_runtime.JSX.Element;
|
|
57
57
|
Messages: {
|
|
58
58
|
({ children, style, }: {
|
|
59
59
|
children?: React.ReactNode;
|
|
@@ -338,6 +338,141 @@ declare const useMessageFormContext: () => {
|
|
|
338
338
|
isFileLoading: boolean;
|
|
339
339
|
};
|
|
340
340
|
|
|
341
|
+
type Args$4 = {
|
|
342
|
+
assistantId: string;
|
|
343
|
+
};
|
|
344
|
+
declare const useAssistant: ({ assistantId, }: Args$4) => {
|
|
345
|
+
assistant: any;
|
|
346
|
+
data: any;
|
|
347
|
+
error: Error;
|
|
348
|
+
isError: true;
|
|
349
|
+
isPending: false;
|
|
350
|
+
isLoading: false;
|
|
351
|
+
isLoadingError: false;
|
|
352
|
+
isRefetchError: true;
|
|
353
|
+
isSuccess: false;
|
|
354
|
+
status: "error";
|
|
355
|
+
dataUpdatedAt: number;
|
|
356
|
+
errorUpdatedAt: number;
|
|
357
|
+
failureCount: number;
|
|
358
|
+
failureReason: Error | null;
|
|
359
|
+
errorUpdateCount: number;
|
|
360
|
+
isFetched: boolean;
|
|
361
|
+
isFetchedAfterMount: boolean;
|
|
362
|
+
isFetching: boolean;
|
|
363
|
+
isInitialLoading: boolean;
|
|
364
|
+
isPaused: boolean;
|
|
365
|
+
isPlaceholderData: boolean;
|
|
366
|
+
isRefetching: boolean;
|
|
367
|
+
isStale: boolean;
|
|
368
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
|
|
369
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
370
|
+
} | {
|
|
371
|
+
assistant: any;
|
|
372
|
+
data: any;
|
|
373
|
+
error: null;
|
|
374
|
+
isError: false;
|
|
375
|
+
isPending: false;
|
|
376
|
+
isLoading: false;
|
|
377
|
+
isLoadingError: false;
|
|
378
|
+
isRefetchError: false;
|
|
379
|
+
isSuccess: true;
|
|
380
|
+
status: "success";
|
|
381
|
+
dataUpdatedAt: number;
|
|
382
|
+
errorUpdatedAt: number;
|
|
383
|
+
failureCount: number;
|
|
384
|
+
failureReason: Error | null;
|
|
385
|
+
errorUpdateCount: number;
|
|
386
|
+
isFetched: boolean;
|
|
387
|
+
isFetchedAfterMount: boolean;
|
|
388
|
+
isFetching: boolean;
|
|
389
|
+
isInitialLoading: boolean;
|
|
390
|
+
isPaused: boolean;
|
|
391
|
+
isPlaceholderData: boolean;
|
|
392
|
+
isRefetching: boolean;
|
|
393
|
+
isStale: boolean;
|
|
394
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
|
|
395
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
396
|
+
} | {
|
|
397
|
+
assistant: any;
|
|
398
|
+
data: undefined;
|
|
399
|
+
error: Error;
|
|
400
|
+
isError: true;
|
|
401
|
+
isPending: false;
|
|
402
|
+
isLoading: false;
|
|
403
|
+
isLoadingError: true;
|
|
404
|
+
isRefetchError: false;
|
|
405
|
+
isSuccess: false;
|
|
406
|
+
status: "error";
|
|
407
|
+
dataUpdatedAt: number;
|
|
408
|
+
errorUpdatedAt: number;
|
|
409
|
+
failureCount: number;
|
|
410
|
+
failureReason: Error | null;
|
|
411
|
+
errorUpdateCount: number;
|
|
412
|
+
isFetched: boolean;
|
|
413
|
+
isFetchedAfterMount: boolean;
|
|
414
|
+
isFetching: boolean;
|
|
415
|
+
isInitialLoading: boolean;
|
|
416
|
+
isPaused: boolean;
|
|
417
|
+
isPlaceholderData: boolean;
|
|
418
|
+
isRefetching: boolean;
|
|
419
|
+
isStale: boolean;
|
|
420
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
|
|
421
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
422
|
+
} | {
|
|
423
|
+
assistant: any;
|
|
424
|
+
data: undefined;
|
|
425
|
+
error: null;
|
|
426
|
+
isError: false;
|
|
427
|
+
isPending: true;
|
|
428
|
+
isLoading: true;
|
|
429
|
+
isLoadingError: false;
|
|
430
|
+
isRefetchError: false;
|
|
431
|
+
isSuccess: false;
|
|
432
|
+
status: "pending";
|
|
433
|
+
dataUpdatedAt: number;
|
|
434
|
+
errorUpdatedAt: number;
|
|
435
|
+
failureCount: number;
|
|
436
|
+
failureReason: Error | null;
|
|
437
|
+
errorUpdateCount: number;
|
|
438
|
+
isFetched: boolean;
|
|
439
|
+
isFetchedAfterMount: boolean;
|
|
440
|
+
isFetching: boolean;
|
|
441
|
+
isInitialLoading: boolean;
|
|
442
|
+
isPaused: boolean;
|
|
443
|
+
isPlaceholderData: boolean;
|
|
444
|
+
isRefetching: boolean;
|
|
445
|
+
isStale: boolean;
|
|
446
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
|
|
447
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
448
|
+
} | {
|
|
449
|
+
assistant: any;
|
|
450
|
+
data: undefined;
|
|
451
|
+
error: null;
|
|
452
|
+
isError: false;
|
|
453
|
+
isPending: true;
|
|
454
|
+
isLoadingError: false;
|
|
455
|
+
isRefetchError: false;
|
|
456
|
+
isSuccess: false;
|
|
457
|
+
status: "pending";
|
|
458
|
+
dataUpdatedAt: number;
|
|
459
|
+
errorUpdatedAt: number;
|
|
460
|
+
failureCount: number;
|
|
461
|
+
failureReason: Error | null;
|
|
462
|
+
errorUpdateCount: number;
|
|
463
|
+
isFetched: boolean;
|
|
464
|
+
isFetchedAfterMount: boolean;
|
|
465
|
+
isFetching: boolean;
|
|
466
|
+
isLoading: boolean;
|
|
467
|
+
isInitialLoading: boolean;
|
|
468
|
+
isPaused: boolean;
|
|
469
|
+
isPlaceholderData: boolean;
|
|
470
|
+
isRefetching: boolean;
|
|
471
|
+
isStale: boolean;
|
|
472
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
|
|
473
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
474
|
+
};
|
|
475
|
+
|
|
341
476
|
declare const ThreadDialog: {
|
|
342
477
|
(): react_jsx_runtime.JSX.Element;
|
|
343
478
|
Root: ({ children, }: {
|
|
@@ -551,4 +686,4 @@ declare const RunStep: {
|
|
|
551
686
|
};
|
|
552
687
|
};
|
|
553
688
|
|
|
554
|
-
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
|
689
|
+
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ declare const options: {
|
|
|
21
21
|
}) => any;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
type Args$
|
|
24
|
+
type Args$8 = {
|
|
25
25
|
children: React.ReactNode;
|
|
26
26
|
baseUrl?: string;
|
|
27
27
|
variables?: {
|
|
@@ -33,7 +33,7 @@ type Args$7 = {
|
|
|
33
33
|
};
|
|
34
34
|
threadIdCookieOptions?: typeof options | null;
|
|
35
35
|
};
|
|
36
|
-
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdCookieOptions, }: Args$
|
|
36
|
+
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdCookieOptions, }: Args$8) => react_jsx_runtime.JSX.Element;
|
|
37
37
|
|
|
38
38
|
declare const useSuperinterfaceContext: () => {
|
|
39
39
|
baseUrl: string | null;
|
|
@@ -46,14 +46,14 @@ declare const useSuperinterfaceContext: () => {
|
|
|
46
46
|
createMessageAbortControllerRef: React.MutableRefObject<AbortController | null>;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
type Args$
|
|
49
|
+
type Args$7 = Args$8;
|
|
50
50
|
|
|
51
|
-
type Args$
|
|
51
|
+
type Args$6 = Args$7;
|
|
52
52
|
|
|
53
|
-
type Args$
|
|
53
|
+
type Args$5 = Omit<Args$6, 'children'>;
|
|
54
54
|
declare const Thread: {
|
|
55
|
-
(props: Args$
|
|
56
|
-
Root: ({ children, ...rest }: Args$
|
|
55
|
+
(props: Args$5): react_jsx_runtime.JSX.Element;
|
|
56
|
+
Root: ({ children, ...rest }: Args$6) => react_jsx_runtime.JSX.Element;
|
|
57
57
|
Messages: {
|
|
58
58
|
({ children, style, }: {
|
|
59
59
|
children?: React.ReactNode;
|
|
@@ -338,6 +338,141 @@ declare const useMessageFormContext: () => {
|
|
|
338
338
|
isFileLoading: boolean;
|
|
339
339
|
};
|
|
340
340
|
|
|
341
|
+
type Args$4 = {
|
|
342
|
+
assistantId: string;
|
|
343
|
+
};
|
|
344
|
+
declare const useAssistant: ({ assistantId, }: Args$4) => {
|
|
345
|
+
assistant: any;
|
|
346
|
+
data: any;
|
|
347
|
+
error: Error;
|
|
348
|
+
isError: true;
|
|
349
|
+
isPending: false;
|
|
350
|
+
isLoading: false;
|
|
351
|
+
isLoadingError: false;
|
|
352
|
+
isRefetchError: true;
|
|
353
|
+
isSuccess: false;
|
|
354
|
+
status: "error";
|
|
355
|
+
dataUpdatedAt: number;
|
|
356
|
+
errorUpdatedAt: number;
|
|
357
|
+
failureCount: number;
|
|
358
|
+
failureReason: Error | null;
|
|
359
|
+
errorUpdateCount: number;
|
|
360
|
+
isFetched: boolean;
|
|
361
|
+
isFetchedAfterMount: boolean;
|
|
362
|
+
isFetching: boolean;
|
|
363
|
+
isInitialLoading: boolean;
|
|
364
|
+
isPaused: boolean;
|
|
365
|
+
isPlaceholderData: boolean;
|
|
366
|
+
isRefetching: boolean;
|
|
367
|
+
isStale: boolean;
|
|
368
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
|
|
369
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
370
|
+
} | {
|
|
371
|
+
assistant: any;
|
|
372
|
+
data: any;
|
|
373
|
+
error: null;
|
|
374
|
+
isError: false;
|
|
375
|
+
isPending: false;
|
|
376
|
+
isLoading: false;
|
|
377
|
+
isLoadingError: false;
|
|
378
|
+
isRefetchError: false;
|
|
379
|
+
isSuccess: true;
|
|
380
|
+
status: "success";
|
|
381
|
+
dataUpdatedAt: number;
|
|
382
|
+
errorUpdatedAt: number;
|
|
383
|
+
failureCount: number;
|
|
384
|
+
failureReason: Error | null;
|
|
385
|
+
errorUpdateCount: number;
|
|
386
|
+
isFetched: boolean;
|
|
387
|
+
isFetchedAfterMount: boolean;
|
|
388
|
+
isFetching: boolean;
|
|
389
|
+
isInitialLoading: boolean;
|
|
390
|
+
isPaused: boolean;
|
|
391
|
+
isPlaceholderData: boolean;
|
|
392
|
+
isRefetching: boolean;
|
|
393
|
+
isStale: boolean;
|
|
394
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
|
|
395
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
396
|
+
} | {
|
|
397
|
+
assistant: any;
|
|
398
|
+
data: undefined;
|
|
399
|
+
error: Error;
|
|
400
|
+
isError: true;
|
|
401
|
+
isPending: false;
|
|
402
|
+
isLoading: false;
|
|
403
|
+
isLoadingError: true;
|
|
404
|
+
isRefetchError: false;
|
|
405
|
+
isSuccess: false;
|
|
406
|
+
status: "error";
|
|
407
|
+
dataUpdatedAt: number;
|
|
408
|
+
errorUpdatedAt: number;
|
|
409
|
+
failureCount: number;
|
|
410
|
+
failureReason: Error | null;
|
|
411
|
+
errorUpdateCount: number;
|
|
412
|
+
isFetched: boolean;
|
|
413
|
+
isFetchedAfterMount: boolean;
|
|
414
|
+
isFetching: boolean;
|
|
415
|
+
isInitialLoading: boolean;
|
|
416
|
+
isPaused: boolean;
|
|
417
|
+
isPlaceholderData: boolean;
|
|
418
|
+
isRefetching: boolean;
|
|
419
|
+
isStale: boolean;
|
|
420
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
|
|
421
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
422
|
+
} | {
|
|
423
|
+
assistant: any;
|
|
424
|
+
data: undefined;
|
|
425
|
+
error: null;
|
|
426
|
+
isError: false;
|
|
427
|
+
isPending: true;
|
|
428
|
+
isLoading: true;
|
|
429
|
+
isLoadingError: false;
|
|
430
|
+
isRefetchError: false;
|
|
431
|
+
isSuccess: false;
|
|
432
|
+
status: "pending";
|
|
433
|
+
dataUpdatedAt: number;
|
|
434
|
+
errorUpdatedAt: number;
|
|
435
|
+
failureCount: number;
|
|
436
|
+
failureReason: Error | null;
|
|
437
|
+
errorUpdateCount: number;
|
|
438
|
+
isFetched: boolean;
|
|
439
|
+
isFetchedAfterMount: boolean;
|
|
440
|
+
isFetching: boolean;
|
|
441
|
+
isInitialLoading: boolean;
|
|
442
|
+
isPaused: boolean;
|
|
443
|
+
isPlaceholderData: boolean;
|
|
444
|
+
isRefetching: boolean;
|
|
445
|
+
isStale: boolean;
|
|
446
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
|
|
447
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
448
|
+
} | {
|
|
449
|
+
assistant: any;
|
|
450
|
+
data: undefined;
|
|
451
|
+
error: null;
|
|
452
|
+
isError: false;
|
|
453
|
+
isPending: true;
|
|
454
|
+
isLoadingError: false;
|
|
455
|
+
isRefetchError: false;
|
|
456
|
+
isSuccess: false;
|
|
457
|
+
status: "pending";
|
|
458
|
+
dataUpdatedAt: number;
|
|
459
|
+
errorUpdatedAt: number;
|
|
460
|
+
failureCount: number;
|
|
461
|
+
failureReason: Error | null;
|
|
462
|
+
errorUpdateCount: number;
|
|
463
|
+
isFetched: boolean;
|
|
464
|
+
isFetchedAfterMount: boolean;
|
|
465
|
+
isFetching: boolean;
|
|
466
|
+
isLoading: boolean;
|
|
467
|
+
isInitialLoading: boolean;
|
|
468
|
+
isPaused: boolean;
|
|
469
|
+
isPlaceholderData: boolean;
|
|
470
|
+
isRefetching: boolean;
|
|
471
|
+
isStale: boolean;
|
|
472
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
|
|
473
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
474
|
+
};
|
|
475
|
+
|
|
341
476
|
declare const ThreadDialog: {
|
|
342
477
|
(): react_jsx_runtime.JSX.Element;
|
|
343
478
|
Root: ({ children, }: {
|
|
@@ -551,4 +686,4 @@ declare const RunStep: {
|
|
|
551
686
|
};
|
|
552
687
|
};
|
|
553
688
|
|
|
554
|
-
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
|
689
|
+
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
package/dist/index.js
CHANGED
|
@@ -3248,6 +3248,104 @@ import { useContext as useContext12 } from "react";
|
|
|
3248
3248
|
var useMessageContext = function() {
|
|
3249
3249
|
return useContext12(MessageContext);
|
|
3250
3250
|
};
|
|
3251
|
+
// src/hooks/assistants/useAssistant/index.ts
|
|
3252
|
+
import { useMemo as useMemo10 } from "react";
|
|
3253
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3254
|
+
// src/hooks/assistants/useAssistant/lib/queryOptions/index.ts
|
|
3255
|
+
import { queryOptions as tanstackQueryOptions } from "@tanstack/react-query";
|
|
3256
|
+
// src/hooks/assistants/useAssistant/lib/queryOptions/queryFn.ts
|
|
3257
|
+
var queryFn = function(param) {
|
|
3258
|
+
var superinterfaceContext = param.superinterfaceContext;
|
|
3259
|
+
return function() {
|
|
3260
|
+
var _ref = _async_to_generator(function(param) {
|
|
3261
|
+
var queryKey, _queryKey, _key, assistantId, params;
|
|
3262
|
+
return _ts_generator(this, function(_state) {
|
|
3263
|
+
queryKey = param.queryKey;
|
|
3264
|
+
_queryKey = _sliced_to_array(queryKey, 2), _key = _queryKey[0], assistantId = _queryKey[1].assistantId;
|
|
3265
|
+
params = new URLSearchParams({
|
|
3266
|
+
publicApiKey: superinterfaceContext.variables.publicApiKey
|
|
3267
|
+
});
|
|
3268
|
+
return [
|
|
3269
|
+
2,
|
|
3270
|
+
fetch("".concat(superinterfaceContext.baseUrl, "/assistants/").concat(assistantId, "?").concat(params)).then(function() {
|
|
3271
|
+
var _ref = _async_to_generator(function(response) {
|
|
3272
|
+
var errorResponse, error;
|
|
3273
|
+
return _ts_generator(this, function(_state) {
|
|
3274
|
+
switch(_state.label){
|
|
3275
|
+
case 0:
|
|
3276
|
+
if (!(response.status !== 200)) return [
|
|
3277
|
+
3,
|
|
3278
|
+
4
|
|
3279
|
+
];
|
|
3280
|
+
_state.label = 1;
|
|
3281
|
+
case 1:
|
|
3282
|
+
_state.trys.push([
|
|
3283
|
+
1,
|
|
3284
|
+
3,
|
|
3285
|
+
,
|
|
3286
|
+
4
|
|
3287
|
+
]);
|
|
3288
|
+
return [
|
|
3289
|
+
4,
|
|
3290
|
+
response.json()
|
|
3291
|
+
];
|
|
3292
|
+
case 2:
|
|
3293
|
+
errorResponse = _state.sent();
|
|
3294
|
+
throw new Error(errorResponse.error);
|
|
3295
|
+
case 3:
|
|
3296
|
+
error = _state.sent();
|
|
3297
|
+
throw new Error("Failed to fetch");
|
|
3298
|
+
case 4:
|
|
3299
|
+
return [
|
|
3300
|
+
2,
|
|
3301
|
+
response.json()
|
|
3302
|
+
];
|
|
3303
|
+
}
|
|
3304
|
+
});
|
|
3305
|
+
});
|
|
3306
|
+
return function(response) {
|
|
3307
|
+
return _ref.apply(this, arguments);
|
|
3308
|
+
};
|
|
3309
|
+
}())
|
|
3310
|
+
];
|
|
3311
|
+
});
|
|
3312
|
+
});
|
|
3313
|
+
return function(_) {
|
|
3314
|
+
return _ref.apply(this, arguments);
|
|
3315
|
+
};
|
|
3316
|
+
}();
|
|
3317
|
+
};
|
|
3318
|
+
// src/hooks/assistants/useAssistant/lib/queryOptions/index.ts
|
|
3319
|
+
var queryOptions2 = function(param) {
|
|
3320
|
+
var assistantId = param.assistantId, superinterfaceContext = param.superinterfaceContext;
|
|
3321
|
+
return tanstackQueryOptions({
|
|
3322
|
+
queryKey: [
|
|
3323
|
+
"assistants",
|
|
3324
|
+
{
|
|
3325
|
+
assistantId: assistantId
|
|
3326
|
+
}
|
|
3327
|
+
],
|
|
3328
|
+
queryFn: queryFn({
|
|
3329
|
+
superinterfaceContext: superinterfaceContext
|
|
3330
|
+
})
|
|
3331
|
+
});
|
|
3332
|
+
};
|
|
3333
|
+
// src/hooks/assistants/useAssistant/index.ts
|
|
3334
|
+
var useAssistant = function(param) {
|
|
3335
|
+
var assistantId = param.assistantId;
|
|
3336
|
+
var superinterfaceContext = useSuperinterfaceContext();
|
|
3337
|
+
var props = useQuery(queryOptions2({
|
|
3338
|
+
assistantId: assistantId,
|
|
3339
|
+
superinterfaceContext: superinterfaceContext
|
|
3340
|
+
}));
|
|
3341
|
+
return useMemo10(function() {
|
|
3342
|
+
return _object_spread_props(_object_spread({}, props), {
|
|
3343
|
+
assistant: props.data ? props.data.assistant : null
|
|
3344
|
+
});
|
|
3345
|
+
}, [
|
|
3346
|
+
props
|
|
3347
|
+
]);
|
|
3348
|
+
};
|
|
3251
3349
|
// src/components/threads/ThreadDialog/Provider/index.tsx
|
|
3252
3350
|
import { useState as useState2 } from "react";
|
|
3253
3351
|
// src/contexts/threads/ThreadDialogContext/index.ts
|
|
@@ -3682,11 +3780,11 @@ var blobToData = function(blob) {
|
|
|
3682
3780
|
});
|
|
3683
3781
|
};
|
|
3684
3782
|
// src/hooks/audioThreads/useStatus/index.ts
|
|
3685
|
-
import { useMemo as
|
|
3783
|
+
import { useMemo as useMemo11 } from "react";
|
|
3686
3784
|
var useStatus = function(param) {
|
|
3687
3785
|
var messageAudioProps = param.messageAudioProps, recorderProps = param.recorderProps, createMessageProps = param.createMessageProps;
|
|
3688
3786
|
var latestMessageProps = useLatestMessage();
|
|
3689
|
-
var status =
|
|
3787
|
+
var status = useMemo11(function() {
|
|
3690
3788
|
var _latestMessageProps_latestMessage;
|
|
3691
3789
|
if (recorderProps.status === "recording") return "recording";
|
|
3692
3790
|
if (createMessageProps.isPending) return "creatingMessage";
|
|
@@ -3710,7 +3808,7 @@ var useStatus = function(param) {
|
|
|
3710
3808
|
// src/hooks/audioThreads/useRecorder/index.ts
|
|
3711
3809
|
import dayjs3 from "dayjs";
|
|
3712
3810
|
import { useAudioCapture } from "use-audio-capture";
|
|
3713
|
-
import { useMemo as
|
|
3811
|
+
import { useMemo as useMemo12, useRef as useRef7, useState as useState5, useCallback as useCallback4, useEffect as useEffect7 } from "react";
|
|
3714
3812
|
import { useAudioPlayer } from "react-use-audio-player";
|
|
3715
3813
|
// src/hooks/misc/useInterval.ts
|
|
3716
3814
|
import { useEffect as useEffect6, useRef as useRef6 } from "react";
|
|
@@ -3816,7 +3914,7 @@ var useRecorder = function(param) {
|
|
|
3816
3914
|
isInited,
|
|
3817
3915
|
mediaStream
|
|
3818
3916
|
]);
|
|
3819
|
-
var visualizationAnalyser =
|
|
3917
|
+
var visualizationAnalyser = useMemo12(function() {
|
|
3820
3918
|
if (!audioEngine) return null;
|
|
3821
3919
|
var result = audioEngine.audioContext.createAnalyser();
|
|
3822
3920
|
audioEngine.source.connect(result);
|
|
@@ -3824,7 +3922,7 @@ var useRecorder = function(param) {
|
|
|
3824
3922
|
}, [
|
|
3825
3923
|
audioEngine
|
|
3826
3924
|
]);
|
|
3827
|
-
var silenceAnalyser =
|
|
3925
|
+
var silenceAnalyser = useMemo12(function() {
|
|
3828
3926
|
if (!audioEngine) return null;
|
|
3829
3927
|
var result = audioEngine.audioContext.createAnalyser();
|
|
3830
3928
|
result.minDecibels = -60;
|
|
@@ -3879,7 +3977,7 @@ var useRecorder = function(param) {
|
|
|
3879
3977
|
});
|
|
3880
3978
|
};
|
|
3881
3979
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
3882
|
-
import { useMemo as
|
|
3980
|
+
import { useMemo as useMemo13, useRef as useRef8, useState as useState6, useEffect as useEffect8 } from "react";
|
|
3883
3981
|
import nlp from "compromise";
|
|
3884
3982
|
import { Howler } from "howler";
|
|
3885
3983
|
import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
|
|
@@ -3925,7 +4023,7 @@ var useMessageAudio = function(param) {
|
|
|
3925
4023
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
3926
4024
|
var _useState63 = _sliced_to_array(useState6(false), 2), isPlaying = _useState63[0], setIsPlaying = _useState63[1];
|
|
3927
4025
|
var latestMessageProps = useLatestMessage();
|
|
3928
|
-
var unplayedMessageSentences =
|
|
4026
|
+
var unplayedMessageSentences = useMemo13(function() {
|
|
3929
4027
|
if (!latestMessageProps.latestMessage) return [];
|
|
3930
4028
|
if (latestMessageProps.latestMessage.role !== "assistant") return [];
|
|
3931
4029
|
if (stoppedMessageIds.includes(latestMessageProps.latestMessage.id)) return [];
|
|
@@ -4046,7 +4144,7 @@ var useMessageAudio = function(param) {
|
|
|
4046
4144
|
audioPlayer,
|
|
4047
4145
|
isAudioEngineInited
|
|
4048
4146
|
]);
|
|
4049
|
-
var visualizationAnalyser =
|
|
4147
|
+
var visualizationAnalyser = useMemo13(function() {
|
|
4050
4148
|
if (!audioEngine) return null;
|
|
4051
4149
|
var result = audioEngine.audioContext.createAnalyser();
|
|
4052
4150
|
audioEngine.source.connect(audioEngine.audioContext.destination);
|
|
@@ -4055,7 +4153,7 @@ var useMessageAudio = function(param) {
|
|
|
4055
4153
|
}, [
|
|
4056
4154
|
audioEngine
|
|
4057
4155
|
]);
|
|
4058
|
-
var isPending =
|
|
4156
|
+
var isPending = useMemo13(function() {
|
|
4059
4157
|
return isPlaying || unplayedMessageSentences.length > 0;
|
|
4060
4158
|
}, [
|
|
4061
4159
|
isPlaying,
|
|
@@ -4520,9 +4618,9 @@ AudioThreadDialog.Root = Root9;
|
|
|
4520
4618
|
AudioThreadDialog.Trigger = Trigger;
|
|
4521
4619
|
AudioThreadDialog.Content = Content4;
|
|
4522
4620
|
// src/components/suggestions/Suggestions/index.tsx
|
|
4523
|
-
import { useMemo as
|
|
4621
|
+
import { useMemo as useMemo15 } from "react";
|
|
4524
4622
|
// src/components/suggestions/Suggestions/Content.tsx
|
|
4525
|
-
import { useMemo as
|
|
4623
|
+
import { useMemo as useMemo14 } from "react";
|
|
4526
4624
|
import { isEmpty as isEmpty3 } from "radash";
|
|
4527
4625
|
import { onlyText } from "react-children-utilities";
|
|
4528
4626
|
import { Flex as Flex31 } from "@radix-ui/themes";
|
|
@@ -4579,7 +4677,7 @@ import { jsx as jsx77 } from "react/jsx-runtime";
|
|
|
4579
4677
|
var Content6 = function(param) {
|
|
4580
4678
|
var children = param.children;
|
|
4581
4679
|
var isMutatingMessage = useIsMutatingMessage();
|
|
4582
|
-
var suggestions =
|
|
4680
|
+
var suggestions = useMemo14(function() {
|
|
4583
4681
|
return onlyText(children).split(/\r?\n/).filter(function(c) {
|
|
4584
4682
|
return !isEmpty3(c);
|
|
4585
4683
|
}).map(function(c) {
|
|
@@ -4606,7 +4704,7 @@ import { jsx as jsx78 } from "react/jsx-runtime";
|
|
|
4606
4704
|
var Suggestions = function(param) {
|
|
4607
4705
|
var children = param.children;
|
|
4608
4706
|
var latestMessageProps = useLatestMessage();
|
|
4609
|
-
var isDisabled =
|
|
4707
|
+
var isDisabled = useMemo15(function() {
|
|
4610
4708
|
var // @ts-ignore-next-line
|
|
4611
4709
|
_latestMessageProps_latestMessage_metadata, _latestMessageProps_latestMessage;
|
|
4612
4710
|
return (_latestMessageProps_latestMessage = latestMessageProps.latestMessage) === null || _latestMessageProps_latestMessage === void 0 ? void 0 : (_latestMessageProps_latestMessage_metadata = _latestMessageProps_latestMessage.metadata) === null || _latestMessageProps_latestMessage_metadata === void 0 ? void 0 : _latestMessageProps_latestMessage_metadata.isBlocking;
|
|
@@ -4621,14 +4719,14 @@ var Suggestions = function(param) {
|
|
|
4621
4719
|
};
|
|
4622
4720
|
Suggestions.Item = Item;
|
|
4623
4721
|
// src/components/markdown/MarkdownProvider/index.tsx
|
|
4624
|
-
import { useMemo as
|
|
4722
|
+
import { useMemo as useMemo16 } from "react";
|
|
4625
4723
|
import { jsx as jsx79 } from "react/jsx-runtime";
|
|
4626
4724
|
var MarkdownProvider = function(_param) {
|
|
4627
4725
|
var children = _param.children, rest = _object_without_properties(_param, [
|
|
4628
4726
|
"children"
|
|
4629
4727
|
]);
|
|
4630
4728
|
var prevMarkdownContext = useMarkdownContext();
|
|
4631
|
-
var value =
|
|
4729
|
+
var value = useMemo16(function() {
|
|
4632
4730
|
return merge(prevMarkdownContext, rest);
|
|
4633
4731
|
}, [
|
|
4634
4732
|
rest,
|
|
@@ -4640,7 +4738,7 @@ var MarkdownProvider = function(_param) {
|
|
|
4640
4738
|
});
|
|
4641
4739
|
};
|
|
4642
4740
|
// src/components/components/ComponentsProvider.tsx
|
|
4643
|
-
import { useMemo as
|
|
4741
|
+
import { useMemo as useMemo17 } from "react";
|
|
4644
4742
|
// src/hooks/components/useComponents.ts
|
|
4645
4743
|
import { useContext as useContext16 } from "react";
|
|
4646
4744
|
var useComponents = function() {
|
|
@@ -4653,7 +4751,7 @@ var ComponentsProvider = function(_param) {
|
|
|
4653
4751
|
"children"
|
|
4654
4752
|
]);
|
|
4655
4753
|
var prevComponents = useComponents();
|
|
4656
|
-
var value =
|
|
4754
|
+
var value = useMemo17(function() {
|
|
4657
4755
|
return merge(prevComponents, rest);
|
|
4658
4756
|
}, [
|
|
4659
4757
|
rest,
|
|
@@ -4664,5 +4762,5 @@ var ComponentsProvider = function(_param) {
|
|
|
4664
4762
|
children: children
|
|
4665
4763
|
});
|
|
4666
4764
|
};
|
|
4667
|
-
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
|
4765
|
+
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
|
4668
4766
|
//# sourceMappingURL=index.js.map
|