@trtc/calls-uikit-react 4.2.4 → 4.2.5
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/package.json +1 -1
- package/src/Components/TUICallKit/TUICallKit.tsx +2 -0
- package/src/Components/components/common/AIAssistant/AIAssistant.ts +132 -0
- package/src/Components/components/common/AIAssistant/AISubtitle.tsx +89 -0
- package/src/Components/components/common/AIAssistant/index.ts +10 -0
- package/src/Components/components/common/AIAssistant/utils/index.ts +5 -0
- package/src/Components/components/common/AIAssistant/utils/mitt.ts +85 -0
- package/src/TUICallService/CallService/AIAssistant.ts +51 -0
- package/src/TUICallService/CallService/index.ts +11 -1
- package/src/index.ts +1 -1
- package/tuicall-uikit-react.es.js +4037 -3862
- package/tuicall-uikit-react.umd.js +11 -11
- package/types/Components/components/common/AIAssistant/AIAssistant.d.ts +40 -0
- package/types/Components/components/common/AIAssistant/AISubtitle.d.ts +7 -0
- package/types/Components/components/common/AIAssistant/index.d.ts +4 -0
- package/types/Components/components/common/AIAssistant/utils/index.d.ts +2 -0
- package/types/Components/components/common/AIAssistant/utils/mitt.d.ts +16 -0
- package/types/TUICallService/CallService/AIAssistant.d.ts +15 -0
- package/types/TUICallService/CallService/index.d.ts +1 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
interface IInitASRParams {
|
|
2
|
+
trtcCloudInstance: any;
|
|
3
|
+
getNickName?: (userId: string) => Promise<userInfo>;
|
|
4
|
+
}
|
|
5
|
+
interface ITranslationContent {
|
|
6
|
+
language: string;
|
|
7
|
+
content: string;
|
|
8
|
+
}
|
|
9
|
+
interface ITranslationInfo {
|
|
10
|
+
roundId: string;
|
|
11
|
+
sender: string;
|
|
12
|
+
nick?: string;
|
|
13
|
+
text: string;
|
|
14
|
+
end: boolean;
|
|
15
|
+
translation: ITranslationContent[];
|
|
16
|
+
}
|
|
17
|
+
export declare const ASREvent: {
|
|
18
|
+
TRANSCRIPTION: string;
|
|
19
|
+
};
|
|
20
|
+
interface userInfo {
|
|
21
|
+
userId: string;
|
|
22
|
+
nick: string;
|
|
23
|
+
avatar?: string;
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
26
|
+
export default class AIAssistant {
|
|
27
|
+
emitter: any;
|
|
28
|
+
trtcCloudInstance: any;
|
|
29
|
+
getNickName: (userId: string) => Promise<userInfo>;
|
|
30
|
+
translationInfoList: ITranslationInfo[];
|
|
31
|
+
constructor();
|
|
32
|
+
initASR(params: IInitASRParams): void;
|
|
33
|
+
on(type: string, handler: (event: any) => void): void;
|
|
34
|
+
emit(type: string, events: any): void;
|
|
35
|
+
off(type: string, handler: (event: any) => void): void;
|
|
36
|
+
destroyASR(): void;
|
|
37
|
+
handleAIMessage: (data: any) => void;
|
|
38
|
+
handleCustomMessage: (userId: string, cmdId: number, seq: number, data: any) => void;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type EventType = string | symbol;
|
|
2
|
+
export type Handler<T = unknown> = (event: T) => void;
|
|
3
|
+
export type WildcardHandler<T = Record<string, unknown>> = (type: keyof T, event: T[keyof T]) => void;
|
|
4
|
+
export type EventHandlerList<T = unknown> = Array<Handler<T>>;
|
|
5
|
+
export type WildCardEventHandlerList<T = Record<string, unknown>> = Array<WildcardHandler<T>>;
|
|
6
|
+
export type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<keyof Events | '*', EventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>>;
|
|
7
|
+
export interface Emitter<Events extends Record<EventType, unknown>> {
|
|
8
|
+
all: EventHandlerMap<Events>;
|
|
9
|
+
on<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;
|
|
10
|
+
on(type: '*', handler: WildcardHandler<Events>): void;
|
|
11
|
+
off<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;
|
|
12
|
+
off(type: '*', handler: WildcardHandler<Events>): void;
|
|
13
|
+
emit<Key extends keyof Events>(type: Key, event: Events[Key]): void;
|
|
14
|
+
emit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;
|
|
15
|
+
}
|
|
16
|
+
export default function mitt<Events extends Record<EventType, unknown>>(all?: EventHandlerMap<Events>): Emitter<Events>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface IAIAssistant {
|
|
2
|
+
enableAISubtitle: (enable: boolean) => void;
|
|
3
|
+
setEngineInstance: (engineInstance: any) => void;
|
|
4
|
+
setImInstance: (imInstance: any) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare class AIAssistant implements IAIAssistant {
|
|
7
|
+
static instance: IAIAssistant;
|
|
8
|
+
private _tuiCallEngine;
|
|
9
|
+
private _imInstance;
|
|
10
|
+
static getInstance(): IAIAssistant;
|
|
11
|
+
enableAISubtitle(enable: boolean): void;
|
|
12
|
+
setEngineInstance(engineInstance: any): void;
|
|
13
|
+
setImInstance(imInstance: any): void;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -46,6 +46,7 @@ export default class TUICallService {
|
|
|
46
46
|
setRemoteViewBackgroundImage(userId: string, url: string): void;
|
|
47
47
|
setLayoutMode(layoutMode: LayoutMode): void;
|
|
48
48
|
setCameraDefaultState(isOpen: boolean): void;
|
|
49
|
+
enableAISubtitle(enable: boolean): void;
|
|
49
50
|
callExperimentalAPI(jsonStr: string): void;
|
|
50
51
|
accept(): Promise<void>;
|
|
51
52
|
hangup(): Promise<void>;
|