@tencent-rtc/mcp 1.3.3 → 1.3.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/resource/doc/chatuikit/android/features/theme.md +363 -0
- package/resource/doc/chatuikit/{android/client_api_Android.md → faq/android_sdk/client-api.md} +0 -2
- package/resource/doc/chatuikit/faq/common/product.md +8 -0
- package/resource/doc/chatuikit/faq/flutter_sdk/faq.md +53 -0
- package/resource/doc/chatuikit/{iOS/client_api_iOS.md → faq/ios_sdk/client-api.md} +0 -2
- package/resource/doc/chatuikit/flutter/features/theme.md +379 -0
- package/resource/doc/chatuikit/flutter/integration.md +413 -0
- package/resource/doc/chatuikit/flutter/workflow.md +941 -0
- package/resource/doc/chatuikit/iOS/features/theme.md +416 -0
- package/resource/doc/chatuikit/iOS/workflow.md +0 -0
- package/resource/doc/chatuikit/react/components/chat-setting.md +86 -0
- package/resource/doc/chatuikit/react/components/contact-list.md +1093 -0
- package/resource/doc/chatuikit/react/components/search.md +745 -0
- package/resource/doc/chatuikit/vue/components/chat-setting.md +64 -0
- package/resource/doc/chatuikit/vue/components/contact-list.md +679 -0
- package/resource/doc/chatuikit/vue/components/search.md +1384 -0
- package/resource/doc/livekit/live/android/workflow.md +137 -6
- package/resource/doc/livekit/live/ios/live-audience-list.md +339 -0
- package/resource/doc/livekit/live/ios/live-audio-effect.md +370 -0
- package/resource/doc/livekit/live/ios/live-barrage.md +517 -0
- package/resource/doc/livekit/live/ios/live-base-beauty.md +247 -0
- package/resource/doc/livekit/live/ios/live-co-guest-interaction.md +518 -0
- package/resource/doc/livekit/live/ios/live-gift.md +783 -0
- package/resource/doc/livekit/live/ios/live-host-interaction.md +815 -0
- package/resource/doc/livekit/live/ios/live-integration.md +931 -0
- package/resource/doc/livekit/live/ios/live-live-list.md +485 -0
- package/resource/doc/livekit/live/ios/workflow.md +454 -0
- package/resource/doc/rtcengine/web/plugin/20-advanced-customized-capture-rendering.md +87 -0
- package/resource/doc/rtcengine/web/plugin/21-advanced-auto-play-policy.md +87 -0
- package/resource/doc/rtcengine/web/plugin/22-advanced-audio-mixer.md +175 -0
- package/resource/doc/rtcengine/web/plugin/23-advanced-support-detection.md +221 -0
- package/resource/doc/rtcengine/web/plugin/24-advanced-network-quality.md +140 -0
- package/resource/doc/rtcengine/web/plugin/25-advanced-device-change.md +99 -0
- package/resource/doc/rtcengine/web/plugin/26-advanced-publish-cdn-stream.md +451 -0
- package/resource/doc/rtcengine/web/plugin/27-advanced-small-stream.md +151 -0
- package/resource/doc/rtcengine/web/plugin/28-advanced-beauty.md +322 -0
- package/resource/doc/rtcengine/web/plugin/29-advanced-water-mark.md +149 -0
- package/resource/doc/rtcengine/web/plugin/30-advanced-cross-room-link.md +96 -0
- package/resource/doc/rtcengine/web/plugin/31-advanced-plugins-overview.md +330 -0
- package/resource/doc/rtcengine/web/plugin/34-advanced-proxy.md +248 -0
- package/resource/doc/rtcengine/web/plugin/35-advanced-ai-denoiser.md +81 -0
- package/resource/doc/rtcengine/web/plugin/36-advanced-virtual-background.md +242 -0
- package/resource/doc/rtcengine/web/plugin/37-advanced-voice-changer.md +99 -0
- package/resource/doc/rtcengine/web/plugin/39-advanced-video-decoder.md +33 -0
- package/resource/doc/rtcengine/web/plugin/40-advanced-video-mixer.md +379 -0
- package/resource/doc/rtcengine/web/plugin/41-advanced-small-stream-auto-switcher.md +91 -0
- package/resource/doc/rtcengine/web/plugin/42-advanced-realtime-transcriber.md +315 -0
- package/resource/doc/rtcengine/web/plugin/43-advanced-face-detection.md +180 -0
- package/tools/chat/get-native-chat-feature-detail.js +30 -0
- package/tools/chat/get-native-chat-feature-detail.js.map +1 -0
- package/tools/chat/get-native-chat-integration.js +30 -12
- package/tools/chat/get-native-chat-integration.js.map +1 -1
- package/tools/common/get-faq.js +2 -4
- package/tools/common/get-faq.js.map +1 -1
- package/tools/definitions/get_native_chat_feature_detail_def.js +32 -0
- package/tools/definitions/get_native_chat_feature_detail_def.js.map +1 -0
- package/tools/definitions/get_native_chat_uikit_integration_def.js +19 -7
- package/tools/definitions/get_native_chat_uikit_integration_def.js.map +1 -1
- package/tools/definitions/{get_native_live_extra_features_def.js → get_native_live_uikit_extra_features_def.js} +3 -3
- package/tools/definitions/get_native_live_uikit_extra_features_def.js.map +1 -0
- package/tools/definitions/{get_native_live_interaction_def.js → get_native_live_uikit_interaction_def.js} +3 -3
- package/tools/definitions/get_native_live_uikit_interaction_def.js.map +1 -0
- package/tools/definitions/get_web_chat_uikit_component_detail_def.js +49 -10
- package/tools/definitions/get_web_chat_uikit_component_detail_def.js.map +1 -1
- package/tools/definitions/record_prompt_def.js +42 -11
- package/tools/definitions/record_prompt_def.js.map +1 -1
- package/tools/definitions/record_result_def.js +1 -1
- package/tools/index.js +6 -4
- package/tools/index.js.map +1 -1
- package/tools/live/{get_native_live_extra_features.js → get_native_live_uikit_extra_features.js} +4 -4
- package/tools/live/get_native_live_uikit_extra_features.js.map +1 -0
- package/tools/live/{get_native_live_interaction.js → get_native_live_uikit_interaction.js} +4 -4
- package/tools/live/get_native_live_uikit_interaction.js.map +1 -0
- package/tools/rtcengine/get-rtcengine-web-sdk-integration.js.map +1 -1
- package/tools/rtcengine/get-trtc-sdk-faq.js +32 -0
- package/tools/rtcengine/get-trtc-sdk-faq.js.map +1 -0
- package/tools/rtcengine/get-trtc-web-sdk-faq.js +1 -1
- package/tools/rtcengine/get-trtc-web-sdk-integration.js.map +1 -1
- package/tools/rtcengine/get-trtc-web-sdk-plugin.js +45 -0
- package/tools/rtcengine/get-trtc-web-sdk-plugin.js.map +1 -0
- package/utils/handle-component-name.js +0 -16
- package/utils/handle-component-name.js.map +1 -1
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
- package/resource/doc/chatuikit/android/generate_UserSig.md +0 -306
- package/resource/doc/chatuikit/android/integrarte_only_tuichat_Android.md +0 -290
- package/resource/doc/chatuikit/android/quick_start_Android.md +0 -138
- package/resource/doc/chatuikit/android/show_typing_Android.md +0 -43
- package/resource/doc/chatuikit/flutter/generate_UserSig.md +0 -306
- package/resource/doc/chatuikit/flutter/integrate_tuikit_Flutter.md +0 -133
- package/resource/doc/chatuikit/iOS/generate_UserSig.md +0 -306
- package/resource/doc/chatuikit/iOS/integrate_only_tuichat_iOS.md +0 -748
- package/resource/doc/chatuikit/iOS/quick_start_iOS.md +0 -163
- package/resource/doc/chatuikit/iOS/show_typing_iOS.md +0 -52
- package/tools/definitions/get_native_live_extra_features_def.js.map +0 -1
- package/tools/definitions/get_native_live_interaction_def.js.map +0 -1
- package/tools/live/get_native_live_extra_features.js.map +0 -1
- package/tools/live/get_native_live_interaction.js.map +0 -1
- /package/resource/doc/chatuikit/android/{integrate_tuikit_Android.md → integration.md} +0 -0
- /package/resource/doc/chatuikit/{faq/native_sdk/faq.md → android/workflow.md} +0 -0
- /package/resource/doc/chatuikit/{flutter/client_api_Flutter.md → faq/flutter_sdk/client-api.md} +0 -0
- /package/resource/doc/chatuikit/iOS/{integrate_tuikit_iOS.md → integration.md} +0 -0
- /package/resource/doc/chatuikit/react/components/{chatheader.md → chat-header.md} +0 -0
- /package/resource/doc/chatuikit/vue/components/{chatheader.md → chat-header.md} +0 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
## Overview
|
|
2
|
+
|
|
3
|
+
This document describes how to use the Realtime Transcriber plugin to enable real-time speech-to-text (ASR) and translation capabilities. This plugin can convert users' speech in a room to text in real-time and supports translation into multiple languages.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- TRTC Web SDK version >= 5.15.0
|
|
8
|
+
|
|
9
|
+
## Implementation
|
|
10
|
+
|
|
11
|
+
### Import and Register Plugin
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
import TRTC from 'trtc-sdk-v5';
|
|
15
|
+
import RealtimeTranscriber from 'trtc-sdk-v5/plugins/realtime-transcriber';
|
|
16
|
+
|
|
17
|
+
const trtc = TRTC.create({ plugins: [RealtimeTranscriber] });
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Start Plugin
|
|
21
|
+
|
|
22
|
+
Starting the plugin returns a `transcriberRobotId`, which is used to stop the transcription task later.
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
const transcriberRobotId = await trtc.startPlugin('RealtimeTranscriber', {
|
|
26
|
+
sourceLanguage: 'zh',
|
|
27
|
+
translationLanguages: ['en', 'ja'],
|
|
28
|
+
userIdsToTranscribe: 'all',
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Listen for Transcription Messages
|
|
33
|
+
|
|
34
|
+
Listen to the `REALTIME_TRANSCRIBER_MESSAGE` event to receive transcription results.
|
|
35
|
+
|
|
36
|
+
```javascript
|
|
37
|
+
trtc.on(TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE, (event) => {
|
|
38
|
+
console.log(`${event.speakerUserId}: ${event.sourceText}`);
|
|
39
|
+
if (event.translationTexts) {
|
|
40
|
+
Object.entries(event.translationTexts).forEach(([lang, text]) => {
|
|
41
|
+
console.log(` ${lang}: ${text}`);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Listen for State Changes
|
|
48
|
+
|
|
49
|
+
Listen to the `REALTIME_TRANSCRIBER_STATE_CHANGED` event to receive transcription task state changes.
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
trtc.on(TRTC.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED, (event) => {
|
|
53
|
+
console.log(`Transcription state: ${event.state}, robotId: ${event.transcriberRobotId}`);
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Stop Plugin
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
await trtc.stopPlugin('RealtimeTranscriber', { transcriberRobotId });
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Usage Examples
|
|
64
|
+
|
|
65
|
+
### ASR Scenario: Transcribe Audio to Text
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
// Start transcription task
|
|
69
|
+
const robotId = await trtc.startPlugin('RealtimeTranscriber', {
|
|
70
|
+
sourceLanguage: 'zh'
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Listen for transcription messages
|
|
74
|
+
trtc.on(TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE, (data) => {
|
|
75
|
+
console.log(data.speakerUserId + ' says: ' + data.sourceText);
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Translation Scenario: Translate Specific User's Speech into Multiple Languages
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
// Start transcription task, transcribe userA's speech and translate to French and English
|
|
83
|
+
const robotId = await trtc.startPlugin('RealtimeTranscriber', {
|
|
84
|
+
sourceLanguage: 'zh',
|
|
85
|
+
translationLanguages: ['fr', 'en'],
|
|
86
|
+
userIdsToTranscribe: 'userA'
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Listen for transcription messages
|
|
90
|
+
trtc.on(TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE, (data) => {
|
|
91
|
+
console.log(`👤 ${data.speakerUserId}:`);
|
|
92
|
+
console.log(` Original: ${data.sourceText}`);
|
|
93
|
+
|
|
94
|
+
if (data.translationTexts) {
|
|
95
|
+
Object.entries(data.translationTexts).forEach(([lang, text]) => {
|
|
96
|
+
console.log(` ${lang.toUpperCase()}: ${text}`);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Transcribe Multiple Specific Users
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
const robotId = await trtc.startPlugin('RealtimeTranscriber', {
|
|
106
|
+
sourceLanguage: 'en',
|
|
107
|
+
translationLanguages: ['zh', 'ja'],
|
|
108
|
+
userIdsToTranscribe: ['userA', 'userB', 'userC']
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## API Reference
|
|
113
|
+
|
|
114
|
+
### trtc.startPlugin('RealtimeTranscriber', options)
|
|
115
|
+
|
|
116
|
+
Starts a real-time transcription task.
|
|
117
|
+
|
|
118
|
+
**options: RealtimeTranscriberStartOptions**
|
|
119
|
+
|
|
120
|
+
| Name | Type | Required | Description |
|
|
121
|
+
|------|------|----------|-------------|
|
|
122
|
+
| sourceLanguage | `string` | Required | Source language code, currently supports only `'zh'` and `'en'` |
|
|
123
|
+
| translationLanguages | `string` \| `string[]` | Optional | Target translation language(s), supports single language or array, e.g., `'en'` or `['en', 'ja']` |
|
|
124
|
+
| userIdsToTranscribe | `string` \| `string[]` | Optional | User ID(s) to transcribe, defaults to `'all'` for all users, can also specify single or multiple user IDs |
|
|
125
|
+
| transcriberRobotId | `string` | Optional | Custom transcriber robot ID, auto-generated if not provided |
|
|
126
|
+
|
|
127
|
+
**Returns: Promise\<string\>**
|
|
128
|
+
|
|
129
|
+
Returns the `transcriberRobotId` for the transcription task, used to stop the task later.
|
|
130
|
+
|
|
131
|
+
**Example:**
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
const robotId = await trtc.startPlugin('RealtimeTranscriber', {
|
|
135
|
+
sourceLanguage: 'zh',
|
|
136
|
+
translationLanguages: ['en', 'ja'],
|
|
137
|
+
userIdsToTranscribe: 'all',
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### trtc.stopPlugin('RealtimeTranscriber', options)
|
|
142
|
+
|
|
143
|
+
Stops a real-time transcription task.
|
|
144
|
+
|
|
145
|
+
**options**
|
|
146
|
+
|
|
147
|
+
| Name | Type | Required | Description |
|
|
148
|
+
|------|------|----------|-------------|
|
|
149
|
+
| transcriberRobotId | `string` | Required | The transcriber robot ID returned when starting |
|
|
150
|
+
|
|
151
|
+
**Example:**
|
|
152
|
+
|
|
153
|
+
```javascript
|
|
154
|
+
await trtc.stopPlugin('RealtimeTranscriber', { transcriberRobotId: robotId });
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Event Reference
|
|
158
|
+
|
|
159
|
+
### TRTC.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED
|
|
160
|
+
|
|
161
|
+
Transcription task state change event.
|
|
162
|
+
|
|
163
|
+
**RealtimeTranscriberStateEvent**
|
|
164
|
+
|
|
165
|
+
| Name | Type | Description |
|
|
166
|
+
|------|------|-------------|
|
|
167
|
+
| state | `'started'` \| `'stopped'` | Transcription task state |
|
|
168
|
+
| roomId | `string` \| `number` | Room ID |
|
|
169
|
+
| transcriberRobotId | `string` | Transcriber robot ID |
|
|
170
|
+
| sourceLanguage | `string` | Source language (optional) |
|
|
171
|
+
| error | `number` | Error code (optional) |
|
|
172
|
+
| errorMessage | `string` | Error message (optional) |
|
|
173
|
+
|
|
174
|
+
**Example:**
|
|
175
|
+
|
|
176
|
+
```javascript
|
|
177
|
+
trtc.on(TRTC.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED, (event) => {
|
|
178
|
+
if (event.state === 'started') {
|
|
179
|
+
console.log('Transcription task started');
|
|
180
|
+
} else if (event.state === 'stopped') {
|
|
181
|
+
console.log('Transcription task stopped');
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE
|
|
187
|
+
|
|
188
|
+
Transcription message event, triggered when new transcription results are available.
|
|
189
|
+
|
|
190
|
+
**RealtimeTranscriberMessageEvent**
|
|
191
|
+
|
|
192
|
+
| Name | Type | Description |
|
|
193
|
+
|------|------|-------------|
|
|
194
|
+
| segmentId | `string` | Speech segment ID, used to identify a continuous speech segment |
|
|
195
|
+
| speakerUserId | `string` | Speaker's user ID |
|
|
196
|
+
| sourceText | `string` | Transcribed source text |
|
|
197
|
+
| translationTexts | `Array<{ language: string, text: string }>` | Translation texts array, e.g., `[{ language: 'en', text: 'hello' }, { language: 'ja', text: 'こんにちは' }]` |
|
|
198
|
+
| timestamp | `number` | Timestamp |
|
|
199
|
+
| isCompleted | `boolean` | Whether the speech segment is completed. `false` indicates intermediate result (real-time update), `true` indicates final result |
|
|
200
|
+
| robotId | `string` | Transcriber robot ID |
|
|
201
|
+
|
|
202
|
+
**Example:**
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
trtc.on(TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE, (event) => {
|
|
206
|
+
const { speakerUserId, sourceText, translationTexts, isCompleted } = event;
|
|
207
|
+
|
|
208
|
+
// Display real-time transcription result
|
|
209
|
+
console.log(`[${isCompleted ? 'Completed' : 'In Progress'}] ${speakerUserId}: ${sourceText}`);
|
|
210
|
+
|
|
211
|
+
// Display translation results
|
|
212
|
+
if (translationTexts) {
|
|
213
|
+
translationTexts.forEach(({ language, text }) => {
|
|
214
|
+
console.log(` ${language}: ${text}`);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// Remove listener
|
|
220
|
+
trtc.off(TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE, handler);
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Supported Languages
|
|
224
|
+
|
|
225
|
+
### ASR Source Languages
|
|
226
|
+
|
|
227
|
+
| Language | Code |
|
|
228
|
+
|----------|------|
|
|
229
|
+
| Chinese | `zh` |
|
|
230
|
+
| English | `en` |
|
|
231
|
+
|
|
232
|
+
<!--
|
|
233
|
+
| Traditional Chinese | `zh-tw` |
|
|
234
|
+
| Chinese Dialects | `zh-dialect` |
|
|
235
|
+
| Cantonese | `zh-yue` |
|
|
236
|
+
| Vietnamese | `vi` |
|
|
237
|
+
| Japanese | `ja` |
|
|
238
|
+
| Korean | `ko` |
|
|
239
|
+
| Indonesian | `id` |
|
|
240
|
+
| Thai | `th` |
|
|
241
|
+
| Portuguese | `pt` |
|
|
242
|
+
| Turkish | `tr` |
|
|
243
|
+
| Arabic | `ar` |
|
|
244
|
+
| Spanish | `es` |
|
|
245
|
+
| Hindi | `hi` |
|
|
246
|
+
| French | `fr` |
|
|
247
|
+
| Malay | `ms` |
|
|
248
|
+
| Filipino | `fil` |
|
|
249
|
+
| German | `de` |
|
|
250
|
+
| Italian | `it` |
|
|
251
|
+
| Russian | `ru` |
|
|
252
|
+
| Swedish | `sv` |
|
|
253
|
+
| Danish | `da` |
|
|
254
|
+
| Norwegian | `no` |
|
|
255
|
+
-->
|
|
256
|
+
|
|
257
|
+
### Translation Target Languages
|
|
258
|
+
|
|
259
|
+
| Language | Code |
|
|
260
|
+
|----------|------|
|
|
261
|
+
| Chinese | `zh` |
|
|
262
|
+
| English | `en` |
|
|
263
|
+
| Vietnamese | `vi` |
|
|
264
|
+
| Japanese | `ja` |
|
|
265
|
+
| Korean | `ko` |
|
|
266
|
+
| Indonesian | `id` |
|
|
267
|
+
| Thai | `th` |
|
|
268
|
+
| Portuguese | `pt` |
|
|
269
|
+
| Arabic | `ar` |
|
|
270
|
+
| Spanish | `es` |
|
|
271
|
+
| French | `fr` |
|
|
272
|
+
| Malay | `ms` |
|
|
273
|
+
| German | `de` |
|
|
274
|
+
| Italian | `it` |
|
|
275
|
+
| Russian | `ru` |
|
|
276
|
+
|
|
277
|
+
## FAQ
|
|
278
|
+
|
|
279
|
+
**1. How to distinguish between intermediate and final results?**
|
|
280
|
+
|
|
281
|
+
Use the `isCompleted` field in the `REALTIME_TRANSCRIBER_MESSAGE` event. When `isCompleted` is `false`, it indicates an intermediate result (real-time update); when `isCompleted` is `true`, it indicates the speech segment is completed with the final result.
|
|
282
|
+
|
|
283
|
+
```javascript
|
|
284
|
+
trtc.on(TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE, (event) => {
|
|
285
|
+
if (event.isCompleted) {
|
|
286
|
+
// Final result, can be stored or displayed
|
|
287
|
+
saveSubtitle(event);
|
|
288
|
+
} else {
|
|
289
|
+
// Intermediate result, can update UI in real-time
|
|
290
|
+
updateLiveCaption(event);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**2. How to merge subtitles by segmentId?**
|
|
296
|
+
|
|
297
|
+
Each continuous speech segment has the same `segmentId`, which can be used to update and merge subtitles:
|
|
298
|
+
|
|
299
|
+
```javascript
|
|
300
|
+
const subtitleMap = new Map();
|
|
301
|
+
|
|
302
|
+
trtc.on(TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE, (event) => {
|
|
303
|
+
subtitleMap.set(event.segmentId, event);
|
|
304
|
+
|
|
305
|
+
if (event.isCompleted) {
|
|
306
|
+
// Speech segment completed, can be archived
|
|
307
|
+
archiveSubtitle(subtitleMap.get(event.segmentId));
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**3. How to save bandwidth?**
|
|
313
|
+
|
|
314
|
+
When you don't need to receive transcription messages, remove all listeners for the `REALTIME_TRANSCRIBER_MESSAGE` event, and the plugin will automatically pause receiving messages to save bandwidth. When listeners are added again, message receiving will automatically resume.
|
|
315
|
+
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
## Function Description
|
|
2
|
+
|
|
3
|
+
This document details how to use the TRTC Web SDK's Face Detection plugin to monitor real-time face presence changes in camera video streams. The plugin employs intelligent debounce logic, triggering callbacks only when face appearance/disappearance states genuinely change, preventing false positives caused by lighting variations or brief obstructions.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- TRTC Web SDK version >= 5.15.0
|
|
8
|
+
- Camera video stream must be enabled first.
|
|
9
|
+
|
|
10
|
+
### Platform Compatibility
|
|
11
|
+
|
|
12
|
+
| Platform | Operating System | Browser Version | Notes |
|
|
13
|
+
| :--- | :--- | :--- | :--- |
|
|
14
|
+
| Web | Windows | Chrome 90+, Firefox 90+, Edge 97+ | Recommended: Latest Chrome browser (with hardware acceleration enabled) |
|
|
15
|
+
| Web | Mac | Chrome 98+, Firefox 96+, Safari 15+ | 2019 or newer MacBook recommended |
|
|
16
|
+
| Web | Android | Chrome、Firefox| Use of Chrome or Firefox is recommended |
|
|
17
|
+
| Web | iOS | Chrome、Safari、Firefox | Use of Chrome or Safari is recommended |
|
|
18
|
+
|
|
19
|
+
## Implementation Steps
|
|
20
|
+
|
|
21
|
+
### Deploying Static Resources
|
|
22
|
+
|
|
23
|
+
The plugin relies on static resource files. To ensure the browser can load and run these files correctly, you need to complete the following steps:
|
|
24
|
+
|
|
25
|
+
1. Publish the `node_modules/trtc-sdk-v5/assets` directory to your CDN or static resource server.
|
|
26
|
+
2. Pass your CDN address to the `assetsPath` parameter when creating the TRTC instance, e.g., `TRTC.create({ assetsPath: 'https://xxxx/assets' })`. The SDK will load the necessary resource files on demand.
|
|
27
|
+
|
|
28
|
+
> - If your SDK version is lower than `v5.10.0`, you need to download and extract https://web.sdk.qcloud.com/trtc/webrtc/v5/assets/assets.zip, then publish it to your CDN or static resource server.
|
|
29
|
+
> - If the Host URL of the files differs from your web application's Host URL, you need to enable CORS policy for the file domain.
|
|
30
|
+
> - Do not host the directory files under an HTTP service, as loading HTTP resources under an HTTPS domain will be blocked by the browser's security policy.
|
|
31
|
+
|
|
32
|
+
### Registering the Plugin
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
import { FaceDetection } from 'trtc-sdk-v5/plugins/video-effect/face-detection';
|
|
36
|
+
|
|
37
|
+
const trtc = TRTC.create({
|
|
38
|
+
plugins: [FaceDetection],
|
|
39
|
+
assetsPath: 'https://xxxx/assets' // Replace with your static resource address
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Starting the Local Camera
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
await trtc.startLocalVideo();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Enabling the Face Detection Plugin
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
await trtc.startPlugin('FaceDetection', {
|
|
53
|
+
onFaceDetectionStateChanged: (hasFace) => {
|
|
54
|
+
if (hasFace) {
|
|
55
|
+
console.log('Face detected');
|
|
56
|
+
// Execute business logic for face appearance
|
|
57
|
+
} else {
|
|
58
|
+
console.log('Face disappeared');
|
|
59
|
+
// Execute business logic for face disappearance
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
detectionInterval: 300, // Detection interval in ms (Optional, default: 300)
|
|
63
|
+
minConfidence: 0.8, // Minimum confidence threshold (Optional, default: 0.8)
|
|
64
|
+
missingTimeout: 1000 // Disappearance confirmation time in ms (Optional, default: 1000)
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Updating Parameters as Needed
|
|
69
|
+
|
|
70
|
+
```javascript
|
|
71
|
+
// Update detection parameters - increase sensitivity
|
|
72
|
+
await trtc.updatePlugin('FaceDetection', {
|
|
73
|
+
onFaceDetectionStateChanged: (hasFace) => {
|
|
74
|
+
console.log('Updated detection state:', hasFace);
|
|
75
|
+
},
|
|
76
|
+
detectionInterval: 200, // Shorter interval for higher real-time performance
|
|
77
|
+
minConfidence: 0.7, // Lower threshold for higher sensitivity
|
|
78
|
+
missingTimeout: 1500 // Longer timeout to reduce false negatives
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Disabling Face Detection
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
await trtc.stopPlugin('FaceDetection');
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Core Features
|
|
89
|
+
|
|
90
|
+
### Intelligent Debounce Logic
|
|
91
|
+
|
|
92
|
+
The plugin uses an **asymmetric debounce mechanism** to ensure state change accuracy:
|
|
93
|
+
|
|
94
|
+
- **Face appears (true)**: Triggered immediately for real-time response.
|
|
95
|
+
- **Face disappears (false)**: Triggered after a delay, requiring the `missingTimeout` condition to be met for confirmation.
|
|
96
|
+
|
|
97
|
+
This design effectively prevents false positives caused by:
|
|
98
|
+
- Brief head turns or looking down
|
|
99
|
+
- Sudden lighting changes
|
|
100
|
+
- Temporary obstructions
|
|
101
|
+
|
|
102
|
+
### Video Stream State Synchronization
|
|
103
|
+
|
|
104
|
+
The plugin automatically handles local video stream state changes:
|
|
105
|
+
|
|
106
|
+
| Scenario | Plugin Behavior | Callback Trigger |
|
|
107
|
+
| :--- | :--- | :--- |
|
|
108
|
+
| Video muted (Mute) | Pauses detection | Triggers once with `hasFace: false` |
|
|
109
|
+
| Video resumed (Unmute) | Resumes detection | Triggers callback based on actual state |
|
|
110
|
+
|
|
111
|
+
## API Documentation
|
|
112
|
+
|
|
113
|
+
### trtc.startPlugin('FaceDetection', options)
|
|
114
|
+
|
|
115
|
+
Used to start the Face Detection plugin.
|
|
116
|
+
|
|
117
|
+
#### options
|
|
118
|
+
|
|
119
|
+
| Name | Type | Attributes | Description |
|
|
120
|
+
| :--- | :--- | :--- | :--- |
|
|
121
|
+
| `onFaceDetectionStateChanged` | `(hasFace: boolean) => void` | **Required** | Callback function for face state changes (triggered only on genuine state change) |
|
|
122
|
+
| `detectionInterval` | number | Optional | Detection interval time (ms), range: 100-5000, default: 300 |
|
|
123
|
+
| `minConfidence` | number | Optional | Minimum face confidence threshold, range: 0-1, default: 0.8 |
|
|
124
|
+
| `missingTimeout` | number | Optional | Face disappearance confirmation time (ms), range: 0-5000, default: 1000 |
|
|
125
|
+
|
|
126
|
+
**Example:**
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
await trtc.startPlugin('FaceDetection', {
|
|
130
|
+
onFaceDetectionStateChanged: (hasFace) => {
|
|
131
|
+
if (hasFace) {
|
|
132
|
+
console.log('Face appeared');
|
|
133
|
+
} else {
|
|
134
|
+
console.log('Face disappeared');
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
detectionInterval: 300,
|
|
138
|
+
minConfidence: 0.8,
|
|
139
|
+
missingTimeout: 1000
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### trtc.updatePlugin('FaceDetection', options)
|
|
144
|
+
|
|
145
|
+
Used to modify face detection parameters.
|
|
146
|
+
|
|
147
|
+
#### options
|
|
148
|
+
|
|
149
|
+
| Name | Type | Attributes | Description |
|
|
150
|
+
| :--- | :--- | :--- | :--- |
|
|
151
|
+
| `onFaceDetectionStateChanged` | `(hasFace: boolean) => void` | Optional | Callback function for face state changes |
|
|
152
|
+
| `detectionInterval` | number | Optional | Detection interval time (ms), range: 100-5000 |
|
|
153
|
+
| `minConfidence` | number | Optional | Minimum face confidence threshold, range: 0-1 |
|
|
154
|
+
| `missingTimeout` | number | Optional | Face disappearance confirmation time (ms), range: 0-5000 |
|
|
155
|
+
|
|
156
|
+
**Example:**
|
|
157
|
+
|
|
158
|
+
```javascript
|
|
159
|
+
await trtc.updatePlugin('FaceDetection', {
|
|
160
|
+
detectionInterval: 200,
|
|
161
|
+
minConfidence: 0.7,
|
|
162
|
+
missingTimeout: 1500
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### trtc.stopPlugin('FaceDetection')
|
|
167
|
+
|
|
168
|
+
Stops the Face Detection plugin.
|
|
169
|
+
|
|
170
|
+
## FAQs
|
|
171
|
+
|
|
172
|
+
**1. How to adjust detection sensitivity?**
|
|
173
|
+
|
|
174
|
+
Adjust sensitivity by combining these parameters:
|
|
175
|
+
- **Increase sensitivity**: Lower `minConfidence`, shorten `detectionInterval`
|
|
176
|
+
- **Decrease sensitivity**: Raise `minConfidence`, lengthen `missingTimeout`
|
|
177
|
+
|
|
178
|
+
**2. Do I need to restart detection after the video stream recovers?**
|
|
179
|
+
|
|
180
|
+
No. The plugin automatically handles video stream state changes and resumes detection upon recovery.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { GET_NATIVE_CHAT_FEATURE_DETAIL_DEFINITION } from '../definitions/get_native_chat_feature_detail_def.js';
|
|
3
|
+
import { getDocContent } from '../../utils/get-doc-content.js';
|
|
4
|
+
import { reportCLSClient } from '../../utils/report-cls-client.js';
|
|
5
|
+
import { handleFramework } from '../../utils/handle-framework.js';
|
|
6
|
+
function getResultText(params) {
|
|
7
|
+
const { framework, featureName = '' } = params;
|
|
8
|
+
reportCLSClient({
|
|
9
|
+
method: 'get_native_chat_feature_detail',
|
|
10
|
+
info: featureName,
|
|
11
|
+
framework: framework,
|
|
12
|
+
});
|
|
13
|
+
return getDocContent(['chatuikit', `${handleFramework(framework)}`, 'features', `${featureName}.md`]);
|
|
14
|
+
}
|
|
15
|
+
const registryGetNativeChatFeatureDetailTool = (mcpServer) => {
|
|
16
|
+
const { name, description, parameter_descriptions } = GET_NATIVE_CHAT_FEATURE_DETAIL_DEFINITION;
|
|
17
|
+
mcpServer.tool(name, description, {
|
|
18
|
+
framework: z.enum(['andriod', 'ios', 'flutter']).describe(parameter_descriptions.framework),
|
|
19
|
+
featureName: z.string().describe(parameter_descriptions.featureName),
|
|
20
|
+
}, (params) => ({
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: 'text',
|
|
24
|
+
text: getResultText(params),
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
export { registryGetNativeChatFeatureDetailTool };
|
|
30
|
+
//# sourceMappingURL=get-native-chat-feature-detail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-native-chat-feature-detail.js","sourceRoot":"","sources":["../../../src/tools/chat/get-native-chat-feature-detail.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yCAAyC,EAAE,MAAM,sDAAsD,CAAC;AACjH,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGlE,SAAS,aAAa,CAAC,MAA2B;IAChD,MAAM,EAAE,SAAS,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IAC/C,eAAe,CAAC;QACd,MAAM,EAAE,gCAAgC;QACxC,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,SAAS;KACrB,CAAC,CAAC;IACH,OAAO,aAAa,CAAC,CAAC,WAAW,EAAE,GAAG,eAAe,CAAC,SAAS,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,WAAW,KAAK,CAAC,CAAC,CAAC;AACxG,CAAC;AAED,MAAM,sCAAsC,GAAG,CAAC,SAAoB,EAAE,EAAE;IACtE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,sBAAsB,EAAE,GAAG,yCAAyC,CAAC;IAChG,SAAS,CAAC,IAAI,CACZ,IAAI,EACJ,WAAW,EACX;QACE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,SAAS,CAAC;QAC3F,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC,WAAW,CAAC;KACrE,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACd,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC;aAC5B;SACF;KACF,CAAC,CAAC,CAAC;AACR,CAAC,CAAC;AACF,OAAO,EAAE,sCAAsC,EAAE,CAAC"}
|
|
@@ -2,26 +2,44 @@ import { z } from 'zod';
|
|
|
2
2
|
import { GET_NATIVE_CHAT_UIKIT_INTEGRATION_DEFINITION } from '../definitions/get_native_chat_uikit_integration_def.js';
|
|
3
3
|
import { getDocContent } from '../../utils/get-doc-content.js';
|
|
4
4
|
import { reportCLSClient } from '../../utils/report-cls-client.js';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { generateStructuredResult } from '../../utils/generate-structured-result.js';
|
|
6
|
+
async function getResultText(params) {
|
|
7
|
+
const { framework = '', goals = [] } = params;
|
|
7
8
|
reportCLSClient({
|
|
8
9
|
method: 'get_native_chat_uikit_integration',
|
|
9
|
-
|
|
10
|
+
info: goals.join(','),
|
|
11
|
+
framework,
|
|
10
12
|
});
|
|
11
|
-
|
|
13
|
+
// 获取工作流指令
|
|
14
|
+
const baseInstructions = getDocContent(['chatuikit', framework, 'workflow.md']);
|
|
15
|
+
// 批量读取目标文档并生成结构化结果
|
|
16
|
+
const result = await generateStructuredResult({
|
|
17
|
+
baseInstructions,
|
|
18
|
+
goals,
|
|
19
|
+
framework,
|
|
20
|
+
pathMap: {
|
|
21
|
+
[goals[0]]: ['chatuikit', framework, 'integration.md'],
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
return result;
|
|
12
25
|
}
|
|
13
26
|
const registryGetNativeChatIntegrationTool = (mcpServer) => {
|
|
14
27
|
const { name, description, parameter_descriptions } = GET_NATIVE_CHAT_UIKIT_INTEGRATION_DEFINITION;
|
|
15
28
|
mcpServer.tool(name, description, {
|
|
16
29
|
framework: z.enum(['flutter', 'android', 'ios']).describe(parameter_descriptions.framework),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
goals: z.array(z.enum(['full-featured', 'chat-only'])).describe(parameter_descriptions.goals)
|
|
31
|
+
}, async (params) => {
|
|
32
|
+
const result = await getResultText(params);
|
|
33
|
+
return {
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: 'text',
|
|
37
|
+
text: result.llm_code_generation_instructions_md,
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
result: result,
|
|
41
|
+
};
|
|
42
|
+
});
|
|
25
43
|
};
|
|
26
44
|
export { registryGetNativeChatIntegrationTool };
|
|
27
45
|
//# sourceMappingURL=get-native-chat-integration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-native-chat-integration.js","sourceRoot":"","sources":["../../../src/tools/chat/get-native-chat-integration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,4CAA4C,EAAE,MAAM,yDAAyD,CAAC;AACvH,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"get-native-chat-integration.js","sourceRoot":"","sources":["../../../src/tools/chat/get-native-chat-integration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,4CAA4C,EAAE,MAAM,yDAAyD,CAAC;AACvH,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAErF,KAAK,UAAU,aAAa,CAAC,MAA2B;IACtD,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IAC9C,eAAe,CAAC;QACd,MAAM,EAAE,mCAAmC;QAC3C,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;QACrB,SAAS;KACV,CAAC,CAAC;IACH,UAAU;IACV,MAAM,gBAAgB,GAAG,aAAa,CAAC,CAAC,WAAW,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC;IAChF,mBAAmB;IACnB,MAAM,MAAM,GAAG,MAAM,wBAAwB,CAAC;QAC5C,gBAAgB;QAChB,KAAK;QACL,SAAS;QACT,OAAO,EAAE;YACP,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,gBAAgB,CAAC;SACvD;KACF,CAAC,CAAA;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,oCAAoC,GAAG,CAAC,SAAoB,EAAE,EAAE;IACpE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,sBAAsB,EAAE,GAAG,4CAA4C,CAAC;IACnG,SAAS,CAAC,IAAI,CACZ,IAAI,EACJ,WAAW,EACX;QACE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,SAAS,CAAC;QAC3F,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,KAAK,CAAC;KAC9F,EACD,KAAK,EAAE,MAAW,EAAE,EAAE;QACpB,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,CAAA;QAC1C,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,MAAM,CAAC,mCAAmC;iBACjD;aACF;YACD,MAAM,EAAE,MAAM;SACf,CAAA;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,oCAAoC,EAAE,CAAC"}
|
package/tools/common/get-faq.js
CHANGED
|
@@ -11,8 +11,6 @@ const PRODUCT_DOC_MAP = {
|
|
|
11
11
|
};
|
|
12
12
|
const WEB_FRAMEWORKS = ['react', 'vue', 'web'];
|
|
13
13
|
const NATIVE_FRAMEWORKS = ['android', 'ios', 'flutter'];
|
|
14
|
-
const WEB_SDK_DIR = 'web_sdk';
|
|
15
|
-
const NATIVE_SDK_DIR = 'native_sdk';
|
|
16
14
|
function getResultText(params) {
|
|
17
15
|
const { query = '', product = '', framework = '' } = params;
|
|
18
16
|
const basePath = PRODUCT_DOC_MAP[product];
|
|
@@ -32,10 +30,10 @@ function getResultText(params) {
|
|
|
32
30
|
// Step 2: SDK FAQ Search (SDK Path)
|
|
33
31
|
let sdkDir = '';
|
|
34
32
|
if (WEB_FRAMEWORKS.includes(framework)) {
|
|
35
|
-
sdkDir =
|
|
33
|
+
sdkDir = 'web_sdk';
|
|
36
34
|
}
|
|
37
35
|
else if (NATIVE_FRAMEWORKS.includes(framework)) {
|
|
38
|
-
sdkDir =
|
|
36
|
+
sdkDir = `${framework}_sdk`;
|
|
39
37
|
}
|
|
40
38
|
const sdkSearchContent = getDocContent([basePath, 'faq', sdkDir]);
|
|
41
39
|
// Step 3: General Knowledge Search (Server Error Codes, Billing, Console, REST API, etc.) (Common Path)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-faq.js","sourceRoot":"","sources":["../../../src/tools/common/get-faq.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,eAAe,GAA2B;IAC9C,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,SAAS,EAAE,WAAW;CACvB,CAAC;AACF,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAC/C,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"get-faq.js","sourceRoot":"","sources":["../../../src/tools/common/get-faq.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,eAAe,GAA2B;IAC9C,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,SAAS,EAAE,WAAW;CACvB,CAAC;AACF,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAC/C,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAExD,SAAS,aAAa,CAAC,MAA2B;IAChD,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IAC5D,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAE1C,eAAe,CAAC;QACd,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,GAAG,OAAO,MAAM,KAAK,EAAE;QAC7B,SAAS;KACV,CAAC,CAAC;IAEH,uDAAuD;IACvD,IAAI,oBAAoB,GAAG,EAAE,CAAC;IAC9B,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;QAC5B,oBAAoB,GAAG,aAAa,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3E,CAAC;SAAM,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QAC/B,oBAAoB,GAAG,aAAa,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,oCAAoC;IACpC,IAAI,MAAM,GAAW,EAAE,CAAC;IACxB,IAAI,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACvC,MAAM,GAAG,SAAS,CAAC;IACrB,CAAC;SAAM,IAAI,iBAAiB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACjD,MAAM,GAAG,GAAG,SAAS,MAAM,CAAC;IAC9B,CAAC;IACD,MAAM,gBAAgB,GAAG,aAAa,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAElE,wGAAwG;IACxG,MAAM,mBAAmB,GAAG,aAAa,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEvE,wBAAwB;IACxB,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,IAAI,oBAAoB,EAAE,CAAC;QACzB,SAAS,CAAC,IAAI,CACZ;YACE,OAAO,EAAE,oBAAoB;YAC7B,QAAQ,EAAE;gBACR,OAAO,EAAE,OAAO;gBAChB,MAAM,EAAE,gBAAgB,QAAQ,IAAI,SAAS,SAAS;aACvD;SACF,CACF,CAAC;IACJ,CAAC;IACD,IAAI,gBAAgB,EAAE,CAAC;QACrB,SAAS,CAAC,IAAI,CACZ;YACE,OAAO,EAAE,gBAAgB;YACzB,QAAQ,EAAE;gBACR,OAAO,EAAE,OAAO;gBAChB,MAAM,EAAE,gBAAgB,QAAQ,QAAQ,MAAM,EAAE;aACjD;SACF,CACF,CAAC;IACJ,CAAC;IACD,IAAI,mBAAmB,EAAE,CAAC;QACxB,SAAS,CAAC,IAAI,CACZ;YACE,OAAO,EAAE,mBAAmB;YAC5B,QAAQ,EAAE;gBACR,OAAO,EAAE,OAAO;gBAChB,MAAM,EAAE,gBAAgB,QAAQ,aAAa;aAC9C;SACF,CACF,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,0EAA0E;QACnF,SAAS;KACV,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,SAAoB,EAAE,EAAE;IACzD,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,sBAAsB,EAAE,GAAG,kBAAkB,CAAC;IACzE,SAAS,CAAC,IAAI,CACZ,IAAI,EACJ,WAAW,EACX;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC,KAAK,CAAC;QACxD,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,OAAO,CAAC;QACvG,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,SAAS,CAAC;KACnH,EACD,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACX,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC;aAC5B;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const TOOL_DESCRIPTION = `
|
|
2
|
+
【Core Purpose】: This is a Native Chat Application UIKit Feature Detail Tool, specifically designed to provide detailed descriptions, usage instructions, and sample code for various features in Native Chat TUIKit.
|
|
3
|
+
|
|
4
|
+
【Functional Scope】:
|
|
5
|
+
Retrieves detailed documentation for any feature, including feature implementation methods, API calls, code examples, etc.
|
|
6
|
+
|
|
7
|
+
【Core Feature Modules】: This tool covers all core features of Native Chat TUIKit, including:
|
|
8
|
+
|
|
9
|
+
**📋 Core Feature List:**
|
|
10
|
+
1. **Theme Customization** (theme): Theme styling customization feature, supporting custom colors, fonts, border radius, spacing and other visual styles, suitable for implementing branded UI, dark mode, personalized appearance and other scenarios
|
|
11
|
+
|
|
12
|
+
【Keywords】: 'feature details', 'TUIKit', 'Native', 'Android', 'iOS', 'Flutter', 'theme', 'theme', 'TUITheme', 'theme customization', 'style customization', 'dark mode', 'dark mode', 'branding', 'colors', 'fonts', 'UI customization'.
|
|
13
|
+
|
|
14
|
+
【Supported Platforms】: Android, iOS and Flutter.
|
|
15
|
+
|
|
16
|
+
【Mandatory Constraints】:
|
|
17
|
+
1. Platform Selection Constraint: If the user does **not explicitly specify** Android, iOS or Flutter platform in the prompt, must prioritize calling the 'present_framework_choice' tool to guide the user to make a selection.
|
|
18
|
+
|
|
19
|
+
2. **Feature Name Must Match Exactly**: featureName parameter must be selected from the following list, fuzzy matching is not supported:
|
|
20
|
+
- 'theme': Theme customization (colors, fonts, border radius, spacing and other visual style customization)
|
|
21
|
+
`;
|
|
22
|
+
const PARAMETER_DESCRIPTIONS = {
|
|
23
|
+
framework: 'Platform/framework type supported by Native Chat UIKit feature details. Available values: android, ios, flutter.',
|
|
24
|
+
featureName: `Specific name of Native Chat UIKit feature, available values:
|
|
25
|
+
- 'theme': Theme customization (colors, fonts, border radius, spacing and other visual style customization)`
|
|
26
|
+
};
|
|
27
|
+
export const GET_NATIVE_CHAT_FEATURE_DETAIL_DEFINITION = {
|
|
28
|
+
name: 'get_native_chat_feature_detail',
|
|
29
|
+
description: TOOL_DESCRIPTION,
|
|
30
|
+
parameter_descriptions: PARAMETER_DESCRIPTIONS,
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=get_native_chat_feature_detail_def.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_native_chat_feature_detail_def.js","sourceRoot":"","sources":["../../../src/tools/definitions/get_native_chat_feature_detail_def.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;CAoBxB,CAAC;AAEF,MAAM,sBAAsB,GAAG;IAC7B,SAAS,EAAE,kHAAkH;IAC7H,WAAW,EAAE;4GAC6F;CAC3G,CAAC;AAGF,MAAM,CAAC,MAAM,yCAAyC,GAAG;IACvD,IAAI,EAAE,gCAAgC;IACtC,WAAW,EAAE,gBAAgB;IAC7B,sBAAsB,EAAE,sBAAsB;CAC/C,CAAC"}
|