@tencent-rtc/mcp 1.7.2 → 1.7.4

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +25 -17
  3. package/knowledge/bm25.js +20 -11
  4. package/knowledge/path-meta.js +23 -1
  5. package/knowledge/search/generic-rerank.js +123 -0
  6. package/knowledge/search/search-pass.js +8 -1
  7. package/package.json +1 -1
  8. package/resource/index/manifest.json +1 -1
  9. package/resource/knowledge/callkit/best-practice/android/video-chat-dating.md +497 -0
  10. package/resource/knowledge/callkit/best-practice/flutter/android-keep-call-alive-background.md +79 -0
  11. package/resource/knowledge/callkit/best-practice/flutter/background-incoming-call-no-notification.md +99 -0
  12. package/resource/knowledge/callkit/best-practice/flutter/ios-keep-call-alive-background.md +93 -0
  13. package/resource/knowledge/callkit/best-practice/flutter/ios-startup-crash-version-voip.md +68 -0
  14. package/resource/knowledge/callkit/core-sdk/miniprogram/call-engine.md +386 -0
  15. package/resource/knowledge/callkit/core-sdk/miniprogram/call-event.md +315 -0
  16. package/resource/knowledge/callkit/faq/uniapp-miniprogram.md +204 -0
  17. package/resource/knowledge/callkit/preset/harmonyos/api.md +362 -0
  18. package/resource/knowledge/callkit/preset/harmonyos/integration.md +318 -0
  19. package/resource/knowledge/callkit/preset/miniprogram/api-uniapp.md +430 -0
  20. package/resource/knowledge/callkit/preset/miniprogram/api.md +293 -0
  21. package/resource/knowledge/callkit/preset/miniprogram/integration.md +294 -0
  22. package/resource/knowledge/callkit/preset/miniprogram/uniapp-integration.md +224 -0
  23. package/resource/knowledge/callkit/preset/uni-app/api.md +339 -0
  24. package/resource/knowledge/callkit/preset/uni-app/integration.md +243 -0
  25. package/resource/knowledge/chat/best-practice/common/web-sdk-log-level.md +76 -0
  26. package/resource/knowledge/chat/best-practice/miniprogram/desktop-wechat-miniprogram-error.md +79 -0
  27. package/resource/knowledge/chat/preset/react/h5/integration.md +964 -0
  28. package/resource/knowledge/chat/preset/vue/h5/integration.md +717 -0
  29. package/resource/knowledge/roomkit/best-practice/vue/screen-share-auto-stop-on-leave.md +62 -0
  30. package/resource/knowledge/roomkit/core-sdk/react/network-proxy.md +83 -0
  31. package/resource/knowledge/roomkit/core-sdk/vue/network-proxy.md +83 -0
  32. package/resource/knowledge/roomkit/core-sdk/vue/recording.md +245 -0
  33. package/resource/knowledge/roomkit/core-sdk/vue/whiteboard-annotation.md +196 -0
  34. package/resource/knowledge/roomkit/faq/error-code.md +103 -0
  35. package/resource/knowledge/roomkit/preset/harmonyos/integration.md +461 -0
  36. package/resource/knowledge/roomkit/preset/react/features/network-proxy.md +79 -0
  37. package/resource/knowledge/roomkit/preset/uniapp-app/integration.md +580 -0
  38. package/resource/knowledge/roomkit/preset/vue/features/ai-caption-translation.md +69 -0
  39. package/resource/knowledge/roomkit/preset/vue/features/ai-denoiser.md +67 -0
  40. package/resource/knowledge/roomkit/preset/vue/features/network-proxy.md +79 -0
  41. package/resource/knowledge/roomkit/preset/vue/features/recording.md +85 -0
  42. package/resource/knowledge/roomkit/preset/vue/features/whiteboard-annotation.md +86 -0
  43. package/resource/knowledge/rtcengine/web/plugin/23-advanced-support-detection.md +6 -6
  44. package/resource/knowledge/rtcengine/web/plugin/31-advanced-plugins-overview.md +8 -6
  45. package/resource/knowledge/rtcengine/web/plugin/42-advanced-realtime-transcriber.md +30 -10
  46. package/server.js +1 -1
  47. package/utils/preflight-route.js +18 -6
  48. package/utils/report-cls-client.js +1 -1
  49. package/utils/report-es-client.js +1 -1
