@trtc/calls-uikit-react 4.4.3 → 4.4.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 +2 -2
- package/src/Components/assets/aiAssistant/desktop/subtitleSettings.svg +4 -0
- package/src/Components/assets/aiAssistant/mobile/close-aiAssistant.svg +7 -0
- package/src/Components/assets/aiAssistant/mobile/open-aiAssistant.svg +7 -0
- package/src/Components/assets/aiAssistant/mobile/subtitleSettings.svg +3 -0
- package/src/Components/components/base/CustomSelect/CustomSelect.scss +116 -0
- package/src/Components/components/base/CustomSelect/CustomSelect.tsx +96 -0
- package/src/Components/components/common/AIAssistant/AISubtitle.scss +109 -0
- package/src/Components/components/common/AIAssistant/AISubtitle.tsx +52 -66
- package/src/Components/components/common/AIAssistant/components/AITranscriberSwitchH5.tsx +39 -0
- package/src/Components/components/common/AIAssistant/components/AITranscriberSwitchPC.scss +46 -0
- package/src/Components/components/common/AIAssistant/components/AITranscriberSwitchPC.tsx +42 -0
- package/src/Components/components/common/AIAssistant/components/SubtitleContent.scss +67 -0
- package/src/Components/components/common/AIAssistant/components/SubtitleContent.tsx +134 -0
- package/src/Components/components/common/AIAssistant/components/SubtitleSettingsH5.scss +275 -0
- package/src/Components/components/common/AIAssistant/components/SubtitleSettingsH5.tsx +265 -0
- package/src/Components/components/common/AIAssistant/components/SubtitleSettingsPC.scss +98 -0
- package/src/Components/components/common/AIAssistant/components/SubtitleSettingsPC.tsx +198 -0
- package/src/Components/components/common/AIAssistant/components/index.ts +5 -0
- package/src/Components/components/common/AIAssistant/index.ts +3 -1
- package/src/Components/components/common/TopBar/h5/TopBarH5.tsx +11 -1
- package/src/Components/components/common/TopBar/pc/TopBarPC.module.scss +20 -0
- package/src/Components/components/common/TopBar/pc/TopBarPC.tsx +14 -9
- package/src/Components/hooks/index.ts +2 -0
- package/src/Components/hooks/useAIAssistant.ts +174 -0
- package/src/TUICallService/CallService/AIAssistant.ts +285 -39
- package/src/TUICallService/CallService/index.ts +19 -9
- package/src/TUICallService/TUIStore/callStore.ts +5 -0
- package/src/TUICallService/const/index.ts +4 -0
- package/src/TUICallService/interface/ICallStore.ts +5 -0
- package/src/TUICallService/locales/en.ts +15 -0
- package/src/TUICallService/locales/ja_JP.ts +15 -0
- package/src/TUICallService/locales/zh-cn.ts +15 -0
- package/src/index.ts +1 -1
- package/tuicall-uikit-react.es.js +4265 -3703
- package/tuicall-uikit-react.umd.js +8 -3
- package/types/Components/components/base/CustomSelect/CustomSelect.d.ts +15 -0
- package/types/Components/components/common/AIAssistant/AISubtitle.d.ts +1 -0
- package/types/Components/components/common/AIAssistant/components/AITranscriberSwitchH5.d.ts +3 -0
- package/types/Components/components/common/AIAssistant/components/AITranscriberSwitchPC.d.ts +4 -0
- package/types/Components/components/common/AIAssistant/components/SubtitleContent.d.ts +8 -0
- package/types/Components/components/common/AIAssistant/components/SubtitleSettingsH5.d.ts +13 -0
- package/types/Components/components/common/AIAssistant/components/SubtitleSettingsPC.d.ts +13 -0
- package/types/Components/components/common/AIAssistant/components/index.d.ts +5 -0
- package/types/Components/components/common/AIAssistant/index.d.ts +1 -0
- package/types/Components/hooks/index.d.ts +2 -1
- package/types/Components/hooks/useAIAssistant.d.ts +22 -0
- package/types/TUICallService/CallService/AIAssistant.d.ts +72 -15
- package/types/TUICallService/CallService/index.d.ts +2 -1
- package/types/TUICallService/interface/ICallStore.d.ts +4 -0
- package/types/TUICallService/locales/en.d.ts +14 -0
- package/types/TUICallService/locales/ja_JP.d.ts +14 -0
- package/types/TUICallService/locales/zh-cn.d.ts +14 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './CustomSelect.scss';
|
|
3
|
+
export interface SelectOption {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string | number;
|
|
6
|
+
}
|
|
7
|
+
interface CustomSelectProps {
|
|
8
|
+
value: string | number;
|
|
9
|
+
options: SelectOption[];
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
onChange: (value: string | number) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const CustomSelect: React.FC<CustomSelectProps>;
|
|
15
|
+
export default CustomSelect;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './SubtitleSettingsH5.scss';
|
|
3
|
+
interface SubtitleSettingsH5Props {
|
|
4
|
+
visible: boolean;
|
|
5
|
+
onVisibleChange: (visible: boolean) => void;
|
|
6
|
+
onConfirm: (settings: {
|
|
7
|
+
recognitionLanguage: string;
|
|
8
|
+
translationLanguage: string;
|
|
9
|
+
subtitleEnabled: boolean;
|
|
10
|
+
}) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const SubtitleSettingsH5: React.FC<SubtitleSettingsH5Props>;
|
|
13
|
+
export default SubtitleSettingsH5;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './SubtitleSettingsPC.scss';
|
|
3
|
+
interface SubtitleSettingsPCProps {
|
|
4
|
+
visible: boolean;
|
|
5
|
+
onVisibleChange: (visible: boolean) => void;
|
|
6
|
+
onConfirm: (settings: {
|
|
7
|
+
recognitionLanguage: string;
|
|
8
|
+
translationLanguage: string;
|
|
9
|
+
subtitleDisplay: string;
|
|
10
|
+
}) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const SubtitleSettingsPC: React.FC<SubtitleSettingsPCProps>;
|
|
13
|
+
export default SubtitleSettingsPC;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as SubtitleContent } from './SubtitleContent';
|
|
2
|
+
export { default as SubtitleSettingsPC } from './SubtitleSettingsPC';
|
|
3
|
+
export { default as SubtitleSettingsH5 } from './SubtitleSettingsH5';
|
|
4
|
+
export { default as AITranscriberSwitchPC } from './AITranscriberSwitchPC';
|
|
5
|
+
export { default as AITranscriberSwitchH5 } from './AITranscriberSwitchH5';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import useTranslate from "./useTranslate";
|
|
2
2
|
import useDeviceList from "./useDeviceList";
|
|
3
3
|
import useCallDuration from "./useCallDuration";
|
|
4
|
-
|
|
4
|
+
import { useAIAssistant } from "./useAIAssistant";
|
|
5
|
+
export { useTranslate, useDeviceList, useCallDuration, useAIAssistant, };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface ITranslationContent {
|
|
2
|
+
language: string;
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
interface ITranslationInfo {
|
|
6
|
+
roundId: string;
|
|
7
|
+
sender: string;
|
|
8
|
+
nick?: string;
|
|
9
|
+
text: string;
|
|
10
|
+
end: boolean;
|
|
11
|
+
translation: ITranslationContent[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* AI Assistant hook
|
|
15
|
+
* Provides state management for AI transcription functionality
|
|
16
|
+
*/
|
|
17
|
+
export declare function useAIAssistant(): {
|
|
18
|
+
isAITranscriberEnabled: boolean;
|
|
19
|
+
isAITranscriberRunning: boolean;
|
|
20
|
+
subtitleInfoList: ITranslationInfo[];
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -1,15 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
export declare enum RealtimeTranscriberEvent {
|
|
2
|
+
onReceiveTranscriberMessage = "onReceiveTranscriberMessage",
|
|
3
|
+
onRealtimeTranscriberStarted = "onRealtimeTranscriberStarted",
|
|
4
|
+
onRealtimeTranscriberStopped = "onRealtimeTranscriberStopped",
|
|
5
|
+
onRealtimeTranscriberError = "onRealtimeTranscriberError"
|
|
6
|
+
}
|
|
7
|
+
export type TranscriberLanguage = string;
|
|
8
|
+
export interface TranscriberMessage {
|
|
9
|
+
segmentId: string;
|
|
10
|
+
speakerUserId: string;
|
|
11
|
+
sourceText: string;
|
|
12
|
+
translationTexts?: Map<string, string>;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
isCompleted: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface RealtimeTranscriberEventInfoMap {
|
|
17
|
+
[RealtimeTranscriberEvent.onReceiveTranscriberMessage]: {
|
|
18
|
+
roomId: string | number;
|
|
19
|
+
message: TranscriberMessage;
|
|
20
|
+
};
|
|
21
|
+
[RealtimeTranscriberEvent.onRealtimeTranscriberStarted]: {
|
|
22
|
+
roomId: string | number;
|
|
23
|
+
transcriberRobotId: string;
|
|
24
|
+
sourceLanguage: string;
|
|
25
|
+
};
|
|
26
|
+
[RealtimeTranscriberEvent.onRealtimeTranscriberStopped]: {
|
|
27
|
+
roomId: string | number;
|
|
28
|
+
transcriberRobotId: string;
|
|
29
|
+
};
|
|
30
|
+
[RealtimeTranscriberEvent.onRealtimeTranscriberError]: {
|
|
31
|
+
roomId: string | number;
|
|
32
|
+
transcriberRobotId: string;
|
|
33
|
+
error: number;
|
|
34
|
+
errorMessage: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export type RealtimeTranscriberEventCallback = <T extends RealtimeTranscriberEvent>(eventInfo: RealtimeTranscriberEventInfoMap[T]) => void;
|
|
38
|
+
export default class AIAssistant {
|
|
39
|
+
static instance: AIAssistant;
|
|
40
|
+
private _callService;
|
|
41
|
+
private eventListeners;
|
|
42
|
+
constructor(options: {
|
|
43
|
+
callService: any;
|
|
44
|
+
});
|
|
45
|
+
static getInstance(options: {
|
|
46
|
+
callService: any;
|
|
47
|
+
}): AIAssistant;
|
|
48
|
+
/**
|
|
49
|
+
* Get AI Transcriber Manager instance
|
|
50
|
+
* @returns AITranscriberManager instance or null if not available
|
|
51
|
+
*/
|
|
52
|
+
private getTranscriberManager;
|
|
53
|
+
private triggerEvent;
|
|
54
|
+
startRealtimeTranscriber: (config: {
|
|
55
|
+
sourceLanguage: TranscriberLanguage;
|
|
56
|
+
translationLanguages?: TranscriberLanguage[];
|
|
57
|
+
}) => Promise<any>;
|
|
58
|
+
stopRealtimeTranscriber: () => Promise<void>;
|
|
59
|
+
updateRealTimeTranscriber: (config: {
|
|
60
|
+
sourceLanguage: TranscriberLanguage;
|
|
61
|
+
translationLanguages?: TranscriberLanguage[];
|
|
62
|
+
}) => Promise<any>;
|
|
63
|
+
subscribeEvent: (event: RealtimeTranscriberEvent, callback: RealtimeTranscriberEventCallback) => void;
|
|
64
|
+
unsubscribeEvent: (event: RealtimeTranscriberEvent, callback: RealtimeTranscriberEventCallback) => void;
|
|
65
|
+
private onReceiveTranscriberMessage;
|
|
66
|
+
private onRealtimeTranscriberStarted;
|
|
67
|
+
private onRealtimeTranscriberStopped;
|
|
68
|
+
private onRealtimeTranscriberError;
|
|
69
|
+
bindEvent: () => void;
|
|
70
|
+
unbindEvent: () => void;
|
|
71
|
+
reset: () => void;
|
|
72
|
+
}
|
|
@@ -8,6 +8,7 @@ export { TUIGlobal, TUIStore, uiDesign };
|
|
|
8
8
|
export default class TUICallService {
|
|
9
9
|
static instance: TUICallService;
|
|
10
10
|
_tuiCallEngine: any;
|
|
11
|
+
_aiAssistant: any;
|
|
11
12
|
private _tim;
|
|
12
13
|
private _TUICore;
|
|
13
14
|
private _timerId;
|
|
@@ -38,6 +39,7 @@ export default class TUICallService {
|
|
|
38
39
|
setSelfInfo(params: ISelfInfoParams): Promise<void>;
|
|
39
40
|
enableVirtualBackground(enable: boolean): Promise<void>;
|
|
40
41
|
enableAIVoice(enable: boolean): Promise<void>;
|
|
42
|
+
enableAITranscriber(enable: boolean): Promise<void>;
|
|
41
43
|
setCallingBell(filePath?: string): Promise<void>;
|
|
42
44
|
enableMuteMode(enable: boolean): Promise<void>;
|
|
43
45
|
hideFeatureButton(buttonName: FeatureButton): void;
|
|
@@ -45,7 +47,6 @@ export default class TUICallService {
|
|
|
45
47
|
setRemoteViewBackgroundImage(userId: string, url: string): void;
|
|
46
48
|
setLayoutMode(layoutMode: LayoutMode): void;
|
|
47
49
|
setCameraDefaultState(isOpen: boolean): void;
|
|
48
|
-
enableAISubtitle(enable: boolean): void;
|
|
49
50
|
callExperimentalAPI(jsonStr: string): void;
|
|
50
51
|
accept(): Promise<void>;
|
|
51
52
|
private _handleAcceptResponse;
|
|
@@ -138,4 +138,18 @@ export declare const en: {
|
|
|
138
138
|
'error.10013': string;
|
|
139
139
|
'error.10014': string;
|
|
140
140
|
error: string;
|
|
141
|
+
'ai-subtitle': string;
|
|
142
|
+
'ai-subtitle-settings': string;
|
|
143
|
+
'recognition-language': string;
|
|
144
|
+
'translation-language': string;
|
|
145
|
+
'subtitle-display-settings': string;
|
|
146
|
+
'subtitle-display-bilingual': string;
|
|
147
|
+
'no-translation': string;
|
|
148
|
+
'show-bilingual': string;
|
|
149
|
+
'show-original-only': string;
|
|
150
|
+
save: string;
|
|
151
|
+
'select-recognition-language': string;
|
|
152
|
+
'select-translation-language': string;
|
|
153
|
+
confirm: string;
|
|
154
|
+
'recognition-and-translation-settings': string;
|
|
141
155
|
};
|
|
@@ -137,4 +137,18 @@ export declare const ja_JP: {
|
|
|
137
137
|
'error.10013': string;
|
|
138
138
|
'error.10014': string;
|
|
139
139
|
error: string;
|
|
140
|
+
'ai-subtitle': string;
|
|
141
|
+
'ai-subtitle-settings': string;
|
|
142
|
+
'recognition-language': string;
|
|
143
|
+
'translation-language': string;
|
|
144
|
+
'subtitle-display-settings': string;
|
|
145
|
+
'subtitle-display-bilingual': string;
|
|
146
|
+
'no-translation': string;
|
|
147
|
+
'show-bilingual': string;
|
|
148
|
+
'show-original-only': string;
|
|
149
|
+
save: string;
|
|
150
|
+
'select-recognition-language': string;
|
|
151
|
+
'select-translation-language': string;
|
|
152
|
+
confirm: string;
|
|
153
|
+
'recognition-and-translation-settings': string;
|
|
140
154
|
};
|
|
@@ -133,4 +133,18 @@ export declare const zh: {
|
|
|
133
133
|
'error.10013': string;
|
|
134
134
|
'error.10014': string;
|
|
135
135
|
error: string;
|
|
136
|
+
'ai-subtitle': string;
|
|
137
|
+
'ai-subtitle-settings': string;
|
|
138
|
+
'recognition-language': string;
|
|
139
|
+
'translation-language': string;
|
|
140
|
+
'subtitle-display-settings': string;
|
|
141
|
+
'subtitle-display-bilingual': string;
|
|
142
|
+
'no-translation': string;
|
|
143
|
+
'show-bilingual': string;
|
|
144
|
+
'show-original-only': string;
|
|
145
|
+
save: string;
|
|
146
|
+
'select-recognition-language': string;
|
|
147
|
+
'select-translation-language': string;
|
|
148
|
+
confirm: string;
|
|
149
|
+
'recognition-and-translation-settings': string;
|
|
136
150
|
};
|