@superinterface/react 3.7.1 → 3.7.3-beta.1
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 +188 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +83 -15
- package/dist/index.d.ts +83 -15
- package/dist/index.js +190 -154
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.cts +7 -1
- package/dist/types/index.d.ts +7 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.cjs';
|
|
2
|
+
import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, PlayArgs, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.cjs';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { UseInfiniteQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/react-query';
|
|
5
5
|
import * as react_hook_form from 'react-hook-form';
|
|
@@ -8,11 +8,13 @@ import * as _tanstack_query_core from '@tanstack/query-core';
|
|
|
8
8
|
import * as react from 'react';
|
|
9
9
|
import { Dispatch, SetStateAction } from 'react';
|
|
10
10
|
import * as openai_resources from 'openai/resources';
|
|
11
|
+
import * as react_use_audio_player from 'react-use-audio-player';
|
|
12
|
+
import { UseAudioCaptureProps } from 'use-audio-capture';
|
|
11
13
|
import OpenAI from 'openai';
|
|
12
14
|
import remarkGfm from 'remark-gfm';
|
|
13
15
|
import * as openai_resources_beta_threads_runs_steps from 'openai/resources/beta/threads/runs/steps';
|
|
14
16
|
|
|
15
|
-
type Args$
|
|
17
|
+
type Args$a = {
|
|
16
18
|
children: React.ReactNode;
|
|
17
19
|
baseUrl?: string;
|
|
18
20
|
variables?: {
|
|
@@ -24,7 +26,7 @@ type Args$9 = {
|
|
|
24
26
|
};
|
|
25
27
|
threadIdStorageOptions?: ThreadStorageOptions | null;
|
|
26
28
|
};
|
|
27
|
-
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdStorageOptions, }: Args$
|
|
29
|
+
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdStorageOptions, }: Args$a) => react_jsx_runtime.JSX.Element;
|
|
28
30
|
|
|
29
31
|
declare const useSuperinterfaceContext: () => {
|
|
30
32
|
baseUrl: string | null;
|
|
@@ -37,14 +39,14 @@ declare const useSuperinterfaceContext: () => {
|
|
|
37
39
|
createMessageAbortControllerRef: React.MutableRefObject<AbortController | null>;
|
|
38
40
|
};
|
|
39
41
|
|
|
40
|
-
type Args$
|
|
42
|
+
type Args$9 = Args$a;
|
|
41
43
|
|
|
42
|
-
type Args$
|
|
44
|
+
type Args$8 = Args$9 & StyleProps;
|
|
43
45
|
|
|
44
|
-
type Args$
|
|
46
|
+
type Args$7 = Omit<Args$8, 'children'>;
|
|
45
47
|
declare const Thread: {
|
|
46
|
-
(props: Args$
|
|
47
|
-
Root: ({ children, style, className, ...rest }: Args$
|
|
48
|
+
(props: Args$7): react_jsx_runtime.JSX.Element;
|
|
49
|
+
Root: ({ children, style, className, ...rest }: Args$8) => react_jsx_runtime.JSX.Element;
|
|
48
50
|
Messages: {
|
|
49
51
|
({ children, className, style, }: {
|
|
50
52
|
children?: React.ReactNode;
|
|
@@ -336,10 +338,10 @@ declare const useMessageFormContext: () => {
|
|
|
336
338
|
|
|
337
339
|
declare const useIsMutatingMessage: () => boolean;
|
|
338
340
|
|
|
339
|
-
type Args$
|
|
341
|
+
type Args$6 = {
|
|
340
342
|
assistantId: string;
|
|
341
343
|
};
|
|
342
|
-
declare const useAssistant: ({ assistantId, }: Args$
|
|
344
|
+
declare const useAssistant: ({ assistantId, }: Args$6) => {
|
|
343
345
|
assistant: any;
|
|
344
346
|
data: any;
|
|
345
347
|
error: Error;
|
|
@@ -533,14 +535,15 @@ declare const AudioThreadDialog: {
|
|
|
533
535
|
};
|
|
534
536
|
};
|
|
535
537
|
|
|
536
|
-
type Args$
|
|
538
|
+
type Args$5 = {
|
|
537
539
|
children: React.ReactNode;
|
|
540
|
+
play?: (args: PlayArgs) => void;
|
|
538
541
|
} & StyleProps;
|
|
539
542
|
|
|
540
|
-
type Args$
|
|
543
|
+
type Args$4 = Omit<Args$5, 'children'>;
|
|
541
544
|
declare const AudioThread: {
|
|
542
|
-
(props: Args$
|
|
543
|
-
Root: ({ children, ...rest }: Args$
|
|
545
|
+
(props: Args$4): react_jsx_runtime.JSX.Element;
|
|
546
|
+
Root: ({ children, ...rest }: Args$5) => react_jsx_runtime.JSX.Element;
|
|
544
547
|
Visualization: (props: StyleProps) => react_jsx_runtime.JSX.Element;
|
|
545
548
|
Status: (props: StyleProps) => react_jsx_runtime.JSX.Element;
|
|
546
549
|
Form: (props: StyleProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -551,6 +554,71 @@ declare const useThreadDialogContext: () => {
|
|
|
551
554
|
setIsOpen: react.Dispatch<react.SetStateAction<boolean>>;
|
|
552
555
|
};
|
|
553
556
|
|
|
557
|
+
declare const useMessageAudio: ({ onEnd, play: passedPlay, }: {
|
|
558
|
+
onEnd: () => void;
|
|
559
|
+
play?: (args: PlayArgs) => void;
|
|
560
|
+
}) => {
|
|
561
|
+
visualizationAnalyser: AnalyserNode | null;
|
|
562
|
+
play: () => void;
|
|
563
|
+
pause: () => void;
|
|
564
|
+
togglePlayPause: () => void;
|
|
565
|
+
stop: () => void;
|
|
566
|
+
setVolume: (volume: number) => void;
|
|
567
|
+
fade: (from: number, to: number, duration: number) => void;
|
|
568
|
+
setRate: (speed: number) => void;
|
|
569
|
+
seek: (seconds: number) => void;
|
|
570
|
+
mute: (muteOnOff: boolean) => void;
|
|
571
|
+
loop: (loopOnOff: boolean) => void;
|
|
572
|
+
getPosition: () => number;
|
|
573
|
+
load: (...args: react_use_audio_player.LoadArguments) => void;
|
|
574
|
+
src: string | null;
|
|
575
|
+
looping: boolean;
|
|
576
|
+
isReady: boolean;
|
|
577
|
+
isLoading: boolean;
|
|
578
|
+
paused: boolean;
|
|
579
|
+
stopped: boolean;
|
|
580
|
+
playing: boolean;
|
|
581
|
+
duration: number;
|
|
582
|
+
muted: boolean;
|
|
583
|
+
rate: number;
|
|
584
|
+
volume: number;
|
|
585
|
+
error: string | null;
|
|
586
|
+
cleanup: VoidFunction;
|
|
587
|
+
isPending: boolean;
|
|
588
|
+
isAudioPlayed: boolean;
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
type Args$3 = UseAudioCaptureProps & {
|
|
592
|
+
isStopOnSilence: boolean;
|
|
593
|
+
};
|
|
594
|
+
declare const useRecorder: ({ isStopOnSilence, onStart, onStop, }: Args$3) => {
|
|
595
|
+
status: "paused" | "idle" | "recording" | "stopped";
|
|
596
|
+
visualizationAnalyser: AnalyserNode | null;
|
|
597
|
+
start: () => Promise<void>;
|
|
598
|
+
stop: () => Promise<void>;
|
|
599
|
+
pause: () => Promise<void>;
|
|
600
|
+
resume: () => Promise<void>;
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
declare const statusMessages: {
|
|
604
|
+
recording: string;
|
|
605
|
+
creatingMessage: string;
|
|
606
|
+
runActive: string;
|
|
607
|
+
playing: string;
|
|
608
|
+
loading: string;
|
|
609
|
+
idle: string;
|
|
610
|
+
recorderPaused: string;
|
|
611
|
+
playerPaused: string;
|
|
612
|
+
acquiringMedia: string;
|
|
613
|
+
other: string;
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
declare const useAudioThreadContext: () => {
|
|
617
|
+
status: keyof typeof statusMessages;
|
|
618
|
+
recorderProps: ReturnType<typeof useRecorder>;
|
|
619
|
+
messageAudioProps: ReturnType<typeof useMessageAudio>;
|
|
620
|
+
};
|
|
621
|
+
|
|
554
622
|
declare const Suggestions: {
|
|
555
623
|
({ children, className, style, }: {
|
|
556
624
|
children: React.ReactNode;
|
|
@@ -664,4 +732,4 @@ type Args = {
|
|
|
664
732
|
};
|
|
665
733
|
declare const AssistantProvider: ({ children, }: Args) => react_jsx_runtime.JSX.Element;
|
|
666
734
|
|
|
667
|
-
export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
|
735
|
+
export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useAudioThreadContext, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.js';
|
|
2
|
+
import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, PlayArgs, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.js';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { UseInfiniteQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/react-query';
|
|
5
5
|
import * as react_hook_form from 'react-hook-form';
|
|
@@ -8,11 +8,13 @@ import * as _tanstack_query_core from '@tanstack/query-core';
|
|
|
8
8
|
import * as react from 'react';
|
|
9
9
|
import { Dispatch, SetStateAction } from 'react';
|
|
10
10
|
import * as openai_resources from 'openai/resources';
|
|
11
|
+
import * as react_use_audio_player from 'react-use-audio-player';
|
|
12
|
+
import { UseAudioCaptureProps } from 'use-audio-capture';
|
|
11
13
|
import OpenAI from 'openai';
|
|
12
14
|
import remarkGfm from 'remark-gfm';
|
|
13
15
|
import * as openai_resources_beta_threads_runs_steps from 'openai/resources/beta/threads/runs/steps';
|
|
14
16
|
|
|
15
|
-
type Args$
|
|
17
|
+
type Args$a = {
|
|
16
18
|
children: React.ReactNode;
|
|
17
19
|
baseUrl?: string;
|
|
18
20
|
variables?: {
|
|
@@ -24,7 +26,7 @@ type Args$9 = {
|
|
|
24
26
|
};
|
|
25
27
|
threadIdStorageOptions?: ThreadStorageOptions | null;
|
|
26
28
|
};
|
|
27
|
-
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdStorageOptions, }: Args$
|
|
29
|
+
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdStorageOptions, }: Args$a) => react_jsx_runtime.JSX.Element;
|
|
28
30
|
|
|
29
31
|
declare const useSuperinterfaceContext: () => {
|
|
30
32
|
baseUrl: string | null;
|
|
@@ -37,14 +39,14 @@ declare const useSuperinterfaceContext: () => {
|
|
|
37
39
|
createMessageAbortControllerRef: React.MutableRefObject<AbortController | null>;
|
|
38
40
|
};
|
|
39
41
|
|
|
40
|
-
type Args$
|
|
42
|
+
type Args$9 = Args$a;
|
|
41
43
|
|
|
42
|
-
type Args$
|
|
44
|
+
type Args$8 = Args$9 & StyleProps;
|
|
43
45
|
|
|
44
|
-
type Args$
|
|
46
|
+
type Args$7 = Omit<Args$8, 'children'>;
|
|
45
47
|
declare const Thread: {
|
|
46
|
-
(props: Args$
|
|
47
|
-
Root: ({ children, style, className, ...rest }: Args$
|
|
48
|
+
(props: Args$7): react_jsx_runtime.JSX.Element;
|
|
49
|
+
Root: ({ children, style, className, ...rest }: Args$8) => react_jsx_runtime.JSX.Element;
|
|
48
50
|
Messages: {
|
|
49
51
|
({ children, className, style, }: {
|
|
50
52
|
children?: React.ReactNode;
|
|
@@ -336,10 +338,10 @@ declare const useMessageFormContext: () => {
|
|
|
336
338
|
|
|
337
339
|
declare const useIsMutatingMessage: () => boolean;
|
|
338
340
|
|
|
339
|
-
type Args$
|
|
341
|
+
type Args$6 = {
|
|
340
342
|
assistantId: string;
|
|
341
343
|
};
|
|
342
|
-
declare const useAssistant: ({ assistantId, }: Args$
|
|
344
|
+
declare const useAssistant: ({ assistantId, }: Args$6) => {
|
|
343
345
|
assistant: any;
|
|
344
346
|
data: any;
|
|
345
347
|
error: Error;
|
|
@@ -533,14 +535,15 @@ declare const AudioThreadDialog: {
|
|
|
533
535
|
};
|
|
534
536
|
};
|
|
535
537
|
|
|
536
|
-
type Args$
|
|
538
|
+
type Args$5 = {
|
|
537
539
|
children: React.ReactNode;
|
|
540
|
+
play?: (args: PlayArgs) => void;
|
|
538
541
|
} & StyleProps;
|
|
539
542
|
|
|
540
|
-
type Args$
|
|
543
|
+
type Args$4 = Omit<Args$5, 'children'>;
|
|
541
544
|
declare const AudioThread: {
|
|
542
|
-
(props: Args$
|
|
543
|
-
Root: ({ children, ...rest }: Args$
|
|
545
|
+
(props: Args$4): react_jsx_runtime.JSX.Element;
|
|
546
|
+
Root: ({ children, ...rest }: Args$5) => react_jsx_runtime.JSX.Element;
|
|
544
547
|
Visualization: (props: StyleProps) => react_jsx_runtime.JSX.Element;
|
|
545
548
|
Status: (props: StyleProps) => react_jsx_runtime.JSX.Element;
|
|
546
549
|
Form: (props: StyleProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -551,6 +554,71 @@ declare const useThreadDialogContext: () => {
|
|
|
551
554
|
setIsOpen: react.Dispatch<react.SetStateAction<boolean>>;
|
|
552
555
|
};
|
|
553
556
|
|
|
557
|
+
declare const useMessageAudio: ({ onEnd, play: passedPlay, }: {
|
|
558
|
+
onEnd: () => void;
|
|
559
|
+
play?: (args: PlayArgs) => void;
|
|
560
|
+
}) => {
|
|
561
|
+
visualizationAnalyser: AnalyserNode | null;
|
|
562
|
+
play: () => void;
|
|
563
|
+
pause: () => void;
|
|
564
|
+
togglePlayPause: () => void;
|
|
565
|
+
stop: () => void;
|
|
566
|
+
setVolume: (volume: number) => void;
|
|
567
|
+
fade: (from: number, to: number, duration: number) => void;
|
|
568
|
+
setRate: (speed: number) => void;
|
|
569
|
+
seek: (seconds: number) => void;
|
|
570
|
+
mute: (muteOnOff: boolean) => void;
|
|
571
|
+
loop: (loopOnOff: boolean) => void;
|
|
572
|
+
getPosition: () => number;
|
|
573
|
+
load: (...args: react_use_audio_player.LoadArguments) => void;
|
|
574
|
+
src: string | null;
|
|
575
|
+
looping: boolean;
|
|
576
|
+
isReady: boolean;
|
|
577
|
+
isLoading: boolean;
|
|
578
|
+
paused: boolean;
|
|
579
|
+
stopped: boolean;
|
|
580
|
+
playing: boolean;
|
|
581
|
+
duration: number;
|
|
582
|
+
muted: boolean;
|
|
583
|
+
rate: number;
|
|
584
|
+
volume: number;
|
|
585
|
+
error: string | null;
|
|
586
|
+
cleanup: VoidFunction;
|
|
587
|
+
isPending: boolean;
|
|
588
|
+
isAudioPlayed: boolean;
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
type Args$3 = UseAudioCaptureProps & {
|
|
592
|
+
isStopOnSilence: boolean;
|
|
593
|
+
};
|
|
594
|
+
declare const useRecorder: ({ isStopOnSilence, onStart, onStop, }: Args$3) => {
|
|
595
|
+
status: "paused" | "idle" | "recording" | "stopped";
|
|
596
|
+
visualizationAnalyser: AnalyserNode | null;
|
|
597
|
+
start: () => Promise<void>;
|
|
598
|
+
stop: () => Promise<void>;
|
|
599
|
+
pause: () => Promise<void>;
|
|
600
|
+
resume: () => Promise<void>;
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
declare const statusMessages: {
|
|
604
|
+
recording: string;
|
|
605
|
+
creatingMessage: string;
|
|
606
|
+
runActive: string;
|
|
607
|
+
playing: string;
|
|
608
|
+
loading: string;
|
|
609
|
+
idle: string;
|
|
610
|
+
recorderPaused: string;
|
|
611
|
+
playerPaused: string;
|
|
612
|
+
acquiringMedia: string;
|
|
613
|
+
other: string;
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
declare const useAudioThreadContext: () => {
|
|
617
|
+
status: keyof typeof statusMessages;
|
|
618
|
+
recorderProps: ReturnType<typeof useRecorder>;
|
|
619
|
+
messageAudioProps: ReturnType<typeof useMessageAudio>;
|
|
620
|
+
};
|
|
621
|
+
|
|
554
622
|
declare const Suggestions: {
|
|
555
623
|
({ children, className, style, }: {
|
|
556
624
|
children: React.ReactNode;
|
|
@@ -664,4 +732,4 @@ type Args = {
|
|
|
664
732
|
};
|
|
665
733
|
declare const AssistantProvider: ({ children, }: Args) => react_jsx_runtime.JSX.Element;
|
|
666
734
|
|
|
667
|
-
export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
|
735
|
+
export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useAudioThreadContext, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|