@@ -0,0 +1,717 @@
1
+ TUIKit is a Vue 3 UI component library built on top of the Tencent Cloud Chat SDK. It provides common UI components covering conversations, chat, groups, and more. This guide walks you through quickly integrating TUIKit and implementing core features.
2
+
3
+ | Integration Need | Desktop | Mobile H5 |
4
+ |---------|---------|---------|
5
+ | New Web Vue3 project | Full Integration > Mobile > Vue3 |
6
+ | New Web React project | Full Integration > Desktop > React | Full Integration > Mobile > React |
7
+ | Web Vue2 project | Full Integration > Desktop > Vue2 & Legacy Vue3 | Full Integration > Desktop > Vue2 & Legacy Vue3 |
8
+
9
+ ## Key Concepts
10
+
11
+ chat-uikit-vue3 consists of core UI components including ConversationListH5, Chat, MessageListH5, ChatHeaderH5, MessageInputH5, ChatSettingH5, SearchH5, and ContactH5. Each component is responsible for rendering different content.
12
+ - ConversationListH5 provides the conversation list component.
13
+
14
+ - Chat provides the conversation container component.
15
+
16
+ - MessageListH5 provides the message list component for conversations.
17
+
18
+ - ChatHeaderH5 provides the conversation header component.
19
+
20
+ - MessageInputH5 provides the message input component.
21
+
22
+ - ChatSettingH5 provides the management component for one-to-one and group chats.
23
+
24
+ - SearchH5 provides the cloud search component.
25
+
26
+ - ContactH5 provides the contacts component.
27
+
28
+ ## Prerequisites
29
+ - Vue.js@^3.0.0
30
+
31
+ - TypeScript@^5.0.0
32
+
33
+ - Node.js (Node.js >= 20.0.0, LTS version recommended)
34
+
35
+ ## Quick Start with the Complete Example Project
36
+
37
+ If you want to quickly see the full result, or need a code reference during integration, you can clone our ready-made example project. The example project has completed Chat UIKit dependency installation, component imports, initialization configuration, and basic page integration — ideal as an integration reference.
38
+ ``` bash
39
+ git clone https://gitee.com/tencent-cloud-uikit/rtc-chat-web.git
40
+ cd chat-mobile-vue3
41
+ npm install
42
+ npm run dev
43
+ ```
44
+
45
+ > **Note:**
46
+ > Example project: [View on Gitee](https://gitee.com/tencent-cloud-uikit/rtc-chat-web).
47
+ >
48
+ > The example project helps you quickly experience the integration flow. If you need to integrate into an existing project, continue reading the steps below.
49
+ >
50
+
51
+ ## Create a Project
52
+
53
+ Use Vite to create a new Vue3 project named chat-integration-vue3-h5 and follow the scaffold prompts to initialize the project. After the initial project starts successfully, you can remove the scaffold's sample files and default styles (default styles in src/style.css, src/assets, icons in public, etc.), keeping only src/main.ts and index.html.
54
+
55
+ > **Note:**
56
+ > 1. It is recommended to use npm for installation, as npm will automatically download the required peerDependencies.
57
+ > 2. `npm create vite@latest` uses the latest Vite version, which may conflict with older Node.js versions. Please check your environment configuration.
58
+
59
+ [shell]
60
+ ``` bash
61
+ npm create vite@latest
62
+
63
+ ◇ Project name:
64
+ │ chat-integration-vue3-h5
65
+ │
66
+ ◇ Select a framework:
67
+ │ Vue
68
+ │
69
+ ◇ Select a variant:
70
+ │ TypeScript
71
+ │
72
+ ◆ Install with npm and start now?
73
+ │ ● Yes / ○ No
74
+ └
75
+ ```
76
+
77
+ ## Download and Import Components
78
+
79
+ ### Step 1: Install Dependencies
80
+
81
+ [shell]
82
+ ``` bash
83
+ npm install @tencentcloud/chat-uikit-vue3 @tencentcloud/uikit-base-component-vue3
84
+ ```
85
+
86
+ ### Step 2: Import Components
87
+ 1. Configure the mobile viewport.
88
+
89
+ The first step for a great mobile experience: in the project root, set the default viewport in index.html to full-screen coverage with locked scaling, making the page feel more like a native app.
90
+
91
+ ``` html
92
+ <!DOCTYPE html>
93
+ <html lang="zh-CN">
94
+ <head>
95
+ <meta charset="UTF-8" />
96
+ <!-- H5 viewport: 覆盖刘海屏区域,锁定缩放,营造类原生应用的体验 -->
97
+ <meta
98
+ name="viewport"
99
+ content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"
100
+ />
101
+ <title>Chat UIKit H5 Quickstart</title>
102
+ </head>
103
+ <body>
104
+ <div id="app"></div>
105
+ <script type="module" src="/src/main.ts"></script>
106
+ </body>
107
+ </html>
108
+ ```
109
+ 2. Configure the global entry point and base styles.
110
+
111
+ Write the following into **src/main.ts**.
112
+
113
+ ``` typescript
114
+ import { createApp } from 'vue';
115
+ import App from './App.vue';
116
+ import './styles.css';
117
+
118
+ createApp(App).mount('#app');
119
+ ```
120
+
121
+ Create **src/styles.css** and set the global base styles.
122
+
123
+ ``` css
124
+ /* ------- 移动端基础布局 ------- */
125
+ * {
126
+ box-sizing: border-box;
127
+ }
128
+
129
+ html,
130
+ body,
131
+ #app {
132
+ width: 100%;
133
+ height: 100%;
134
+ margin: 0;
135
+ }
136
+
137
+ body {
138
+ /* 使用 dvh 来处理 iOS Safari 地址栏. */
139
+ min-height: 100vh;
140
+ min-height: 100dvh;
141
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
142
+ color: #1f2329;
143
+ background: #f5f6f8;
144
+ /* 移除移动版 WebKit 上的点击亮块。 */
145
+ -webkit-tap-highlight-color: transparent;
146
+ }
147
+
148
+ button {
149
+ font: inherit;
150
+ cursor: pointer;
151
+ }
152
+
153
+ /* 16px 可防止 iOS 在输入框获得焦点时自动放大屏幕。 */
154
+ input {
155
+ font-size: 16px;
156
+ }
157
+ ```
158
+ 3. Configure the app home page.
159
+
160
+ Write the following into **src/App.vue** to route between the login page and chat page.
161
+
162
+ ``` typescript
163
+ <script setup lang="ts">
164
+ import { ref, watch } from 'vue';
165
+ import { UIKitProvider, useLoginState } from '@tencentcloud/chat-uikit-vue3';
166
+ import LoginView from './LoginView.vue';
167
+ import ChatLayout from './ChatLayout.vue';
168
+ import { languageResources } from './i18n';
169
+
170
+ enum LoginStatus {
171
+ UNKNOWN = 0,
172
+ LOGINED = 1,
173
+ }
174
+
175
+ // 语言在此处进行维护,并通过 UIKitProvider 的 `language` 属性进行配置。
176
+ // 这是控制语言的推荐方式
177
+ // 更新这个单一数据源,它驱动整个 UIKit。
178
+ const language = ref('zh-CN');
179
+
180
+ const { loginStatus } = useLoginState();
181
+ </script>
182
+
183
+ <template>
184
+ <UIKitProvider theme="light" :language="language" :language-resources="languageResources">
185
+ <LoginView v-if="loginStatus !== LoginStatus.LOGINED" />
186
+ <ChatLayout v-else />
187
+ </UIKitProvider>
188
+ </template>
189
+ ```
190
+ 4. Configure the login page and chat page.
191
+
192
+ Create **src/LoginView.vue** and write the following code to build the login page.
193
+
194
+ [src/LoginView.vue]
195
+ ``` typescript
196
+ <script setup lang="ts">
197
+ import { ref } from 'vue';
198
+ import { useLoginState, useUIKit } from '@tencentcloud/chat-uikit-vue3';
199
+
200
+ const { login } = useLoginState();
201
+ const { t, language, setLanguage } = useUIKit();
202
+
203
+ // 语言切换器中显示的语言。标签使用本来的语言,确保用户
204
+ // 不受当前 UI 语言影响,始终能识别自己的选项。
205
+ const LANGUAGES = [
206
+ { value: 'zh-CN', label: '中文' },
207
+ { value: 'en-US', label: 'English' },
208
+ ];
209
+
210
+ const sdkAppId = ref<number>();
211
+ const userId = ref('');
212
+ const userSig = ref('');
213
+ const loading = ref(false);
214
+ const error = ref('');
215
+
216
+ async function handleSubmit() {
217
+ error.value = '';
218
+ if (!sdkAppId.value || !userId.value || !userSig.value) {
219
+ error.value = t('demo.error.required');
220
+ return;
221
+ }
222
+
223
+ loading.value = true;
224
+ try {
225
+ await login({
226
+ sdkAppId: Number(sdkAppId.value),
227
+ userId: userId.value,
228
+ userSig: userSig.value,
229
+ });
230
+ } catch (e) {
231
+ error.value = e instanceof Error ? e.message : t('demo.error.loginFailed');
232
+ } finally {
233
+ loading.value = false;
234
+ }
235
+ }
236
+ </script>
237
+
238
+ <template>
239
+ <div class="login">
240
+ <div class="login__lang" role="group" aria-label="Language">
241
+ <button
242
+ v-for="item in LANGUAGES"
243
+ :key="item.value"
244
+ type="button"
245
+ :class="['login__lang-btn', { 'login__lang-btn--active': item.value === language }]"
246
+ @click="setLanguage(item.value)"
247
+ >
248
+ {{ item.label }}
249
+ </button>
250
+ </div>
251
+
252
+ <form class="login__card" @submit.prevent="handleSubmit">
253
+ <h1 class="login__title">{{ t('demo.appTitle') }}</h1>
254
+
255
+ <label class="login__field">
256
+ <span>{{ t('demo.field.sdkAppId') }}</span>
257
+ <input v-model.number="sdkAppId" type="number" :placeholder="t('demo.placeholder.sdkAppId')" />
258
+ </label>
259
+
260
+ <label class="login__field">
261
+ <span>{{ t('demo.field.userId') }}</span>
262
+ <input v-model="userId" type="text" :placeholder="t('demo.placeholder.userId')" />
263
+ </label>
264
+
265
+ <label class="login__field">
266
+ <span>{{ t('demo.field.userSig') }}</span>
267
+ <input v-model="userSig" type="text" :placeholder="t('demo.placeholder.userSig')" />
268
+ </label>
269
+
270
+ <p v-if="error" class="login__error">{{ error }}</p>
271
+
272
+ <button class="login__submit" type="submit" :disabled="loading">
273
+ {{ loading ? t('demo.loggingIn') : t('demo.login') }}
274
+ </button>
275
+ </form>
276
+ </div>
277
+ </template>
278
+
279
+ ```
280
+
281
+ Create **src/ChatLayout.vue** and write the following code to build the main chat layout.
282
+
283
+ [src/ChatLayout.vue]
284
+ ``` typescript
285
+ <script setup lang="ts">
286
+ import { ref, watch, onMounted } from 'vue';
287
+ import {
288
+ Chat,
289
+ ChatHeaderH5,
290
+ ChatSettingH5,
291
+ ContactInfoH5,
292
+ ContactListH5,
293
+ ConversationListH5,
294
+ MessageInputH5,
295
+ MessageListH5,
296
+ SearchH5,
297
+ VariantType,
298
+ useChatContext,
299
+ useLoginState,
300
+ useUIKit,
301
+ } from '@tencentcloud/chat-uikit-vue3';
302
+ import { IconMenu, IconSearch } from '@tencentcloud/uikit-base-component-vue3';
303
+ import type { ContactGroupItem } from '@tencentcloud/chat-uikit-vue3';
304
+
305
+ type MobileView = 'conversations' | 'chat' | 'contacts' | 'contactInfo' | 'search' | 'setting';
306
+
307
+ const { activeConversation, activeConversationID, sendMessage, setActiveConversation } = useChatContext();
308
+ const { loginUserInfo, logout } = useLoginState();
309
+ const { t, language, setLanguage } = useUIKit();
310
+
311
+ const defaultOpenConversationID = ref('C2Cadministrator');
312
+
313
+ function toggleLanguage() {
314
+ setLanguage(language.value === 'zh-CN' ? 'en-US' : 'zh-CN');
315
+ }
316
+
317
+ const activeView = ref<MobileView>('conversations');
318
+
319
+ // 记住搜索是从哪里打开的,使其返回按钮能回到原处。
320
+ const previousView = ref<MobileView>('chat');
321
+ const selectedContact = ref<ContactGroupItem>();
322
+
323
+ function openFromChat(view: 'search' | 'setting') {
324
+ previousView.value = activeView.value;
325
+ activeView.value = view;
326
+ }
327
+
328
+ function handleConversationSelect() {
329
+ activeView.value = 'chat';
330
+ }
331
+
332
+ function handleContactSelect(contact: ContactGroupItem) {
333
+ selectedContact.value = contact;
334
+ activeView.value = 'contactInfo';
335
+ }
336
+
337
+ function handleSendMessage(contact) {
338
+ setActiveConversation(`C2C${contact.userID}`);
339
+ activeView.value = 'chat';
340
+ }
341
+
342
+ function handleEnterGroup(group) {
343
+ setActiveConversation(`GROUP${group.groupID}`);
344
+ activeView.value = 'chat';
345
+ }
346
+
347
+ function handleChatBack() {
348
+ setActiveConversation(undefined);
349
+ activeView.value = 'conversations';
350
+ }
351
+
352
+ function handleSearchResultClick(_item: unknown, type: string) {
353
+ if (type === 'chat_message') {
354
+ activeView.value = 'chat';
355
+ }
356
+ }
357
+
358
+ watch(activeConversationID, (id, prevId) => {
359
+ if (id && id !== prevId && activeView.value === 'conversations') {
360
+ activeView.value = 'chat';
361
+ }
362
+ });
363
+
364
+ onMounted(() => {
365
+ setTimeout(() => {
366
+ if (activeConversation.value?.conversationID === defaultOpenConversationID.value) {
367
+ sendMessage({
368
+ type: 'textMessage',
369
+ text: `欢迎体验 Chat Vue3 移动端WEB应用 Demo~
370
+
371
+ 您可以按照以下顺序体验 IM 的核心功能:
372
+ 1. 在输入框内发送一条文本消息。
373
+ 2. 输入框上的工具栏支持,语音通话、视频通话、快速会议、图片、视频、文件发送等扩展功能。
374
+ 3. 如果您想添加好友,可以前往联系人页面点击"添加好友/群聊"。
375
+ `
376
+ });
377
+ }
378
+ }, 1000);
379
+ });
380
+ </script>
381
+
382
+ <template>
383
+ <div class="app-shell">
384
+ <!-- View: conversation list -->
385
+ <section v-show="activeView === 'conversations'" class="screen">
386
+ <header class="topbar">
387
+ <span class="topbar__title">
388
+ {{ t('demo.chats') }}{{ loginUserInfo?.userId ? ` · ${loginUserInfo.userId}` : '' }}
389
+ </span>
390
+ <div class="chat-pane__actions">
391
+ <button class="topbar__text-btn" type="button" @click="toggleLanguage">
392
+ {{ language === 'zh-CN' ? 'EN' : '中' }}
393
+ </button>
394
+ <button class="topbar__text-btn" type="button" @click="logout">{{ t('demo.logout') }}</button>
395
+ </div>
396
+ </header>
397
+ <div class="screen__body">
398
+ <ConversationListH5
399
+ style="height: 100%"
400
+ @select-conversation="handleConversationSelect"
401
+ @before-create-conversation="handleConversationSelect"
402
+ />
403
+ </div>
404
+ <nav class="tabbar">
405
+ <button class="tabbar__item tabbar__item--active" type="button">{{ t('demo.chats') }}</button>
406
+ <button class="tabbar__item" type="button" @click="activeView = 'contacts'">{{ t('demo.contacts') }}</button>
407
+ </nav>
408
+ </section>
409
+
410
+ <!-- View: contacts -->
411
+ <section v-show="activeView === 'contacts'" class="screen">
412
+ <header class="topbar">
413
+ <span class="topbar__title">{{ t('demo.contacts') }}</span>
414
+ </header>
415
+ <div class="screen__body">
416
+ <ContactListH5 @contact-item-click="handleContactSelect" />
417
+ </div>
418
+ <nav class="tabbar">
419
+ <button class="tabbar__item" type="button" @click="activeView = 'conversations'">{{ t('demo.chats') }}</button>
420
+ <button class="tabbar__item tabbar__item--active" type="button">{{ t('demo.contacts') }}</button>
421
+ </nav>
422
+ </section>
423
+
424
+ <!-- View: contact detail -->
425
+ <section v-show="activeView === 'contactInfo'" class="screen">
426
+ <div class="screen__body screen__body--surface">
427
+ <ContactInfoH5
428
+ :contact-item="selectedContact"
429
+ @close="activeView = 'contacts'"
430
+ @send-message="handleSendMessage"
431
+ @enter-group="handleEnterGroup"
432
+ />
433
+ </div>
434
+ </section>
435
+
436
+ <!-- View: chat (kept alive to avoid re-rendering the message list) -->
437
+ <section v-show="activeView === 'chat'" class="screen">
438
+ <Chat>
439
+ <header class="chat-pane__header">
440
+ <ChatHeaderH5 :enable-user-status="true" :on-back="handleChatBack">
441
+ <template #ChatHeaderRight>
442
+ <div class="chat-pane__actions">
443
+ <button class="icon-btn" type="button" :aria-label="t('demo.search')" @click="openFromChat('search')">
444
+ <IconSearch :size="20" />
445
+ </button>
446
+ <button class="icon-btn" type="button" :aria-label="t('demo.setting')" @click="openFromChat('setting')">
447
+ <IconMenu :size="20" />
448
+ </button>
449
+ </div>
450
+ </template>
451
+ </ChatHeaderH5>
452
+ </header>
453
+ <MessageListH5 class="chat-pane__list" />
454
+ <MessageInputH5
455
+ class="chat-pane__input"
456
+ :actions="['EmojiPicker', 'ImagePicker', 'VideoPicker', 'FilePicker', 'AudioCallPicker', 'VideoCallPicker', 'QuickConferencePicker']"
457
+ />
458
+ </Chat>
459
+ </section>
460
+
461
+ <!-- View: search -->
462
+ <section v-show="activeView === 'search'" class="screen">
463
+ <div class="screen__body">
464
+ <SearchH5
465
+ :variant="VariantType.EMBEDDED"
466
+ :on-back="() => (activeView = previousView)"
467
+ :on-result-item-click="handleSearchResultClick"
468
+ />
469
+ </div>
470
+ </section>
471
+
472
+ <!-- View: chat setting -->
473
+ <section v-show="activeView === 'setting'" class="screen">
474
+ <div class="screen__body screen__body--surface">
475
+ <ChatSettingH5 :on-back="() => (activeView = 'chat')" />
476
+ </div>
477
+ </section>
478
+ </div>
479
+ </template>
480
+
481
+ ```
482
+
483
+ 5. Configure internationalization.
484
+
485
+ Create src/i18n.ts and write the following to configure the multilingual content mentioned in this guide.
486
+
487
+ ``` typescript
488
+ // 本 demo 自身字符串的翻译(聊天组件的翻译由 UIKit 自身
489
+ // 通过 `language` prop 处理)。键名以 `demo.` 作为命名空间,
490
+ // 确保不会与库的 i18next 资源发生冲突。
491
+ //
492
+ // `languageResources` 传递给 <UIKitProvider>;可在任意位置
493
+ // 通过 `const { t } = useUIKit()` 和 `t('demo.chats')` 读取字符串。
494
+ type TranslationTree = { [key: string]: string | TranslationTree };
495
+ interface LanguageResource {
496
+ lng: string;
497
+ translation: TranslationTree;
498
+ }
499
+
500
+ const en = {
501
+ demo: {
502
+ appTitle: 'Chat UIKit H5',
503
+ field: { sdkAppId: 'SDKAppID', userId: 'UserID', userSig: 'UserSig' },
504
+ placeholder: {
505
+ sdkAppId: 'Your SDKAppID',
506
+ userId: 'e.g. user_001',
507
+ userSig: 'Test UserSig from IM console',
508
+ },
509
+ error: {
510
+ required: 'Please fill in SDKAppID, UserID and UserSig.',
511
+ loginFailed: 'Login failed, please check your credentials.',
512
+ },
513
+ login: 'Login',
514
+ loggingIn: 'Logging in…',
515
+ chats: 'Chats',
516
+ contacts: 'Contacts',
517
+ logout: 'Logout',
518
+ search: 'Search',
519
+ setting: 'Setting',
520
+ },
521
+ };
522
+
523
+ const zh = {
524
+ demo: {
525
+ appTitle: 'Chat UIKit H5',
526
+ field: { sdkAppId: 'SDKAppID', userId: '用户 ID', userSig: '用户签名' },
527
+ placeholder: {
528
+ sdkAppId: '请输入 SDKAppID',
529
+ userId: '例如 user_001',
530
+ userSig: '控制台获取的测试 UserSig',
531
+ },
532
+ error: {
533
+ required: '请填写 SDKAppID、用户 ID 和用户签名。',
534
+ loginFailed: '登录失败,请检查登录凭据。',
535
+ },
536
+ login: '登录',
537
+ loggingIn: '登录中…',
538
+ chats: '会话',
539
+ contacts: '通讯录',
540
+ logout: '退出登录',
541
+ search: '搜索',
542
+ setting: '设置',
543
+ },
544
+ };
545
+
546
+ export const languageResources: LanguageResource[] = [
547
+ { lng: 'en-US', translation: en },
548
+ { lng: 'zh-CN', translation: zh },
549
+ ];
550
+ ```
551
+
552
+ ### Step 3: Obtain SDKAppID, userID, and userSig
553
+ | Parameter | Type | Description |
554
+ | --- | --- | --- |
555
+ | SDKAppID | Number | The unique identifier for your Tencent Cloud IM application. You can create a new application in the <a href="https://console.cloud.tencent.com/im">IM Console</a> to obtain the SDKAppID.<br><strong>Note:</strong><br>Each independent app should have its own SDKAppID. Messages between different SDKAppIDs are naturally isolated. |
556
+ | userID | String | The unique user identifier you define. Only allows letters (a-z, A-Z), digits (0-9), underscores, and hyphens. |
557
+ | userSig | String | The authentication ticket for logging into IM. It is essentially ciphertext generated by encrypting information such as the UserID.<br><strong>Note:</strong><br>- Development: For quick testing, you can obtain UserSig from the <a href="https://console.cloud.tencent.com/im">IM Console</a>.<br>- Production: Integrate the UserSig calculation on your server. See <a href="https://cloud.tencent.com/document/product/269/32688">Server-side UserSig Generation</a>. |
558
+
559
+ > **Warning:**
560
+ > The sample code in this guide uses UserSig obtained from the [IM Console](https://console.cloud.tencent.com/im), which is **only suitable for local testing and debugging**. For production, see [Server-side UserSig Generation](https://cloud.tencent.com/document/product/269/32688).
561
+ >
562
+
563
+ - SDKAppID: In [IM Console > Application Management](https://console.cloud.tencent.com/im), click **Create New Application** to get the SDKAppID.
564
+
565
+ - userID: Go to [IM Console > Chat > Account Management](https://console.cloud.tencent.com/im/account-management), switch to your target application, and create 2-3 accounts for testing one-to-one and group chat features.
566
+
567
+ - userSig: Go to [IM Console > Developer Tools > UserSig Generation](https://console.cloud.tencent.com/im/tool-usersig), switch to your target application, enter the userID you created, and generate the userSig.
568
+
569
+ ## Run and Test
570
+
571
+ Run the project with the following command:
572
+
573
+ [shell]
574
+ ``` bash
575
+ npm run dev
576
+ ```
577
+
578
+ ## Integrate Advanced Features
579
+
580
+ ### Audio/Video Calls
581
+
582
+ > **Note:**
583
+ > TUICallKit is a Tencent Cloud audio/video calling UI component. By integrating it, you can experience audio/video calling in your chat app with just a few lines of code.
584
+ >
585
+ > For more details, see: Audio/Video Calling - Activate Service.
586
+ >
587
+
588
+ 1. Install the @trtc/calls-uikit-vue dependency.
589
+
590
+ ``` bash
591
+ npm install @trtc/calls-uikit-vue
592
+ ```
593
+ 2. Import TUICallKit from @trtc/calls-uikit-vue and mount it to the DOM.
594
+
595
+ Add the following code to the src/App.vue file:
596
+
597
+ ``` typescript
598
+ <script setup lang="ts">
599
+ import { ref, watch } from 'vue';
600
+ import { UIKitProvider, useLoginState } from '@tencentcloud/chat-uikit-vue3';
601
+ import { TUICallKit } from '@trtc/calls-uikit-vue';
602
+ import LoginView from './LoginView.vue';
603
+ import ChatLayout from './ChatLayout.vue';
604
+ import { languageResources } from './i18n';
605
+
606
+ enum LoginStatus {
607
+ UNKNOWN = 0,
608
+ LOGINED = 1,
609
+ }
610
+
611
+ // Language is owned here and configured via UIKitProvider's `language` prop.
612
+ // This is the recommended way to control the language: children request a change
613
+ // and we update this single source of truth, which drives the whole UIKit.
614
+ const language = ref('zh-CN');
615
+
616
+ const { loginStatus } = useLoginState();
617
+ </script>
618
+
619
+ <template>
620
+ <UIKitProvider :language="language" :language-resources="languageResources">
621
+ <LoginView v-if="loginStatus !== LoginStatus.LOGINED" />
622
+ <ChatLayout v-else />
623
+
624
+ <!-- Audio/video calls. Mount once at the app root; it shares the chat login
625
+ session, so no extra login is needed. The call buttons are already
626
+ built into the chat header. -->
627
+ <div v-if="loginStatus === LoginStatus.LOGINED" class="call-kit">
628
+ <TUICallKit />
629
+ </div>
630
+ </UIKitProvider>
631
+ </template>
632
+
633
+ ```
634
+ 3. 如果不需要集成音视频通话,可以修改 MessageInputH5 组件 actions 属性,来隐藏语音通话和视频通话的入口。
635
+
636
+ ``` typescript
637
+ <MessageInputH5 class="chat-pane__input" :actions="['EmojiPicker', 'ImagePicker', 'VideoPicker', 'FilePicker']" />
638
+ ```
639
+
640
+ ### Video Conferencing
641
+
642
+ TUIRoomKit is a low-code UI component for multi-party audio/video scenarios such as enterprise meetings, webinars, and online education. It provides room management, member management, screen sharing, and other meeting controls, supporting SD, HD, and Ultra HD video quality.
643
+
644
+ The integration above includes video conferencing by default. To disable it, use the `actions` prop on the `<MessageInput />` component to control the input toolbar and remove the video conferencing tool (QuickConferencePicker).
645
+ ``` java
646
+
647
+ <MessageInputH5
648
+ class="chat-pane__input"
649
+ :actions="['EmojiPicker', 'ImagePicker', 'VideoPicker', 'FilePicker', 'AudioCallPicker', 'VideoCallPicker']"
650
+ />
651
+ ```
652
+
653
+ ### Cloud Search
654
+
655
+ > **Note:**
656
+ > Search is an essential feature for customer service, social, online education, telemedicine, OA, and other scenarios. It helps users quickly find groups, users, and messages, improving product experience and user engagement.
657
+ >
658
+ > Due to the limitations of Web platform local storage, **local search is not available**. To better meet search needs, **cloud search** is provided. **Cloud search supports global search and in-conversation search, including searching for groups, users, and messages.**
659
+ >
660
+ > This is a value-added service. You need to purchase the cloud search plugin. Click [Purchase](https://console.cloud.tencent.com/im/plugin/TUICloudSearch).
661
+ >
662
+
663
+ Cloud search is integrated by default in Step 2. To disable cloud search:
664
+ 1. Set the `enableSearch` prop of `ConversationList` to `false`:
665
+
666
+ ``` typescript
667
+ <ConversationListH5 :enable-search="false" />
668
+ ```
669
+ 2. Comment out the in-conversation search related code:
670
+
671
+ ``` typescript
672
+ <ChatHeaderH5 :enable-user-status="true" :on-back="handleChatBack">
673
+ <template #ChatHeaderRight>
674
+ <div class="chat-pane__actions">
675
+ <!-- <button class="icon-btn" type="button" :aria-label="t('demo.search')" @click="openFromChat('search')">
676
+ <IconSearch :size="20" />
677
+ </button> -->
678
+ <button class="icon-btn" type="button" :aria-label="t('demo.setting')" @click="openFromChat('setting')">
679
+ <IconMenu :size="20" />
680
+ </button>
681
+ </div>
682
+ </template>
683
+ </ChatHeaderH5>
684
+ ```
685
+
686
+ ## FAQ
687
+
688
+ ### What is UserSig? How to generate UserSig?
689
+
690
+ UserSig is the authentication ticket for logging into IM. It is essentially ciphertext generated by encrypting information such as the UserID. The recommended approach is to integrate UserSig calculation on your server and provide a project-facing API. When UserSig is needed, your project requests a dynamic UserSig from the business server. For more details, see [Server-side UserSig Generation](https://cloud.tencent.com/document/product/269/32688).
691
+
692
+ > **Warning:**
693
+ > The sample code in this guide uses UserSig obtained from the [IM Console](https://console.cloud.tencent.com/im), which is **only suitable for local testing and debugging**. For production, see [Server-side UserSig Generation](https://cloud.tencent.com/document/product/269/32688).
694
+ >
695
+
696
+ ### Can I use third-party component libraries like Element-Plus?
697
+
698
+ You can use other component libraries for the glue code between core components, as shown in the example code — for instance, you can wrap `<ChatSettingH5 />` in a full-screen drawer component. However, components already built into the core components cannot be modified at this time.
699
+ ``` typescript
700
+ const isChatSettingShow = ref(false);
701
+
702
+ <el-drawer
703
+ v-model="isChatSettingShow"
704
+ title="设置"
705
+ >
706
+ <ChatSettingH5 />
707
+ </el-drawer>
708
+ ```
709
+
710
+ ### Emoji Packs
711
+
712
+ To respect copyrights, the **default yellow-face emoji pack shown below is copyrighted by Tencent Cloud**. You can use it for free by upgrading to the [IM Enterprise plan](https://buy.cloud.tencent.com/avc).
713
+
714
+ ### NPM Package
715
+
716
+ [chat-uikit-vue3 npm](https://www.npmjs.com/package/@tencentcloud/chat-uikit-vue3)
717
+