@superinterface/react 2.17.4 → 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 +172 -69
- 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 +118 -19
- 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
|
@@ -1360,12 +1360,13 @@ var remarkAnnotation = function(param) {
|
|
|
1360
1360
|
return function() {
|
|
1361
1361
|
return function(tree) {
|
|
1362
1362
|
flatMap(tree, function(node) {
|
|
1363
|
+
var _content_text_annotations, _content_text;
|
|
1363
1364
|
if (node.type !== "text") {
|
|
1364
1365
|
return [
|
|
1365
1366
|
node
|
|
1366
1367
|
];
|
|
1367
1368
|
}
|
|
1368
|
-
if (!content.text.annotations.length) {
|
|
1369
|
+
if (!((_content_text = content.text) === null || _content_text === void 0 ? void 0 : (_content_text_annotations = _content_text.annotations) === null || _content_text_annotations === void 0 ? void 0 : _content_text_annotations.length)) {
|
|
1369
1370
|
return [
|
|
1370
1371
|
node
|
|
1371
1372
|
];
|
|
@@ -3247,6 +3248,104 @@ import { useContext as useContext12 } from "react";
|
|
|
3247
3248
|
var useMessageContext = function() {
|
|
3248
3249
|
return useContext12(MessageContext);
|
|
3249
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
|
+
};
|
|
3250
3349
|
// src/components/threads/ThreadDialog/Provider/index.tsx
|
|
3251
3350
|
import { useState as useState2 } from "react";
|
|
3252
3351
|
// src/contexts/threads/ThreadDialogContext/index.ts
|
|
@@ -3681,11 +3780,11 @@ var blobToData = function(blob) {
|
|
|
3681
3780
|
});
|
|
3682
3781
|
};
|
|
3683
3782
|
// src/hooks/audioThreads/useStatus/index.ts
|
|
3684
|
-
import { useMemo as
|
|
3783
|
+
import { useMemo as useMemo11 } from "react";
|
|
3685
3784
|
var useStatus = function(param) {
|
|
3686
3785
|
var messageAudioProps = param.messageAudioProps, recorderProps = param.recorderProps, createMessageProps = param.createMessageProps;
|
|
3687
3786
|
var latestMessageProps = useLatestMessage();
|
|
3688
|
-
var status =
|
|
3787
|
+
var status = useMemo11(function() {
|
|
3689
3788
|
var _latestMessageProps_latestMessage;
|
|
3690
3789
|
if (recorderProps.status === "recording") return "recording";
|
|
3691
3790
|
if (createMessageProps.isPending) return "creatingMessage";
|
|
@@ -3709,7 +3808,7 @@ var useStatus = function(param) {
|
|
|
3709
3808
|
// src/hooks/audioThreads/useRecorder/index.ts
|
|
3710
3809
|
import dayjs3 from "dayjs";
|
|
3711
3810
|
import { useAudioCapture } from "use-audio-capture";
|
|
3712
|
-
import { useMemo as
|
|
3811
|
+
import { useMemo as useMemo12, useRef as useRef7, useState as useState5, useCallback as useCallback4, useEffect as useEffect7 } from "react";
|
|
3713
3812
|
import { useAudioPlayer } from "react-use-audio-player";
|
|
3714
3813
|
// src/hooks/misc/useInterval.ts
|
|
3715
3814
|
import { useEffect as useEffect6, useRef as useRef6 } from "react";
|
|
@@ -3815,7 +3914,7 @@ var useRecorder = function(param) {
|
|
|
3815
3914
|
isInited,
|
|
3816
3915
|
mediaStream
|
|
3817
3916
|
]);
|
|
3818
|
-
var visualizationAnalyser =
|
|
3917
|
+
var visualizationAnalyser = useMemo12(function() {
|
|
3819
3918
|
if (!audioEngine) return null;
|
|
3820
3919
|
var result = audioEngine.audioContext.createAnalyser();
|
|
3821
3920
|
audioEngine.source.connect(result);
|
|
@@ -3823,7 +3922,7 @@ var useRecorder = function(param) {
|
|
|
3823
3922
|
}, [
|
|
3824
3923
|
audioEngine
|
|
3825
3924
|
]);
|
|
3826
|
-
var silenceAnalyser =
|
|
3925
|
+
var silenceAnalyser = useMemo12(function() {
|
|
3827
3926
|
if (!audioEngine) return null;
|
|
3828
3927
|
var result = audioEngine.audioContext.createAnalyser();
|
|
3829
3928
|
result.minDecibels = -60;
|
|
@@ -3878,7 +3977,7 @@ var useRecorder = function(param) {
|
|
|
3878
3977
|
});
|
|
3879
3978
|
};
|
|
3880
3979
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
3881
|
-
import { useMemo as
|
|
3980
|
+
import { useMemo as useMemo13, useRef as useRef8, useState as useState6, useEffect as useEffect8 } from "react";
|
|
3882
3981
|
import nlp from "compromise";
|
|
3883
3982
|
import { Howler } from "howler";
|
|
3884
3983
|
import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
|
|
@@ -3924,7 +4023,7 @@ var useMessageAudio = function(param) {
|
|
|
3924
4023
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
3925
4024
|
var _useState63 = _sliced_to_array(useState6(false), 2), isPlaying = _useState63[0], setIsPlaying = _useState63[1];
|
|
3926
4025
|
var latestMessageProps = useLatestMessage();
|
|
3927
|
-
var unplayedMessageSentences =
|
|
4026
|
+
var unplayedMessageSentences = useMemo13(function() {
|
|
3928
4027
|
if (!latestMessageProps.latestMessage) return [];
|
|
3929
4028
|
if (latestMessageProps.latestMessage.role !== "assistant") return [];
|
|
3930
4029
|
if (stoppedMessageIds.includes(latestMessageProps.latestMessage.id)) return [];
|
|
@@ -4045,7 +4144,7 @@ var useMessageAudio = function(param) {
|
|
|
4045
4144
|
audioPlayer,
|
|
4046
4145
|
isAudioEngineInited
|
|
4047
4146
|
]);
|
|
4048
|
-
var visualizationAnalyser =
|
|
4147
|
+
var visualizationAnalyser = useMemo13(function() {
|
|
4049
4148
|
if (!audioEngine) return null;
|
|
4050
4149
|
var result = audioEngine.audioContext.createAnalyser();
|
|
4051
4150
|
audioEngine.source.connect(audioEngine.audioContext.destination);
|
|
@@ -4054,7 +4153,7 @@ var useMessageAudio = function(param) {
|
|
|
4054
4153
|
}, [
|
|
4055
4154
|
audioEngine
|
|
4056
4155
|
]);
|
|
4057
|
-
var isPending =
|
|
4156
|
+
var isPending = useMemo13(function() {
|
|
4058
4157
|
return isPlaying || unplayedMessageSentences.length > 0;
|
|
4059
4158
|
}, [
|
|
4060
4159
|
isPlaying,
|
|
@@ -4519,9 +4618,9 @@ AudioThreadDialog.Root = Root9;
|
|
|
4519
4618
|
AudioThreadDialog.Trigger = Trigger;
|
|
4520
4619
|
AudioThreadDialog.Content = Content4;
|
|
4521
4620
|
// src/components/suggestions/Suggestions/index.tsx
|
|
4522
|
-
import { useMemo as
|
|
4621
|
+
import { useMemo as useMemo15 } from "react";
|
|
4523
4622
|
// src/components/suggestions/Suggestions/Content.tsx
|
|
4524
|
-
import { useMemo as
|
|
4623
|
+
import { useMemo as useMemo14 } from "react";
|
|
4525
4624
|
import { isEmpty as isEmpty3 } from "radash";
|
|
4526
4625
|
import { onlyText } from "react-children-utilities";
|
|
4527
4626
|
import { Flex as Flex31 } from "@radix-ui/themes";
|
|
@@ -4578,7 +4677,7 @@ import { jsx as jsx77 } from "react/jsx-runtime";
|
|
|
4578
4677
|
var Content6 = function(param) {
|
|
4579
4678
|
var children = param.children;
|
|
4580
4679
|
var isMutatingMessage = useIsMutatingMessage();
|
|
4581
|
-
var suggestions =
|
|
4680
|
+
var suggestions = useMemo14(function() {
|
|
4582
4681
|
return onlyText(children).split(/\r?\n/).filter(function(c) {
|
|
4583
4682
|
return !isEmpty3(c);
|
|
4584
4683
|
}).map(function(c) {
|
|
@@ -4605,7 +4704,7 @@ import { jsx as jsx78 } from "react/jsx-runtime";
|
|
|
4605
4704
|
var Suggestions = function(param) {
|
|
4606
4705
|
var children = param.children;
|
|
4607
4706
|
var latestMessageProps = useLatestMessage();
|
|
4608
|
-
var isDisabled =
|
|
4707
|
+
var isDisabled = useMemo15(function() {
|
|
4609
4708
|
var // @ts-ignore-next-line
|
|
4610
4709
|
_latestMessageProps_latestMessage_metadata, _latestMessageProps_latestMessage;
|
|
4611
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;
|
|
@@ -4620,14 +4719,14 @@ var Suggestions = function(param) {
|
|
|
4620
4719
|
};
|
|
4621
4720
|
Suggestions.Item = Item;
|
|
4622
4721
|
// src/components/markdown/MarkdownProvider/index.tsx
|
|
4623
|
-
import { useMemo as
|
|
4722
|
+
import { useMemo as useMemo16 } from "react";
|
|
4624
4723
|
import { jsx as jsx79 } from "react/jsx-runtime";
|
|
4625
4724
|
var MarkdownProvider = function(_param) {
|
|
4626
4725
|
var children = _param.children, rest = _object_without_properties(_param, [
|
|
4627
4726
|
"children"
|
|
4628
4727
|
]);
|
|
4629
4728
|
var prevMarkdownContext = useMarkdownContext();
|
|
4630
|
-
var value =
|
|
4729
|
+
var value = useMemo16(function() {
|
|
4631
4730
|
return merge(prevMarkdownContext, rest);
|
|
4632
4731
|
}, [
|
|
4633
4732
|
rest,
|
|
@@ -4639,7 +4738,7 @@ var MarkdownProvider = function(_param) {
|
|
|
4639
4738
|
});
|
|
4640
4739
|
};
|
|
4641
4740
|
// src/components/components/ComponentsProvider.tsx
|
|
4642
|
-
import { useMemo as
|
|
4741
|
+
import { useMemo as useMemo17 } from "react";
|
|
4643
4742
|
// src/hooks/components/useComponents.ts
|
|
4644
4743
|
import { useContext as useContext16 } from "react";
|
|
4645
4744
|
var useComponents = function() {
|
|
@@ -4652,7 +4751,7 @@ var ComponentsProvider = function(_param) {
|
|
|
4652
4751
|
"children"
|
|
4653
4752
|
]);
|
|
4654
4753
|
var prevComponents = useComponents();
|
|
4655
|
-
var value =
|
|
4754
|
+
var value = useMemo17(function() {
|
|
4656
4755
|
return merge(prevComponents, rest);
|
|
4657
4756
|
}, [
|
|
4658
4757
|
rest,
|
|
@@ -4663,5 +4762,5 @@ var ComponentsProvider = function(_param) {
|
|
|
4663
4762
|
children: children
|
|
4664
4763
|
});
|
|
4665
4764
|
};
|
|
4666
|
-
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 };
|
|
4667
4766
|
//# sourceMappingURL=index.js.map
|